Try to find the shortened full path in DosLoadExecutable, and use that whenever
possible.


svn path=/trunk/; revision=67580
This commit is contained in:
Aleksandar Andrejevic 2015-05-06 21:56:15 +00:00
parent 41044145e2
commit 17047d0b62

View file

@ -255,6 +255,8 @@ DWORD DosLoadExecutable(IN DOS_EXEC_TYPE LoadType,
WORD LoadSegment;
WORD MaxAllocSize;
DWORD i, FileSize;
CHAR FullPath[MAX_PATH];
CHAR ShortFullPath[MAX_PATH];
/* Buffer for command line conversion: 1 byte for size; 127 bytes for contents */
CHAR CmdLineBuffer[1 + DOS_CMDLINE_LENGTH];
@ -265,6 +267,17 @@ DWORD DosLoadExecutable(IN DOS_EXEC_TYPE LoadType,
Parameters,
ReturnAddress);
/* Try to get the full path to the executable */
if (GetFullPathNameA(ExecutablePath, sizeof(FullPath), FullPath, NULL))
{
/* Try to shorten the full path */
if (GetShortPathNameA(FullPath, ShortFullPath, sizeof(ShortFullPath)))
{
/* Use the shortened full path from now on */
ExecutablePath = ShortFullPath;
}
}
/* Open a handle to the executable */
FileHandle = CreateFileA(ExecutablePath,
GENERIC_READ,