mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-05-08 02:53:03 +08:00
OpenCOW: dynamic call to GetLongPathNameA
This commit is contained in:
parent
db65b54e78
commit
5eb3e9e3f3
@ -956,6 +956,8 @@ OCOW_DEF(DWORD, GetLogicalDriveStringsW,(
|
||||
return len;
|
||||
}
|
||||
|
||||
typedef BOOL (WINAPI *fpGetLongPathNameA)(LPCSTR,LPSTR,DWORD);
|
||||
static fpGetLongPathNameA pGetLongPathNameA;
|
||||
|
||||
OCOW_DEF(DWORD, GetLongPathNameW,(
|
||||
IN LPCWSTR lpszShortPath,
|
||||
@ -974,13 +976,19 @@ OCOW_DEF(DWORD, GetLongPathNameW,(
|
||||
if (!mbcsLongPath.SetCapacity((int) dwResult))
|
||||
return 0;
|
||||
}
|
||||
#if (defined(_WIN32_WINDOWS) && _WIN32_WINDOWS >= 0x0410) || (defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0500) //Win98+/2k+
|
||||
dwResult = ::GetLongPathNameA(mbcsShortPath, mbcsLongPath, (DWORD) mbcsLongPath.BufferSize());
|
||||
#else
|
||||
dwResult = mbcsShortPath.BufferSize() + 1;
|
||||
if(dwResult <= mbcsLongPath.BufferSize())
|
||||
memcpy(mbcsLongPath, mbcsShortPath, dwResult);
|
||||
#endif
|
||||
if((g_nPlatform > MZ_PLATFORM_95 && g_nPlatform <= MZ_PLATFORM_ME) || g_nPlatform >= MZ_PLATFORM_2K)
|
||||
{
|
||||
if(!pGetLongPathNameA)
|
||||
pGetLongPathNameA = (fpGetLongPathNameA) ::GetProcAddress(
|
||||
::GetModuleHandleA("kernel32.dll"), "GetLongPathNameA");
|
||||
dwResult = pGetLongPathNameA ? pGetLongPathNameA(mbcsShortPath, mbcsLongPath, (DWORD) mbcsLongPath.BufferSize()) : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dwResult = mbcsShortPath.BufferSize() + 1;
|
||||
if(dwResult <= mbcsLongPath.BufferSize())
|
||||
memcpy(mbcsLongPath, mbcsShortPath, dwResult);
|
||||
}
|
||||
if (!dwResult)
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user