CreateProcessWithLogonw Authentication Error

From: alrosine (member31858_at_dbforums.com)
Date: 06/25/03


Date: Wed, 25 Jun 2003 05:39:08 +0000


Running the code below with the following command line

StatThis.exe UserID UserPassword UserDomain CommandLine

and receiving an authentication error (GetLastError() returns 1326).
The UserID and password I am using are valid. I've tried a UserID and a
domain and I've tried using a UPN format with a null domain. I have put
quotes around the values and tried it without. I have tried every
iteration I can think of but can't seem to resolve the problem.

Any suggestions or information would be greatly appreciated.

Thanks in advance.

int result;
PROCESS_INFORMATION myprocessinfo;
STARTUPINFOW mystartupinfo;

::ZeroMemory(&mystartupinfo, sizeof(STARTUPINFOW));
mystartupinfo.cb = sizeof(STARTUPINFOW);
mystartupinfo.lpDesktop = NULL;

result=CreateProcessWithLogonW((LPCWSTR)argv[1],
                        (LPCWSTR)argv[3],
                        (LPCWSTR)argv[2],
                        LOGON_WITH_PROFILE,
                        (LPCWSTR)argv[4],
                        NULL,
                        CREATE_DEFAULT_ERROR_MODE |
                        CREATE_NEW_CONSOLE |
                        CREATE_NEW_PROCESS_GROUP,
                        NULL,
                        NULL,
                        &mystartupinfo,
                        &myprocessinfo
                        );

if (result==0){
        CHAR szBuf[800];
        sprintf(szBuf, "CreateProcess failed: Error returned %u\n",
        GetLastError());
        MessageBox(NULL, szBuf, "Error", MB_OK);
        result=1;
} else {
        CloseHandle (myprocessinfo.hThread);
        CloseHandle (myprocessinfo.hProcess);
}
return (result);

--
Posted via http://dbforums.com