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
ffb4d151
Commit
ffb4d151
authored
Sep 06, 2015
by
Bruno Jesus
Committed by
Alexandre Julliard
Sep 07, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi: Reject NULL key on SHRegCloseUSKey with tests.
parent
519ad57c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
0 deletions
+37
-0
reg.c
dlls/shlwapi/reg.c
+3
-0
shreg.c
dlls/shlwapi/tests/shreg.c
+34
-0
No files found.
dlls/shlwapi/reg.c
View file @
ffb4d151
...
...
@@ -193,6 +193,9 @@ LONG WINAPI SHRegCloseUSKey(
LPSHUSKEY
hKey
=
hUSKey
;
LONG
ret
=
ERROR_SUCCESS
;
if
(
!
hKey
)
return
ERROR_INVALID_PARAMETER
;
if
(
hKey
->
HKCUkey
)
ret
=
RegCloseKey
(
hKey
->
HKCUkey
);
if
(
hKey
->
HKCUstart
&&
hKey
->
HKCUstart
!=
HKEY_CURRENT_USER
)
...
...
dlls/shlwapi/tests/shreg.c
View file @
ffb4d151
...
...
@@ -38,6 +38,8 @@ static DWORD (WINAPI *pSHCopyKeyA)(HKEY,LPCSTR,HKEY,DWORD);
static
DWORD
(
WINAPI
*
pSHRegGetPathA
)(
HKEY
,
LPCSTR
,
LPCSTR
,
LPSTR
,
DWORD
);
static
LSTATUS
(
WINAPI
*
pSHRegGetValueA
)(
HKEY
,
LPCSTR
,
LPCSTR
,
SRRF
,
LPDWORD
,
LPVOID
,
LPDWORD
);
static
LSTATUS
(
WINAPI
*
pSHRegCreateUSKeyW
)(
LPCWSTR
,
REGSAM
,
HUSKEY
,
PHUSKEY
,
DWORD
);
static
LSTATUS
(
WINAPI
*
pSHRegOpenUSKeyW
)(
LPCWSTR
,
REGSAM
,
HUSKEY
,
PHUSKEY
,
BOOL
);
static
LSTATUS
(
WINAPI
*
pSHRegCloseUSKey
)(
HUSKEY
);
static
const
char
sTestpath1
[]
=
"%LONGSYSTEMVAR%
\\
subdir1"
;
static
const
char
sTestpath2
[]
=
"%FOO%
\\
subdir1"
;
...
...
@@ -458,6 +460,35 @@ static void test_SHRegCreateUSKeyW(void)
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"got %d
\n
"
,
ret
);
}
static
void
test_SHRegCloseUSKey
(
void
)
{
static
const
WCHAR
localW
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
0
};
LONG
ret
;
HUSKEY
key
;
if
(
!
pSHRegOpenUSKeyW
||
!
pSHRegCloseUSKey
)
{
win_skip
(
"SHRegOpenUSKeyW or SHRegCloseUSKey not available
\n
"
);
return
;
}
ret
=
pSHRegCloseUSKey
(
NULL
);
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"got %d
\n
"
,
ret
);
ret
=
pSHRegOpenUSKeyW
(
localW
,
KEY_ALL_ACCESS
,
NULL
,
&
key
,
FALSE
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %d
\n
"
,
ret
);
ret
=
pSHRegCloseUSKey
(
key
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %d
\n
"
,
ret
);
/* Test with limited rights, specially without KEY_SET_VALUE */
ret
=
pSHRegOpenUSKeyW
(
localW
,
KEY_QUERY_VALUE
,
NULL
,
&
key
,
FALSE
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %d
\n
"
,
ret
);
ret
=
pSHRegCloseUSKey
(
key
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %d
\n
"
,
ret
);
}
START_TEST
(
shreg
)
{
HKEY
hkey
=
create_test_entries
();
...
...
@@ -476,6 +507,8 @@ START_TEST(shreg)
pSHRegGetPathA
=
(
void
*
)
GetProcAddress
(
hshlwapi
,
"SHRegGetPathA"
);
pSHRegGetValueA
=
(
void
*
)
GetProcAddress
(
hshlwapi
,
"SHRegGetValueA"
);
pSHRegCreateUSKeyW
=
(
void
*
)
GetProcAddress
(
hshlwapi
,
"SHRegCreateUSKeyW"
);
pSHRegOpenUSKeyW
=
(
void
*
)
GetProcAddress
(
hshlwapi
,
"SHRegOpenUSKeyW"
);
pSHRegCloseUSKey
=
(
void
*
)
GetProcAddress
(
hshlwapi
,
"SHRegCloseUSKey"
);
test_SHGetValue
();
test_SHRegGetValue
();
...
...
@@ -484,6 +517,7 @@ START_TEST(shreg)
test_SHCopyKey
();
test_SHDeleteKey
();
test_SHRegCreateUSKeyW
();
test_SHRegCloseUSKey
();
delete_key
(
hkey
,
"Software
\\
Wine"
,
"Test"
);
}
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