Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
8e67930b
Commit
8e67930b
authored
Oct 03, 2011
by
Francois Gouget
Committed by
Alexandre Julliard
Oct 03, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Reset LastError if GetModuleFileName() succeeds.
parent
8abe262f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
module.c
dlls/kernel32/module.c
+3
-0
module.c
dlls/kernel32/tests/module.c
+8
-0
No files found.
dlls/kernel32/module.c
View file @
8e67930b
...
...
@@ -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
);
}
...
...
dlls/kernel32/tests/module.c
View file @
8e67930b
...
...
@@ -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
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment