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
d68a0e65
Commit
d68a0e65
authored
Nov 18, 2023
by
Eric Pouech
Committed by
Alexandre Julliard
Feb 06, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Test DUPLICATE_SAME_ATTRIBUTES flag in DuplicateHandle().
Signed-off-by:
Eric Pouech
<
epouech@codeweavers.com
>
parent
da9210e0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
process.c
dlls/kernel32/tests/process.c
+44
-0
winnt.h
include/winnt.h
+1
-0
No files found.
dlls/kernel32/tests/process.c
View file @
d68a0e65
...
...
@@ -2549,6 +2549,50 @@ static void test_DuplicateHandle(void)
ok
(
r
,
"DuplicateHandle error %lu
\n
"
,
GetLastError
());
ok
(
f
==
out
||
broken
(
/* Win7 */
(((
ULONG_PTR
)
f
&
3
)
==
3
)
&&
(
f
!=
out
)),
"f != out
\n
"
);
CloseHandle
(
out
);
/* Test DUPLICATE_SAME_ATTRIBUTES */
f
=
CreateFileA
(
"NUL"
,
GENERIC_READ
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
ok
(
f
!=
INVALID_HANDLE_VALUE
,
"Failed to open NUL %lu
\n
"
,
GetLastError
());
r
=
GetHandleInformation
(
f
,
&
info
);
ok
(
r
&&
info
==
0
,
"Unexpected info %lx
\n
"
,
info
);
r
=
DuplicateHandle
(
GetCurrentProcess
(),
f
,
GetCurrentProcess
(),
&
out
,
0
,
TRUE
,
DUPLICATE_SAME_ACCESS
|
DUPLICATE_SAME_ATTRIBUTES
);
ok
(
r
,
"DuplicateHandle error %lu
\n
"
,
GetLastError
());
r
=
GetHandleInformation
(
out
,
&
info
);
todo_wine
ok
(
r
&&
info
==
0
,
"Unexpected info %lx
\n
"
,
info
);
CloseHandle
(
out
);
r
=
SetHandleInformation
(
f
,
HANDLE_FLAG_INHERIT
|
HANDLE_FLAG_PROTECT_FROM_CLOSE
,
HANDLE_FLAG_INHERIT
|
HANDLE_FLAG_PROTECT_FROM_CLOSE
);
ok
(
r
,
"SetHandleInformation error %lu
\n
"
,
GetLastError
());
info
=
0xdeabeef
;
r
=
GetHandleInformation
(
f
,
&
info
);
ok
(
r
&&
info
==
(
HANDLE_FLAG_INHERIT
|
HANDLE_FLAG_PROTECT_FROM_CLOSE
),
"Unexpected info %lx
\n
"
,
info
);
ok
(
r
,
"SetHandleInformation error %lu
\n
"
,
GetLastError
());
r
=
DuplicateHandle
(
GetCurrentProcess
(),
f
,
GetCurrentProcess
(),
&
out
,
0
,
FALSE
,
DUPLICATE_SAME_ACCESS
|
DUPLICATE_SAME_ATTRIBUTES
);
ok
(
r
,
"DuplicateHandle error %lu
\n
"
,
GetLastError
());
info
=
0xdeabeef
;
r
=
GetHandleInformation
(
out
,
&
info
);
todo_wine
ok
(
r
&&
info
==
(
HANDLE_FLAG_INHERIT
|
HANDLE_FLAG_PROTECT_FROM_CLOSE
),
"Unexpected info %lx
\n
"
,
info
);
r
=
SetHandleInformation
(
out
,
HANDLE_FLAG_PROTECT_FROM_CLOSE
,
0
);
ok
(
r
,
"SetHandleInformation error %lu
\n
"
,
GetLastError
());
CloseHandle
(
out
);
r
=
SetHandleInformation
(
f
,
HANDLE_FLAG_INHERIT
|
HANDLE_FLAG_PROTECT_FROM_CLOSE
,
0
);
ok
(
r
,
"SetHandleInformation error %lu
\n
"
,
GetLastError
());
CloseHandle
(
f
);
r
=
DuplicateHandle
(
GetCurrentProcess
(),
GetCurrentProcess
(),
GetCurrentProcess
(),
&
out
,
0
,
TRUE
,
DUPLICATE_SAME_ACCESS
|
DUPLICATE_SAME_ATTRIBUTES
);
ok
(
r
,
"DuplicateHandle error %lu
\n
"
,
GetLastError
());
info
=
0xdeabeef
;
r
=
GetHandleInformation
(
out
,
&
info
);
todo_wine
ok
(
r
&&
info
==
0
,
"Unexpected info %lx
\n
"
,
info
);
CloseHandle
(
out
);
}
#define test_completion(a, b, c, d, e) _test_completion(__LINE__, a, b, c, d, e)
...
...
include/winnt.h
View file @
d68a0e65
...
...
@@ -5367,6 +5367,7 @@ typedef struct _QUOTA_LIMITS_EX {
#define DUPLICATE_CLOSE_SOURCE 0x00000001
#define DUPLICATE_SAME_ACCESS 0x00000002
#define DUPLICATE_SAME_ATTRIBUTES 0x00000004
#ifdef __WINESRC__
#define DUPLICATE_MAKE_GLOBAL 0x80000000
/* Not a Windows flag */
#endif
...
...
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