Error in Createprocessasuser()
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);

