mirror of
https://github.com/reactos/reactos.git
synced 2024-08-04 10:30:59 +00:00
fix some kernel32 module winetests (GetProcAddress, GetModuleFileName)
svn path=/trunk/; revision=36178
This commit is contained in:
parent
beb218924d
commit
f6c0c19edb
|
@ -230,24 +230,31 @@ GetProcAddress( HMODULE hModule, LPCSTR lpProcName )
|
||||||
{
|
{
|
||||||
ANSI_STRING ProcedureName;
|
ANSI_STRING ProcedureName;
|
||||||
FARPROC fnExp = NULL;
|
FARPROC fnExp = NULL;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
if (HIWORD(lpProcName) != 0)
|
if (HIWORD(lpProcName) != 0)
|
||||||
{
|
{
|
||||||
RtlInitAnsiString (&ProcedureName,
|
RtlInitAnsiString (&ProcedureName,
|
||||||
(LPSTR)lpProcName);
|
(LPSTR)lpProcName);
|
||||||
LdrGetProcedureAddress ((PVOID)hModule,
|
Status = LdrGetProcedureAddress ((PVOID)hModule,
|
||||||
&ProcedureName,
|
&ProcedureName,
|
||||||
0,
|
0,
|
||||||
(PVOID*)&fnExp);
|
(PVOID*)&fnExp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LdrGetProcedureAddress ((PVOID)hModule,
|
Status = LdrGetProcedureAddress ((PVOID)hModule,
|
||||||
NULL,
|
NULL,
|
||||||
(ULONG)lpProcName,
|
(ULONG)lpProcName,
|
||||||
(PVOID*)&fnExp);
|
(PVOID*)&fnExp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastError( RtlNtStatusToDosError( Status ) );
|
||||||
|
fnExp = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return fnExp;
|
return fnExp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,27 +320,25 @@ GetModuleFileNameA (
|
||||||
Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
|
Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
|
||||||
if (Module->DllBase == (PVOID)hModule)
|
if (Module->DllBase == (PVOID)hModule)
|
||||||
{
|
{
|
||||||
if (nSize * sizeof(WCHAR) < Module->FullDllName.Length)
|
Length = min(nSize, Module->FullDllName.Length / sizeof(WCHAR));
|
||||||
{
|
FileName.Length = 0;
|
||||||
SetLastErrorByStatus (STATUS_BUFFER_TOO_SMALL);
|
FileName.MaximumLength = (USHORT)Length * sizeof(WCHAR);
|
||||||
}
|
FileName.Buffer = lpFilename;
|
||||||
else
|
|
||||||
{
|
|
||||||
FileName.Length = 0;
|
|
||||||
FileName.MaximumLength = (USHORT)nSize * sizeof(WCHAR);
|
|
||||||
FileName.Buffer = lpFilename;
|
|
||||||
|
|
||||||
/* convert unicode string to ansi (or oem) */
|
/* convert unicode string to ansi (or oem) */
|
||||||
if (bIsFileApiAnsi)
|
if (bIsFileApiAnsi)
|
||||||
RtlUnicodeStringToAnsiString (&FileName,
|
RtlUnicodeStringToAnsiString (&FileName,
|
||||||
&Module->FullDllName,
|
&Module->FullDllName,
|
||||||
FALSE);
|
FALSE);
|
||||||
else
|
else
|
||||||
RtlUnicodeStringToOemString (&FileName,
|
RtlUnicodeStringToOemString (&FileName,
|
||||||
&Module->FullDllName,
|
&Module->FullDllName,
|
||||||
FALSE);
|
FALSE);
|
||||||
Length = Module->FullDllName.Length / sizeof(WCHAR);
|
|
||||||
}
|
if (nSize < Length)
|
||||||
|
SetLastErrorByStatus (STATUS_BUFFER_TOO_SMALL);
|
||||||
|
else
|
||||||
|
lpFilename[Length] = '\0';
|
||||||
|
|
||||||
RtlLeaveCriticalSection (Peb->LoaderLock);
|
RtlLeaveCriticalSection (Peb->LoaderLock);
|
||||||
return Length;
|
return Length;
|
||||||
|
@ -381,22 +386,20 @@ GetModuleFileNameW (
|
||||||
|
|
||||||
if (Module->DllBase == (PVOID)hModule)
|
if (Module->DllBase == (PVOID)hModule)
|
||||||
{
|
{
|
||||||
if (nSize * sizeof(WCHAR) < Module->FullDllName.Length)
|
Length = min(nSize, Module->FullDllName.Length / sizeof(WCHAR));
|
||||||
{
|
FileName.Length = 0;
|
||||||
SetLastErrorByStatus (STATUS_BUFFER_TOO_SMALL);
|
FileName.MaximumLength = (USHORT) Length * sizeof(WCHAR);
|
||||||
}
|
FileName.Buffer = lpFilename;
|
||||||
else
|
|
||||||
{
|
|
||||||
FileName.Length = 0;
|
|
||||||
FileName.MaximumLength =(USHORT)nSize * sizeof(WCHAR);
|
|
||||||
FileName.Buffer = lpFilename;
|
|
||||||
|
|
||||||
RtlCopyUnicodeString (&FileName,
|
RtlCopyUnicodeString (&FileName,
|
||||||
&Module->FullDllName);
|
&Module->FullDllName);
|
||||||
Length = Module->FullDllName.Length / sizeof(WCHAR);
|
if (nSize < Length)
|
||||||
}
|
SetLastErrorByStatus (STATUS_BUFFER_TOO_SMALL);
|
||||||
|
else
|
||||||
|
lpFilename[Length] = L'\0';
|
||||||
|
|
||||||
RtlLeaveCriticalSection (Peb->LoaderLock);
|
RtlLeaveCriticalSection (Peb->LoaderLock);
|
||||||
|
|
||||||
return Length;
|
return Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue