Note that there are some explanatory texts on larger screens.

plurals
  1. POnetuseradd user already exists error
    primarykey
    data
    text
    <p>I receive user already exists error code when I try to create account programmaticaly in windows 7, although user does not exists. What may be the cause of this problem ?</p> <pre><code>int wmain(int argc, wchar_t *argv[]) { USER_INFO_1 ui; ui.usri1_name =L"test-PC"; ui.usri1_password = L"12"; ui.usri1_priv = USER_PRIV_USER; ui.usri1_home_dir = NULL; ui.usri1_comment = NULL; ui.usri1_flags = UF_SCRIPT; ui.usri1_script_path = NULL; addUser(NULL, ui); while(true){} return 0; </code></pre> <p>}</p> <pre><code>int addUser(LPWSTR servername, USER_INFO_1 ui) { DWORD dwLevel = 1; DWORD dwError = 0; // Call the NetUserAdd function, specifying level 1. NET_API_STATUS nStatus = NetUserAdd(servername, dwLevel, (LPBYTE)&amp;ui, &amp;dwError); // If the call succeeds, inform the user. // Nerr_Success error code is 0 independant from nerr_base if (nStatus == NERR_Success) { fwprintf(stderr, L"ADD: User %s has been successfully added on %s\n", "1", "2"); return 1; } //Nerr_base should be given since userexists is calculated by adding nerr_base to error code else if((NERR_BASE + nStatus) == NERR_UserExists) fprintf(stderr, "ADD: Account already exists: %d\n", nStatus); else if(NERR_BASE + nStatus == ERROR_ACCESS_DENIED) fprintf(stderr, "ADD: Access Denied: %d\n", nStatus); else if(NERR_BASE + nStatus == NERR_PasswordTooShort) fprintf(stderr, "ADD: Password is too short: %d\n", nStatus); else if(NERR_BASE + nStatus == NERR_PasswordTooLong) fprintf(stderr, "ADD: Password is too long: %d\n", nStatus); else fprintf(stderr, "ADD: A system error has occurred2: %d\n", nStatus); return 0; </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload