mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 00:45:24 +00:00
[NTVDM]
Try to find the shortened full path in DosLoadExecutable, and use that whenever possible. svn path=/trunk/; revision=67580
This commit is contained in:
parent
41044145e2
commit
17047d0b62
1 changed files with 13 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue