[英]Cannot run any windows WPF applications in windows XP SP3 SP2
[英]WinRar exit code different behavior in SP2/SP3 and 7
我是Windows編程的新手,並用mingw編寫了一個小實用程序,它將解壓縮軟件包。 代碼如下
描述:
當運行以下程序時,結果如下
XPSP2 32位和Windows 7
XP2SP3 32位
問題陳述
我不確定為什么僅在XP2SP3補丁程序中,winRar操作會將退出代碼提供為巨大的正值。 您在以下代碼中發現任何問題嗎? 請幫助這方面。
int main()
{
string ProgramName = "C:\\Program Files\\WinRAR\\WinRAR.exe";
STARTUPINFO StartupInfo;
PROCESS_INFORMATION ProcessInfo;
memset(&StartupInfo, 0, sizeof(STARTUPINFO));
memset(&ProcessInfo, 0, sizeof(PROCESS_INFORMATION)
if (CreateProcess((LPCTSTR)ProgramName.c_str(),(LPCTSTR)"WinRAR.exe x -y -ibck d:\\abc.tar d:\\"),NULL,
NULL,
FALSE,
NORMAL_PRIORITY_CLASS,
NULL,
NULL,
&StartupInfo,
&ProcessInfo) == 0)
{
string tmpStr("Error executing");
tmpStr += ProgramName;
cout<<"StmtDesigner"<<tmpStr<<"CreateProcess failed"<<endl;
}
else
{
string tmpStr("Succes executing");
tmpStr += ProgramName;
cout<<"StmtDesigner"<<tmpStr<<"CreateProcess Success"<<endl;
WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
DWORD exitCode=0;
if (GetExitCodeProcess(ProcessInfo.hProcess, &exitCode))
{
string tmpStr("GetExitCodeProcess");
tmpStr += ProgramName;
cout<<tmpStr<<"WinRAR.exe x -y -ibc<<endl;
}
}
CloseHandle(ProcessInfo.hProcess);
CloseHandle(ProcessInfo.hThread);
getch();
return 0;
}
PS:WinRar 3.8版本跟蹤模式用於上述測試。
以十六進制表示的那個巨大的正數是0xC0000005。 這是Windows的常見錯誤,表示“訪問沖突”。 為什么要真正獲得它,實際上取決於winrar試圖做什么,但是問題可能出在文件的訪問權限上。 我建議您嘗試一下ProcMon,觀察程序的文件活動。 如果訪問其中一個文件被拒絕,您將在日志中看到它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.