Reputation: 6817
Below is my code. The function is called, but it does not work. It dont call the exe. Why?
int Createprocesslogon()
{
STARTUPINFOW su_info;
ZeroMemory(&su_info, sizeof(STARTUPINFOW));
su_info.cb = sizeof(STARTUPINFOW);
PROCESS_INFORMATION pi;
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
CreateProcessWithLogonW(L"xxx", L"localhost", L"123456", 0, L"C:\\Program Files\\app\\IECapt.exe" ,L" --url=http://www.facebook.com/ --out=test.png --min-width=1024", 0, NULL, NULL, &su_info, &pi);
cout << "testt";
return 0;
}
Upvotes: 0
Views: 3771
Reputation: 18429
Did you mean CreateProcessAsUser
, or CreateProcessWithToken
after a call to LogonUser
?
EDIT: Try this (embedding argument in one):
CreateProcessWithLogonW(L"xxx", L"localhost", L"123456", 0, 0,
L"\"C:\\Program Files\\app\\IECapt.exe\" \" --url=http://www.facebook.com/ --out=test.png --min-width=1024\"", 0, NULL, NULL, &su_info, &pi);
Upvotes: 2
Reputation: 283733
lpCommandLine
is supposed to be the entire command line, starting with the executable (properly quoted). Otherwise your first argument ends up in argv[0]
and is ignored by the program.
Upvotes: 0