mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 06:30:37 +00:00
kernel32: Reset LastError if GetModuleFileName() succeeds.
This commit is contained in:
parent
8abe262fd2
commit
8e67930bd7
@ -648,7 +648,10 @@ DWORD WINAPI GetModuleFileNameW( HMODULE hModule, LPWSTR lpFileName, DWORD size
|
||||
len = min(size, pldr->FullDllName.Length / sizeof(WCHAR));
|
||||
memcpy(lpFileName, pldr->FullDllName.Buffer, len * sizeof(WCHAR));
|
||||
if (len < size)
|
||||
{
|
||||
lpFileName[len] = '\0';
|
||||
SetLastError( 0 );
|
||||
}
|
||||
else
|
||||
SetLastError( ERROR_INSUFFICIENT_BUFFER );
|
||||
}
|
||||
|
@ -44,13 +44,21 @@ static void testGetModuleFileName(const char* name)
|
||||
|
||||
/* first test, with enough space in buffer */
|
||||
memset(bufA, '-', sizeof(bufA));
|
||||
SetLastError(0xdeadbeef);
|
||||
len1A = GetModuleFileNameA(hMod, bufA, sizeof(bufA));
|
||||
ok(GetLastError() == ERROR_SUCCESS ||
|
||||
broken(GetLastError() == 0xdeadbeef), /* <= XP SP3 */
|
||||
"LastError was not reset: %u\n", GetLastError());
|
||||
ok(len1A > 0, "Getting module filename for handle %p\n", hMod);
|
||||
|
||||
if (is_unicode_enabled)
|
||||
{
|
||||
memset(bufW, '-', sizeof(bufW));
|
||||
SetLastError(0xdeadbeef);
|
||||
len1W = GetModuleFileNameW(hMod, bufW, sizeof(bufW) / sizeof(WCHAR));
|
||||
ok(GetLastError() == ERROR_SUCCESS ||
|
||||
broken(GetLastError() == 0xdeadbeef), /* <= XP SP3 */
|
||||
"LastError was not reset: %u\n", GetLastError());
|
||||
ok(len1W > 0, "Getting module filename for handle %p\n", hMod);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user