|
-
July 7th, 2010, 06:07 AM
#1
CreateProcessAsUser() from service
Hi All,
When I try to create a process using CreateProcessAsuser() from a service, I am getting GetLastError() as 1813. (The specified resource type cannot be found in the image file. ERROR_RESOURCE_TYPE_NOT_FOUND "). But the return code is coming a True and process also initiated. But why GetLastError() is coming as 1813.
Please let me know if anyone have idea about this error even the API call returning success.
Regards
Sreeni
-
July 7th, 2010, 06:10 AM
#2
Re: CreateProcessAsUser() from service
Try SetLastError(0) prior to calling CreateProcesXxx and see if 1813 remains.
Best regards,
Igor
-
July 7th, 2010, 06:18 AM
#3
Re: CreateProcessAsUser() from service
GetLastError
Return Value
The return value is the calling thread's last-error code.
The Return Value section of the documentation for each function that sets the last-error code notes the conditions under which the function sets the last-error code. Most functions that set the thread's last-error code set it when they fail. However, some functions also set the last-error code when they succeed. If the function is not documented to set the last-error code, the value returned by this function is simply the most recent last-error code to have been set; some functions set the last-error code to 0 on success and others do not.
Best regards,
Igor
-
July 8th, 2010, 01:34 AM
#4
Re: CreateProcessAsUser() from service
Thank you for your response.
Even after setting error code to 0 SetLastError(0); before calling CreateProcessAsUser(), I am still getting the last error-code as 1813, But the process initiated without any issues.
Now I am coming to the real problem I am facing.
Actually we are working on a remote application, where we run the host process with CreateProcessAsUser(). Later from our application if we pass Ctrl+Alt+Del command we are getting UAC screen where we can LogOff the desktop. But on clicking LogOff the system getting crashed(blue screen). But this is not happening if I Log off the remote machine from Start menu of Windows(Start->Logoff) This is happening in Vista/Windows7.
Could you please throw some light on the issue?
Regards
Sreeni
-
July 8th, 2010, 03:48 AM
#5
Re: CreateProcessAsUser() from service
Never had such a task, and would like to have some background info for what you do: what is the effect you expect from that? You hope to logoff interactive user been running totally different account?
Best regards,
Igor
-
July 8th, 2010, 05:19 AM
#6
Re: CreateProcessAsUser() from service
If CreateProcessAsuser returns non-zero value that means you do not need to check for last error, the function has succeeded, some internal API call resulted in the last error but the internal code logic took care of that and succeeded.
So with Win32 APIs, always check the API's return value first, if that shows failure then go look at LastError.
Regards,
Ramkrishna Pawar
-
July 12th, 2010, 05:41 AM
#7
Re: CreateProcessAsUser() from service
Hi,
We have a remote application(like TightVNC) to connect to remote desktops. The server will be running on remote desktop, as I said this server is running from windows service. We have our own video driver. On Windows7 and Vista machine we are starting this server in winlogon session using CreateProcessAsUser(). And in STARTUP information we assigned the desktop(STARTUPINFO. lpDesktop) with "winsta0\\default". After session established between Client desktop and Remote sesktop, we are sending Ctrl+Alt+Del command, this is showing up with UAC screen. Then on clicking Logoff the blue screen is appearing(system crash). But it is not creating any dump file to analyse the issue.
The following url gives the sample code which we used to launch the host application in winlogon session.
http://www.codeproject.com/KB/vista-...px?msg=3198293
Please let me know if any details required.
Regards
Sreeni
-
July 12th, 2010, 06:03 AM
#8
Re: CreateProcessAsUser() from service
Please let me know if any details required.
I've asked the question, see my previous message.
Best regards,
Igor
-
July 12th, 2010, 07:48 AM
#9
Re: CreateProcessAsUser() from service
My expectation is it should behave same as how LogOff works. coming back to the user accounts screen where we can login again. But it is crashing with blue screen.
Regards
Sreeni
-
July 12th, 2010, 03:06 PM
#10
Re: CreateProcessAsUser() from service
So, bottom line is: you want to log off interactive user. Then you need to emit that Ctrl+Alt+Del in the context of the interactive session but not in the context of your remote application.
Best regards,
Igor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|