000 
            10.10.2006, 09:41 Uhr 
            ~kaasiro 
            Gast
             
            
             
             
             | 
          Hallo, ich versuche einen Prozess unter Admin Konto laufen zu lassen, bisher ohne Erfolg. Der angemeldete Benutzer hat eingeschränkte Rechte. Bei der Ausführung lautet die Fehlermeldung: "..faild with error 1326: Anmeldung fehlgeschlagen: unbekannter Benutzername oder falsches Kennwort." OS ist XP Prof. SP2. Was stimmt hier nicht, hat jemand eine Idee?
  Ein Beispiel:
 
  
   
  
  
    | C++: | 
   
  
    
      
  #define _WIN32_WINNT 0x0500
  #include <cstdlib> #include <iostream> #include <Windows.h>
 
  using namespace std;
 
  int main(int argc, char *argv[]) {         STARTUPINFO si;     PROCESS_INFORMATION pi;     memset(&si,0,sizeof(STARTUPINFO));     si.cb = sizeof(STARTUPINFO);     si.wShowWindow = SW_SHOW;     si.lpTitle = NULL;                     CreateProcessWithLogonW(                               LPCWSTR ("abc"),                         //LPCWSTR lpUsername                               LPCWSTR ("abc"),                          //LPCWSTR lpDomain                               LPCWSTR ("abc"),                        //LPCWSTR lpPassword                               0,                                        //DWORD dwLogonFlags                               LPCWSTR ("C:\\WINDOWS\\notepad.exe"),     //LPCWSTR lpApplicationName                               NULL,                      //LPWSTR lpCommandLine                               CREATE_DEFAULT_ERROR_MODE,                //DWORD dwCreationFlags                               NULL,                                     //LPVOID lpEnvironment                               NULL,                                     //LPCWSTR lpCurrentDirectory                               LPSTARTUPINFOW (&si),                     //LPSTARTUPINFOW lpStartupInfo                               &pi                                       //LPPROCESS_INFORMATION lpProcessInfo                               );
               //*** Fehlerausgabe                  LPVOID lpMsgBuf;         LPVOID lpDisplayBuf;         LPTSTR lpszFunction;         lpszFunction = "CreateProcessWithLogonW";         DWORD dw = GetLastError();               FormatMessage(             FORMAT_MESSAGE_ALLOCATE_BUFFER |              FORMAT_MESSAGE_FROM_SYSTEM,             NULL,             dw,             MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),             (LPTSTR) &lpMsgBuf,             0, NULL );              lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT,              (lstrlen((LPCTSTR)lpMsgBuf)+lstrlen((LPCTSTR)lpszFunction)+40)*sizeof(TCHAR));          wsprintf((LPTSTR)lpDisplayBuf,              TEXT("%s failed with error %d: %s"),              lpszFunction, dw, lpMsgBuf);          MessageBox(NULL, (LPCTSTR)lpDisplayBuf, TEXT("Error"), MB_OK);               LocalFree(lpMsgBuf);         LocalFree(lpDisplayBuf);         ExitProcess(dw);        //***
        //Warten bis der Prozess beendet wird       WaitForSingleObject (pi.hProcess, INFINITE);                    CloseHandle( pi.hProcess );       CloseHandle( pi.hThread );                 //system("PAUSE");     return EXIT_SUCCESS; } 
       
      
     | 
   
   
   Dieser Post wurde am 10.10.2006 um 11:39 Uhr von FloSoft editiert. |