0

我今天有一个奇怪的问题...

我们有一个运行良好的软件。每天打开文件,创建进程...

但是今天,我们发现如果我们以管理员模式运行我们的软件......它不起作用......

例如,当我们尝试创建一个进程时:

if( !CreateProcess( NULL,   // No module name (use command line)
#ifdef _UNICODE
    LPWSTR(m_Exec.c_str()),        // Command line
#else
    LPSTR(m_Exec.c_str()),
#endif
    NULL,           // Process handle not inheritable
    NULL,           // Thread handle not inheritable
    FALSE,          // Set handle inheritance to FALSE
    CREATE_NEW_CONSOLE,              // No creation flags
    NULL,           // Use parent's environment block
    LPSTR(execFolder),           // Use parent's starting directory 
    &si,            // Pointer to STARTUPINFO structure
    &pi )           // Pointer to PROCESS_INFORMATION structure
    ) 
{
    cout <<  "[X] CreateProcess failed: " << GetLastError() << endl;
    HandleLastError("CreateProcess");
}

我们有这个错误:

[X] CreateProcess failed: 2
[X] ERROR: CreateProcess: File specified not found.

当我们尝试加载一个简单的配置文件时,我们软件的另一部分几乎同样的错误boost::filesystem

boost::filesystem::fstream exists(fPath);

返回file not found

但正如我所说,如果我们以完全相同的操作运行相同的软件但不是在管理员模式下,它可以工作......

当我们在互联网上搜索时,我们总是发现同样的事情:通过管理员模式,它会工作......但对我们来说,它是相反的......

任何想法 ?

PS:我们使用的是 Windows 7,我们使用 Visual Studio 2012 Update 3 编译软件。

4

0 回答 0