mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
fix some more kernel32_module winetests
svn path=/trunk/; revision=36184
This commit is contained in:
parent
517a8ef2b2
commit
f370c11356
1 changed files with 16 additions and 0 deletions
|
@ -38,6 +38,7 @@ GetDllLoadPath(LPCWSTR lpModule)
|
|||
PWCHAR EnvironmentBufferW = NULL;
|
||||
LPCWSTR lpModuleEnd = NULL;
|
||||
UNICODE_STRING ModuleName;
|
||||
DWORD LastError = GetLastError(); /* GetEnvironmentVariable changes LastError */
|
||||
|
||||
if (lpModule != NULL)
|
||||
{
|
||||
|
@ -89,6 +90,7 @@ GetDllLoadPath(LPCWSTR lpModule)
|
|||
Pos += GetEnvironmentVariableW(L"PATH", EnvironmentBufferW + Pos, Length - Pos);
|
||||
EnvironmentBufferW[Pos] = 0;
|
||||
|
||||
SetLastError(LastError);
|
||||
return EnvironmentBufferW;
|
||||
}
|
||||
|
||||
|
@ -175,6 +177,7 @@ LoadLibraryExW (
|
|||
NTSTATUS Status;
|
||||
PWSTR SearchPath;
|
||||
ULONG DllCharacteristics;
|
||||
BOOL FreeString = FALSE;
|
||||
|
||||
(void)hFile;
|
||||
|
||||
|
@ -197,6 +200,17 @@ LoadLibraryExW (
|
|||
dwFlags & LOAD_WITH_ALTERED_SEARCH_PATH ? lpLibFileName : NULL);
|
||||
|
||||
RtlInitUnicodeString(&DllName, (LPWSTR)lpLibFileName);
|
||||
if (DllName.Buffer[DllName.Length/sizeof(WCHAR) - 1] == L' ')
|
||||
{
|
||||
RtlCreateUnicodeString(&DllName, (LPWSTR)lpLibFileName);
|
||||
while (DllName.Length > sizeof(WCHAR) &&
|
||||
DllName.Buffer[DllName.Length/sizeof(WCHAR) - 1] == L' ')
|
||||
{
|
||||
DllName.Length -= sizeof(WCHAR);
|
||||
}
|
||||
DllName.Buffer[DllName.Length/sizeof(WCHAR)] = UNICODE_NULL;
|
||||
FreeString = TRUE;
|
||||
}
|
||||
if (InWindows)
|
||||
{
|
||||
/* Call the API Properly */
|
||||
|
@ -211,6 +225,8 @@ LoadLibraryExW (
|
|||
Status = LdrLoadDll(SearchPath, &dwFlags, &DllName, (PVOID*)&hInst);
|
||||
}
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, SearchPath);
|
||||
if (FreeString)
|
||||
RtlFreeUnicodeString(&DllName);
|
||||
if ( !NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus (Status);
|
||||
|
|
Loading…
Reference in a new issue