Einzelnen Beitrag anzeigen

Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#7

Re: Rückgabewert von CreateProcessWithLogonW und GetLastErro

  Alt 22. Jan 2005, 13:17
So dieser Code
Code:
#define _WIN32_WINNT 0x0500 

#include <windows.h>
#include <iostream>

int main()

    STARTUPINFOW startupInfo;
    ZeroMemory(&startupInfo, sizeof(STARTUPINFOW));
    startupInfo.cb = sizeof(STARTUPINFOW);
    startupInfo.dwFlags = STARTF_USESHOWWINDOW;
    startupInfo.wShowWindow = SW_SHOWNORMAL;
   
    PROCESS_INFORMATION processInformation;

    WCHAR commandLine[MAX_PATH];
    lstrcpyW(commandLine, L"C:\\winnt\\notepad.exe");

    BOOL ret = CreateProcessWithLogonW(L"Administrator",
                                       NULL,
                                       L"xxx",
                                       LOGON_WITH_PROFILE,
                                       NULL,
                                       commandLine,
                                       CREATE_DEFAULT_ERROR_MODE,
                                       NULL,
                                       NULL,
                                       &startupInfo,
                                       &processInformation);

    if(ret)
    { 
        std::cout << "CreateProcessWithLogonW succeed!" << std::endl;
    } 
    else
    { 
        std::cout << "CreateProcessWithLogonW failed! " << GetLastError() << std::endl;
    } 
}
(Quelle: http://www.c-plusplus.de/forum/viewtopic.php?t=98607 )

tut es unter Windows XP SP2 korrekt:
Zitat:
Anmeldung fehlgeschlagen: unbekannter Benutzername oder falsches Kennwort.
So jetzt die Preisfrage: Wo ist der Unterschied zu meinem Code?
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat