locked
Error in Createprocessasuser() RRS feed

  • Question

  • Hello,

      I am creating a service application in which I am calling a new .exe file when ever I start the service. but beore that I am facing problem in creating a process.

    I have used CreateProcessAsUser() but it is throwing an error

        "Error creating process: 1314" is the error

    can anyone helpme out with this?

    below is my code....

        TCHAR                                           *cmdstr;
        STARTUPINFO                              startUpInfo;
        PROCESS_INFORMATION         procInfo;
        BOOL                                              success;
        TCHAR                                           *lpUsername;
        TCHAR                                           *lpDomain;
        TCHAR                                           *lpPassword;
        HANDLE                                         hImpLog;

     cmdstr = "C:\\Documents and Settings\\praveen_p01\Desktop\\simple\\simple\\generic.exe";
    lpUsername = "Username";
    lpDomain = "Domain name";
    lpPassword ="Mypassword";
       

       // Retrieve the STARTUPINFO structure  for
        // the current process
        GetStartupInfo(&startUpInfo);
        startUpInfo.dwFlags = STARTF_USESHOWWINDOW; //BRS
        startUpInfo.wShowWindow = SW_SHOWDEFAULT; //BRS

        // Create the child process
        LogonUser(lpUsername,lpDomain,lpPassword,LOGON32_LOGON_INTERACTIVE,LOGON32_PROVIDER_DEFAULT,&hImpLog);
       
        success=CreateProcessAsUser(hImpLog,cmdstr,NULL,NULL,NULL,FALSE,CREATE_NEW_CONSOLE,NULL,NULL,&startUpInfo,&procInfo);
       
       
        // Wait for the child process to complete
        WaitForSingleObject(procInfo.hProcess, INFINITE);

     CloseHandle(procInfo.hProcess);
        CloseHandle(procInfo.hThread);
       

    Thursday, June 22, 2006 9:43 AM

All replies

  • You're missing a backslash before "Desktop" in cmdstr.
    Monday, June 26, 2006 7:08 AM
  • Since 1314 error states "A required Privilege is not held by the client", you need to find the priv needed and adjust the token for it.
    Wednesday, June 28, 2006 8:22 PM