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);

[1562 byte] By [michels] at [2008-2-22]
# 1
You're missing a backslash before "Desktop" in cmdstr.
ChrisRossall at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Security for Applications in Windows Vista...
# 2
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.
jpatrick62 at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Security for Applications in Windows Vista...

Software Development for Windows Vista

Site Classified