mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 11:43:31 +00:00
kernel32: Reset LastError if GetModuleFileName() succeeds.
This commit is contained in:
parent
8abe262fd2
commit
8e67930bd7
2 changed files with 11 additions and 0 deletions
|
@ -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 a new issue