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
1c6ea02f
Commit
1c6ea02f
authored
Mar 02, 2011
by
Hans Leidekker
Committed by
Alexandre Julliard
Mar 02, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userenv: GetProfilesDirectoryW accepts a NULL buffer.
parent
837fc836
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
userenv.c
dlls/userenv/tests/userenv.c
+17
-0
userenv_main.c
dlls/userenv/userenv_main.c
+2
-2
No files found.
dlls/userenv/tests/userenv.c
View file @
1c6ea02f
...
...
@@ -264,6 +264,23 @@ static void test_get_profiles_dir(void)
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
HeapFree
(
GetProcessHeap
(),
0
,
profiles_dir
);
SetLastError
(
0xdeadbeef
);
r
=
GetProfilesDirectoryW
(
NULL
,
NULL
);
expect
(
FALSE
,
r
);
expect_gle
(
ERROR_INVALID_PARAMETER
);
cch
=
0
;
SetLastError
(
0xdeadbeef
);
r
=
GetProfilesDirectoryW
(
NULL
,
&
cch
);
expect
(
FALSE
,
r
);
expect_gle
(
ERROR_INSUFFICIENT_BUFFER
);
ok
(
cch
,
"expected cch > 0
\n
"
);
SetLastError
(
0xdeadbeef
);
r
=
GetProfilesDirectoryW
(
NULL
,
&
cch
);
expect
(
FALSE
,
r
);
expect_gle
(
ERROR_INSUFFICIENT_BUFFER
);
}
START_TEST
(
userenv
)
...
...
dlls/userenv/userenv_main.c
View file @
1c6ea02f
...
...
@@ -201,7 +201,7 @@ BOOL WINAPI GetProfilesDirectoryW( LPWSTR lpProfilesDir, LPDWORD lpcchSize )
TRACE
(
"%p %p
\n
"
,
lpProfilesDir
,
lpcchSize
);
if
(
!
lp
ProfilesDir
||
!
lp
cchSize
)
if
(
!
lpcchSize
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
...
...
@@ -234,7 +234,7 @@ BOOL WINAPI GetProfilesDirectoryW( LPWSTR lpProfilesDir, LPDWORD lpcchSize )
}
expanded_len
=
ExpandEnvironmentStringsW
(
unexpanded_profiles_dir
,
NULL
,
0
);
/* The returned length doesn't include the NULL terminator. */
if
(
*
lpcchSize
<
expanded_len
-
1
)
if
(
*
lpcchSize
<
expanded_len
-
1
||
!
lpProfilesDir
)
{
*
lpcchSize
=
expanded_len
-
1
;
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
...
...
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