From 279183baba37d71491aaa9f7641d86583e3f5587 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Sun, 20 May 2012 14:06:09 +0000 Subject: [PATCH] [KERNEL32] - Swap GetFullPathName success/failure cases in BasePushProcessParameters. Fixes kernel32:GetModuleFileName test. See issue #6786 for more details. svn path=/trunk/; revision=56643 --- reactos/dll/win32/kernel32/client/path.c | 2 +- reactos/dll/win32/kernel32/client/proc.c | 32 ++++++++++++------------ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/reactos/dll/win32/kernel32/client/path.c b/reactos/dll/win32/kernel32/client/path.c index c22dcd80eaf..48224db7a3a 100644 --- a/reactos/dll/win32/kernel32/client/path.c +++ b/reactos/dll/win32/kernel32/client/path.c @@ -307,7 +307,7 @@ BasepComputeProcessPath(IN PBASE_SEARCH_PATH_TYPE PathOrder, } break; - /* Add the current applicaiton path */ + /* Add the current application path */ case BaseSearchPathApp: if ((AppName) && (AppNameEnd)) { diff --git a/reactos/dll/win32/kernel32/client/proc.c b/reactos/dll/win32/kernel32/client/proc.c index 5ef7eddbd83..3975f8169a3 100644 --- a/reactos/dll/win32/kernel32/client/proc.c +++ b/reactos/dll/win32/kernel32/client/proc.c @@ -778,6 +778,21 @@ BasePushProcessParameters(IN ULONG ParameterFlags, if ((Size) && (Size <= (MAX_PATH + 4))) { /* Get the DLL Path */ + DllPathString = BaseComputeProcessDllPath(FullPath, lpEnvironment); + if (!DllPathString) + { + /* Fail */ + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + /* Initialize Strings */ + RtlInitUnicodeString(&DllPath, DllPathString); + RtlInitUnicodeString(&ImageName, FullPath); + } + else + { + /* Couldn't get the path name. Just take the original path */ DllPathString = BaseComputeProcessDllPath((LPWSTR)ApplicationPathName, lpEnvironment); if (!DllPathString) @@ -791,21 +806,6 @@ BasePushProcessParameters(IN ULONG ParameterFlags, RtlInitUnicodeString(&DllPath, DllPathString); RtlInitUnicodeString(&ImageName, ApplicationPathName); } - else - { - /* Get the DLL Path */ - DllPathString = BaseComputeProcessDllPath(FullPath, lpEnvironment); - if (!DllPathString) - { - /* Fail */ - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - - /* Initialize Strings */ - RtlInitUnicodeString(&DllPath, DllPathString); - RtlInitUnicodeString(&ImageName, FullPath); - } /* Initialize Strings */ RtlInitUnicodeString(&CommandLine, lpCommandLine); @@ -1656,7 +1656,7 @@ GetStartupInfoA(IN LPSTARTUPINFOA lpStartupInfo) /* Someone beat us to it, use their data instead */ StartupInfo = BaseAnsiStartupInfo; Status = STATUS_SUCCESS; - + /* We're going to free our own stuff, but not raise */ RtlFreeAnsiString(&TitleString); }