markwa
03-30-2007, 11:24 PM
My C++ app's call to CreateProcess for wupdate is silently failing. I'm at a loss for how trouble-shoot this.
CString strWupdatePath;
GetMNApp()->GetNotationDirectory(strWupdatePath);
strWupdatePath += "\\wupdate.exe";
STARTUPINFO startupInfo;
ZeroMemory(&startupInfo, sizeof(startupInfo));
startupInfo.cb = sizeof(startupInfo);
startupInfo.dwFlags = STARTF_USESHOWWINDOW;
startupInfo.wShowWindow = SW_SHOW;
PROCESS_INFORMATION processInformation;
ZeroMemory(&processInformation, sizeof(processInformation));
if (!CreateProcess(strWupdatePath,
NULL,
NULL, // lpProcessAttributes
NULL, // lpThreadAttributes,
FALSE, // bInheritHandles
0, // dwCreationFlags
NULL, // lpEnvironment
NULL, // lpCurrentDirectory
&startupInfo,
&processInformation))
{
AfxMessageBox("Could not start the automatic update.");
}
CreateProcess returns TRUE, but the first step of the wupdate u/i is not displayed.
If I play a trick, and rename wupdate.exe in the setup directory, and then put in its place another app (I used Windows mplayer2.exe), renaming mplayer2.exe to wupdate.exe, then my app correctly launches the substituted app. So, it seems that the CreateProcess coding is basically correct.
Also, if I run wupdate.exe stand-alone, then it works correctly.
So, in summary, wupdate.exe works stand-alone, and my app can successfully launch some other app substituted for wupdate.exe, but when my app tries to launch wupdate.exe, nothing happens, yet there is no failure return for the CreateProcess call.
Also, the Task Manager doesn't show wupdate.exe running as a process.
So, where do I go from here to trouble-shoot the problem? This is probably just a generic programming question about CreateProcess. Perhaps I need to add some special security options in the CreateProcess call. But I can find any other clues to know where I should go fishing next.
Has anyone been here before, having trouble launching wupdate via CreateProcess from a C/C++ app? (I'm using VC6, but that's probably irrelevant.)
Cheers
-- Mark
CString strWupdatePath;
GetMNApp()->GetNotationDirectory(strWupdatePath);
strWupdatePath += "\\wupdate.exe";
STARTUPINFO startupInfo;
ZeroMemory(&startupInfo, sizeof(startupInfo));
startupInfo.cb = sizeof(startupInfo);
startupInfo.dwFlags = STARTF_USESHOWWINDOW;
startupInfo.wShowWindow = SW_SHOW;
PROCESS_INFORMATION processInformation;
ZeroMemory(&processInformation, sizeof(processInformation));
if (!CreateProcess(strWupdatePath,
NULL,
NULL, // lpProcessAttributes
NULL, // lpThreadAttributes,
FALSE, // bInheritHandles
0, // dwCreationFlags
NULL, // lpEnvironment
NULL, // lpCurrentDirectory
&startupInfo,
&processInformation))
{
AfxMessageBox("Could not start the automatic update.");
}
CreateProcess returns TRUE, but the first step of the wupdate u/i is not displayed.
If I play a trick, and rename wupdate.exe in the setup directory, and then put in its place another app (I used Windows mplayer2.exe), renaming mplayer2.exe to wupdate.exe, then my app correctly launches the substituted app. So, it seems that the CreateProcess coding is basically correct.
Also, if I run wupdate.exe stand-alone, then it works correctly.
So, in summary, wupdate.exe works stand-alone, and my app can successfully launch some other app substituted for wupdate.exe, but when my app tries to launch wupdate.exe, nothing happens, yet there is no failure return for the CreateProcess call.
Also, the Task Manager doesn't show wupdate.exe running as a process.
So, where do I go from here to trouble-shoot the problem? This is probably just a generic programming question about CreateProcess. Perhaps I need to add some special security options in the CreateProcess call. But I can find any other clues to know where I should go fishing next.
Has anyone been here before, having trouble launching wupdate via CreateProcess from a C/C++ app? (I'm using VC6, but that's probably irrelevant.)
Cheers
-- Mark