I'm writing an user mode program that uses LogonUser/CreateProcessAsUser
pair to run a program under another account. All the code has been taken
from the "Starting an interactive client process" sample in the PSDK.
The code works just fine when I compile in release mode (using VC++ 6.0
standard edition, SP5), that is, logs on the user and starts the
program. But it always crashes in the CreateProcessAsUser call in debug
mode, access violation in kernel32.dll. I'm testing in W2K and XP, the
caller of the program has all the necessary privileges, but it also
crashes if a privilege is missing.
I'm just curious as to why this is happening. Any ideas?
Thanks!
Ralf.
--
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Ralf Buschmann" <busc...@ibherzog.de> wrote in message
news:3d4b103d$0$28141$afc3...@auth.de.news.easynet.net...
Thanks for your reply!
>Do you use the ansi or unicode version of the API ?
Unicode.
>The command line must be a "writable" string in memory.
Ah, now I see it in the docs:
|The Unicode version of this function, CreateProcessAsUserW,
|will fail if this parameter is a const string.
Well, should read "will crash" then :-). OK, then that is the problem
here. I was passing L"program.exe" for lpCommandLine.
But why it cannot be a const string for the Unicode version? And why
does it crash only in debug mode? Does the API actually modify the
string?
Ralf.
--
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Ralf Buschmann" <busc...@ibherzog.de> wrote in message
news:3d4c551b$0$28122$afc3...@auth.de.news.easynet.net...
>Basically, it writes a space after the executable name, if params are passed
>in a certain way.
Are you saying that for the Unicode version, if I pass in an allocated
buffer that contains the null terminated string L"program.exe", it might
overwrite the trailing zero??
Ralf.