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
19e96b56
Commit
19e96b56
authored
Apr 29, 2018
by
Daniel Lehman
Committed by
Alexandre Julliard
May 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32/tests: Add tests for REG_NOTIFY_THREAD_AGNOSTIC.
Signed-off-by:
Daniel Lehman
<
dlehman@esri.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3849270a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
0 deletions
+82
-0
registry.c
dlls/advapi32/tests/registry.c
+81
-0
winnt.h
include/winnt.h
+1
-0
No files found.
dlls/advapi32/tests/registry.c
View file @
19e96b56
...
@@ -3464,9 +3464,28 @@ static void test_RegOpenCurrentUser(void)
...
@@ -3464,9 +3464,28 @@ static void test_RegOpenCurrentUser(void)
RegCloseKey
(
key
);
RegCloseKey
(
key
);
}
}
struct
notify_data
{
HKEY
key
;
DWORD
flags
;
HANDLE
event
;
};
static
DWORD
WINAPI
notify_change_thread
(
void
*
arg
)
{
struct
notify_data
*
data
=
arg
;
LONG
ret
;
ret
=
RegNotifyChangeKeyValue
(
data
->
key
,
TRUE
,
REG_NOTIFY_CHANGE_NAME
|
data
->
flags
,
data
->
event
,
TRUE
);
ok
(
ret
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
return
0
;
}
static
void
test_RegNotifyChangeKeyValue
(
void
)
static
void
test_RegNotifyChangeKeyValue
(
void
)
{
{
struct
notify_data
data
;
HKEY
key
,
subkey
;
HKEY
key
,
subkey
;
HANDLE
thread
;
HANDLE
event
;
HANDLE
event
;
DWORD
dwret
;
DWORD
dwret
;
LONG
ret
;
LONG
ret
;
...
@@ -3486,6 +3505,68 @@ static void test_RegNotifyChangeKeyValue(void)
...
@@ -3486,6 +3505,68 @@ static void test_RegNotifyChangeKeyValue(void)
dwret
=
WaitForSingleObject
(
event
,
0
);
dwret
=
WaitForSingleObject
(
event
,
0
);
ok
(
dwret
==
WAIT_OBJECT_0
,
"expected WAIT_OBJECT_0, got %u
\n
"
,
dwret
);
ok
(
dwret
==
WAIT_OBJECT_0
,
"expected WAIT_OBJECT_0, got %u
\n
"
,
dwret
);
RegDeleteKeyA
(
key
,
"SubKey"
);
RegCloseKey
(
key
);
/* test same thread with REG_NOTIFY_THREAD_AGNOSTIC */
ret
=
RegOpenKeyA
(
hkey_main
,
"TestKey"
,
&
key
);
ok
(
ret
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
ret
=
RegNotifyChangeKeyValue
(
key
,
TRUE
,
REG_NOTIFY_CHANGE_NAME
|
REG_NOTIFY_THREAD_AGNOSTIC
,
event
,
TRUE
);
if
(
ret
==
ERROR_INVALID_PARAMETER
)
{
win_skip
(
"REG_NOTIFY_THREAD_AGNOSTIC is not supported
\n
"
);
RegCloseKey
(
key
);
CloseHandle
(
event
);
return
;
}
ret
=
RegCreateKeyA
(
key
,
"SubKey"
,
&
subkey
);
ok
(
ret
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
dwret
=
WaitForSingleObject
(
event
,
0
);
ok
(
dwret
==
WAIT_OBJECT_0
,
"expected WAIT_OBJECT_0, got %u
\n
"
,
dwret
);
RegDeleteKeyA
(
key
,
"SubKey"
);
RegCloseKey
(
key
);
/* test different thread without REG_NOTIFY_THREAD_AGNOSTIC */
ret
=
RegOpenKeyA
(
hkey_main
,
"TestKey"
,
&
key
);
ok
(
ret
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
data
.
key
=
key
;
data
.
flags
=
0
;
data
.
event
=
event
;
thread
=
CreateThread
(
NULL
,
0
,
notify_change_thread
,
&
data
,
0
,
NULL
);
WaitForSingleObject
(
thread
,
INFINITE
);
CloseHandle
(
thread
);
/* the thread exiting causes event to signal on Windows
this is worked around on Windows using REG_NOTIFY_THREAD_AGNOSTIC
Wine already behaves as if the flag is set */
dwret
=
WaitForSingleObject
(
event
,
0
);
todo_wine
ok
(
dwret
==
WAIT_OBJECT_0
,
"expected WAIT_OBJECT_0, got %u
\n
"
,
dwret
);
RegCloseKey
(
key
);
/* test different thread with REG_NOTIFY_THREAD_AGNOSTIC */
ret
=
RegOpenKeyA
(
hkey_main
,
"TestKey"
,
&
key
);
ok
(
ret
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
data
.
flags
=
REG_NOTIFY_THREAD_AGNOSTIC
;
thread
=
CreateThread
(
NULL
,
0
,
notify_change_thread
,
&
data
,
0
,
NULL
);
WaitForSingleObject
(
thread
,
INFINITE
);
CloseHandle
(
thread
);
dwret
=
WaitForSingleObject
(
event
,
0
);
ok
(
dwret
==
WAIT_TIMEOUT
,
"expected WAIT_TIMEOUT, got %u
\n
"
,
dwret
);
ret
=
RegCreateKeyA
(
key
,
"SubKey"
,
&
subkey
);
ok
(
ret
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
dwret
=
WaitForSingleObject
(
event
,
0
);
ok
(
dwret
==
WAIT_OBJECT_0
,
"expected WAIT_OBJECT_0, got %u
\n
"
,
dwret
);
RegDeleteKeyA
(
key
,
"SubKey"
);
RegDeleteKeyA
(
key
,
""
);
RegDeleteKeyA
(
key
,
""
);
RegCloseKey
(
key
);
RegCloseKey
(
key
);
CloseHandle
(
event
);
CloseHandle
(
event
);
...
...
include/winnt.h
View file @
19e96b56
...
@@ -5368,6 +5368,7 @@ typedef struct _TAPE_GET_MEDIA_PARAMETERS {
...
@@ -5368,6 +5368,7 @@ typedef struct _TAPE_GET_MEDIA_PARAMETERS {
#define REG_NOTIFY_CHANGE_ATTRIBUTES 0x02
#define REG_NOTIFY_CHANGE_ATTRIBUTES 0x02
#define REG_NOTIFY_CHANGE_LAST_SET 0x04
#define REG_NOTIFY_CHANGE_LAST_SET 0x04
#define REG_NOTIFY_CHANGE_SECURITY 0x08
#define REG_NOTIFY_CHANGE_SECURITY 0x08
#define REG_NOTIFY_THREAD_AGNOSTIC 0x10000000
#define KEY_QUERY_VALUE 0x00000001
#define KEY_QUERY_VALUE 0x00000001
#define KEY_SET_VALUE 0x00000002
#define KEY_SET_VALUE 0x00000002
...
...
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