This commit is contained in:
Christoph Oelckers 2016-11-15 11:25:42 +01:00
commit 196986ae6b
25 changed files with 1373 additions and 970 deletions

View file

@ -86,6 +86,8 @@
#include "textures/bitmap.h"
#include "textures/textures.h"
#include "optwin32.h"
// MACROS ------------------------------------------------------------------
#ifdef _MSC_VER
@ -1716,20 +1718,19 @@ unsigned int I_MakeRNGSeed()
FString I_GetLongPathName(FString shortpath)
{
static TOptWin32Proc<DWORD (WINAPI*)(LPCTSTR, LPTSTR, DWORD)>
GetLongPathNameA("kernel32.dll", "GetLongPathNameA");
using OptWin32::GetLongPathNameA;
// Doesn't exist on NT4
if (GetLongPathName == NULL)
if (!GetLongPathName)
return shortpath;
DWORD buffsize = GetLongPathNameA.Call(shortpath.GetChars(), NULL, 0);
DWORD buffsize = GetLongPathNameA(shortpath.GetChars(), NULL, 0);
if (buffsize == 0)
{ // nothing to change (it doesn't exist, maybe?)
return shortpath;
}
TCHAR *buff = new TCHAR[buffsize];
DWORD buffsize2 = GetLongPathNameA.Call(shortpath.GetChars(), buff, buffsize);
DWORD buffsize2 = GetLongPathNameA(shortpath.GetChars(), buff, buffsize);
if (buffsize2 >= buffsize)
{ // Failure! Just return the short path
delete[] buff;