C++ 通过RemoteApp执行应用程序时,PathFileExists返回false

C++ 通过RemoteApp执行应用程序时,PathFileExists返回false,c++,path,unc,remoteapp,C++,Path,Unc,Remoteapp,我在C++/WinAPI中内置的可执行文件将检查同一文件夹中的文件,我使用PathFileExists进行检查。当我在普通计算机上运行它时,它会找到文件,但当我在RemoteApp上发布可执行文件,并且从Web Access运行它时,却找不到文件。我会错过什么 // This is the file I want to find (located in the same directory as the EXE) wstring myfile = L"myfile.conf"; BOOL abs

我在C++/WinAPI中内置的可执行文件将检查同一文件夹中的文件,我使用
PathFileExists
进行检查。当我在普通计算机上运行它时,它会找到文件,但当我在RemoteApp上发布可执行文件,并且从Web Access运行它时,却找不到文件。我会错过什么

// This is the file I want to find (located in the same directory as the EXE)
wstring myfile = L"myfile.conf";
BOOL abspath = FALSE;

// Trying to get the absolute path first
DWORD nBufferLength = MAX_PATH;
wchar_t szCurrentDirectory[MAX_PATH + 1];
if (GetCurrentDirectory(nBufferLength, szCurrentDirectory) == 0) {
    szCurrentDirectory[MAX_PATH + 1] = '\0';
} else {
    abspath = true;
}

if (abspath) {
    // Create the absolute path to the file
    myfile = L'\\' + myfile;
    myfile = szCurrentDirectory + myfile ;
    MessageBox(hWnd, ConvertToUNC(myfile).c_str(), L"Absolute Path", MB_ICONINFORMATION);
} else {
    // Get the UNC path
    myfile = ConvertToUNC(myfile);
    MessageBox(hWnd, myfile.c_str(), L"UNC Path", MB_ICONINFORMATION);
}

//  Try to find file
int retval = PathFileExists(myfile.c_str());

if (retval == 1) {
    // Do something
} else {
    // File not found
}
ConvertToUNC
功能从复制而来。
我看到的是,尽管可执行文件位于其他地方,但绝对路径被认为是
C:\Windows
。我真的不知道是什么原因造成的。服务器是Windows 2012 R2,正如我所说,应用程序通过RemoteApp Web访问运行。返回的UNC路径只是文件名(没有卷或文件夹)

“我会缺少什么?”--您缺少的是调用
GetLastError
,查看为什么“PathFileExists”返回FALSE。访问权限?RemoteApps是否有权读取该目录?