mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 07:56:59 +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 LoadSegment;
|
||||||
WORD MaxAllocSize;
|
WORD MaxAllocSize;
|
||||||
DWORD i, FileSize;
|
DWORD i, FileSize;
|
||||||
|
CHAR FullPath[MAX_PATH];
|
||||||
|
CHAR ShortFullPath[MAX_PATH];
|
||||||
|
|
||||||
/* Buffer for command line conversion: 1 byte for size; 127 bytes for contents */
|
/* Buffer for command line conversion: 1 byte for size; 127 bytes for contents */
|
||||||
CHAR CmdLineBuffer[1 + DOS_CMDLINE_LENGTH];
|
CHAR CmdLineBuffer[1 + DOS_CMDLINE_LENGTH];
|
||||||
|
@ -265,6 +267,17 @@ DWORD DosLoadExecutable(IN DOS_EXEC_TYPE LoadType,
|
||||||
Parameters,
|
Parameters,
|
||||||
ReturnAddress);
|
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 */
|
/* Open a handle to the executable */
|
||||||
FileHandle = CreateFileA(ExecutablePath,
|
FileHandle = CreateFileA(ExecutablePath,
|
||||||
GENERIC_READ,
|
GENERIC_READ,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue