简体   繁体   English

WinRar退出代码在SP2 / SP3和7中的不同行为

[英]WinRar exit code different behavior in SP2/SP3 and 7

I am new to windows programming and have written a small utility with mingw which will unrar a package. 我是Windows编程的新手,并用mingw编写了一个小实用程序,它将解压缩软件包。 The code is as provided below 代码如下

Descrition: 描述:

When the below program is run, the results are as follows 当运行以下程序时,结果如下

XPSP2 32 bit and Windows 7 XPSP2 32位和Windows 7

  • Untar Operation : Success Untar操作:成功
  • CreateProcess return code : Non Zero (Success) CreateProcess返回码:非零(成功)
  • exit Code : 0 (Success) 退出代码:0(成功)

XP2SP3 32 bit XP2SP3 32位

  • Untar Operation : Success Untar操作:成功
  • CreateProcess return code : Non Zero (Success) CreateProcess返回码:非零(成功)
  • exit Code : 3221225477 退出代码:3221225477

Problem Statement 问题陈述

I am not sure why in XP2SP3 patch only, the winRar operation provides the exit code as Huge positive value. 我不确定为什么仅在XP2SP3补丁程序中,winRar操作会将退出代码提供为巨大的正值。 Do you find any problem in the below code? 您在以下代码中发现任何问题吗? Please help in this regard. 请帮助这方面。


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 version trail Mode is used for above testing. PS:WinRar 3.8版本跟踪模式用于上述测试。

That huge positive number, in hexadecimal, is 0xC0000005. 以十六进制表示的那个巨大的正数是0xC0000005。 It's a common Windows error, which means "Access Violation". 这是Windows的常见错误,表示“访问冲突”。 Why exactly are you getting it really depends on what winrar is trying to do, but the problem might be with access rights to files. 为什么要真正获得它,实际上取决于winrar试图做什么,但是问题可能出在文件的访问权限上。 I suggest you give it a try with ProcMon watching your program's file activity. 我建议您尝试一下ProcMon,观察程序的文件活动。 If accessing one of the files is denied, you'll see it in the log. 如果访问其中一个文件被拒绝,您将在日志中看到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM