Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
2a98f9b0
Commit
2a98f9b0
authored
Jun 18, 2008
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jun 18, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Make GetModuleFileName set ERROR_INSUFFICIENT_BUFFER like win2k3 and vista do.
parent
bbd8ae43
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
+16
-11
module.c
dlls/kernel32/module.c
+8
-2
win.c
dlls/user32/tests/win.c
+8
-9
No files found.
dlls/kernel32/module.c
View file @
2a98f9b0
...
...
@@ -608,7 +608,10 @@ DWORD WINAPI GetModuleFileNameA(
if
((
len
=
GetModuleFileNameW
(
hModule
,
filenameW
,
size
)))
{
len
=
FILE_name_WtoA
(
filenameW
,
len
,
lpFileName
,
size
);
if
(
len
<
size
)
lpFileName
[
len
]
=
'\0'
;
if
(
len
<
size
)
lpFileName
[
len
]
=
'\0'
;
else
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
}
HeapFree
(
GetProcessHeap
(),
0
,
filenameW
);
return
len
;
...
...
@@ -642,7 +645,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'
;
if
(
len
<
size
)
lpFileName
[
len
]
=
'\0'
;
else
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
}
else
SetLastError
(
RtlNtStatusToDosError
(
nts
)
);
...
...
dlls/user32/tests/win.c
View file @
2a98f9b0
...
...
@@ -4657,33 +4657,32 @@ static void test_GetWindowModuleFileName(void)
hinst
=
GetModuleHandle
(
0
);
/* MSDN mentions ERROR_INSUFFICIENT_BUFFER, but XP doesn't do it */
SetLastError
(
0xdeadbeef
);
ret2
=
GetModuleFileName
(
hinst
,
buf2
,
ret1
-
2
);
ok
(
ret2
==
ret1
-
2
,
"expected %u, got %u
\n
"
,
ret1
-
2
,
ret2
);
ok
(
GetLastError
()
==
0xdeadbeef
||
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
/* win2k3 */
ok
(
GetLastError
()
==
0xdeadbeef
/* XP */
||
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
/* win2k3
, vista
*/
"expected 0xdeadbeef or ERROR_INSUFFICIENT_BUFFER, got %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret2
=
GetModuleFileName
(
hinst
,
buf2
,
0
);
ok
(
!
ret2
,
"GetModuleFileName should return 0
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
||
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
/* win2k3 */
ok
(
GetLastError
()
==
0xdeadbeef
/* XP */
||
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
/* win2k3
, vista
*/
"expected 0xdeadbeef or ERROR_INSUFFICIENT_BUFFER, got %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret2
=
pGetWindowModuleFileNameA
(
hwnd
,
buf2
,
ret1
-
2
);
ok
(
ret2
==
ret1
-
2
,
"expected %u, got %u
\n
"
,
ret1
-
2
,
ret2
);
ok
(
GetLastError
()
==
0xdeadbeef
||
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
/* win2k3 */
ok
(
GetLastError
()
==
0xdeadbeef
/* XP */
||
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
/* win2k3
, vista
*/
"expected 0xdeadbeef or ERROR_INSUFFICIENT_BUFFER, got %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret2
=
pGetWindowModuleFileNameA
(
hwnd
,
buf2
,
0
);
ok
(
!
ret2
,
"expected 0, got %u
\n
"
,
ret2
);
ok
(
GetLastError
()
==
0xdeadbeef
||
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
/* win2k3 */
ok
(
GetLastError
()
==
0xdeadbeef
/* XP */
||
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
/* win2k3
, vista
*/
"expected 0xdeadbeef or ERROR_INSUFFICIENT_BUFFER, got %u
\n
"
,
GetLastError
());
DestroyWindow
(
hwnd
);
...
...
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