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
0f5d042f
Commit
0f5d042f
authored
Feb 10, 2010
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Feb 10, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Don't use HIWORD to check for swapped args in GetCurrentDirectoryA.
parent
ef7cafc1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
path.c
dlls/kernel32/path.c
+2
-2
path.c
dlls/kernel32/tests/path.c
+10
-0
No files found.
dlls/kernel32/path.c
View file @
0f5d042f
...
...
@@ -1400,13 +1400,13 @@ UINT WINAPI GetCurrentDirectoryA( UINT buflen, LPSTR buf )
WCHAR
bufferW
[
MAX_PATH
];
DWORD
ret
;
if
(
buflen
&&
buf
&&
!
HIWORD
(
buf
)
)
if
(
buflen
&&
buf
&&
((
ULONG_PTR
)
buf
>>
16
)
==
0
)
{
/* Win9x catches access violations here, returning zero.
* This behaviour resulted in some people not noticing
* that they got the argument order wrong. So let's be
* nice and fail gracefully if buf is invalid and looks
* more like a buflen
(which is probably MAX_PATH)
. */
* more like a buflen. */
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
...
...
dlls/kernel32/tests/path.c
View file @
0f5d042f
...
...
@@ -467,6 +467,16 @@ static void test_CurrentDirectoryA(CHAR *origdir, CHAR *newdir)
if
(
len
)
ok
(
!
strcmp
(
buffer
,
origdir
),
"wrong result %s
\n
"
,
buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
/* Check for crash prevention on swapped args. Crashes all but Win9x.
*/
if
(
0
)
{
SetLastError
(
0xdeadbeef
);
len
=
GetCurrentDirectoryA
(
42
,
(
LPSTR
)(
MAX_PATH
+
42
)
);
ok
(
len
==
0
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"GetCurrentDirectoryA failed to fail %u err %u
\n
"
,
len
,
GetLastError
()
);
}
/* SetCurrentDirectoryA shouldn't care whether the string has a
trailing '\\' or not
*/
...
...
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