Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
16832064
Commit
16832064
authored
Sep 22, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Add a test for PROC_THREAD_ATTRIBUTE_HANDLE_LIST.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
bce9cdcc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
5 deletions
+69
-5
process.c
dlls/kernel32/tests/process.c
+69
-5
No files found.
dlls/kernel32/tests/process.c
View file @
16832064
...
@@ -3900,7 +3900,7 @@ static void test_ProcThreadAttributeList(void)
...
@@ -3900,7 +3900,7 @@ static void test_ProcThreadAttributeList(void)
* level 2: Process created by level 1 process with handle inheritance and level 0
* level 2: Process created by level 1 process with handle inheritance and level 0
* process parent substitute.
* process parent substitute.
* level 255: Process created by level 1 process during invalid parent handles testing. */
* level 255: Process created by level 1 process during invalid parent handles testing. */
void
test_parent_process_attribute
(
unsigned
int
level
,
HANDLE
read_pipe
)
static
void
test_parent_process_attribute
(
unsigned
int
level
,
HANDLE
read_pipe
)
{
{
PROCESS_BASIC_INFORMATION
pbi
;
PROCESS_BASIC_INFORMATION
pbi
;
char
buffer
[
MAX_PATH
+
64
];
char
buffer
[
MAX_PATH
+
64
];
...
@@ -4081,10 +4081,68 @@ void test_parent_process_attribute(unsigned int level, HANDLE read_pipe)
...
@@ -4081,10 +4081,68 @@ void test_parent_process_attribute(unsigned int level, HANDLE read_pipe)
}
}
}
}
static
void
test_handle_list_attribute
(
BOOL
child
,
HANDLE
handle1
,
HANDLE
handle2
)
{
char
buffer
[
MAX_PATH
+
64
];
HANDLE
pipe
[
2
];
PROCESS_INFORMATION
info
;
STARTUPINFOEXA
si
;
SIZE_T
size
;
BOOL
ret
;
SECURITY_ATTRIBUTES
sa
;
if
(
child
)
{
DWORD
flags
;
flags
=
0
;
ret
=
GetHandleInformation
(
handle1
,
&
flags
);
ok
(
ret
,
"Failed to get handle info, error %d.
\n
"
,
GetLastError
());
ok
(
flags
==
HANDLE_FLAG_INHERIT
,
"Unexpected flags %#x.
\n
"
,
flags
);
CloseHandle
(
handle1
);
ret
=
GetHandleInformation
(
handle2
,
&
flags
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"Unexpected return value, error %d.
\n
"
,
GetLastError
());
return
;
}
ret
=
pInitializeProcThreadAttributeList
(
NULL
,
1
,
0
,
&
size
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"Got unexpected ret %#x, GetLastError() %u.
\n
"
,
ret
,
GetLastError
());
memset
(
&
si
,
0
,
sizeof
(
si
));
si
.
StartupInfo
.
cb
=
sizeof
(
si
.
StartupInfo
);
si
.
lpAttributeList
=
heap_alloc
(
size
);
ret
=
pInitializeProcThreadAttributeList
(
si
.
lpAttributeList
,
1
,
0
,
&
size
);
ok
(
ret
,
"Got unexpected ret %#x, GetLastError() %u.
\n
"
,
ret
,
GetLastError
());
memset
(
&
sa
,
0
,
sizeof
(
sa
));
sa
.
nLength
=
sizeof
(
sa
);
sa
.
bInheritHandle
=
TRUE
;
ret
=
CreatePipe
(
&
pipe
[
0
],
&
pipe
[
1
],
&
sa
,
1024
);
ok
(
ret
,
"Failed to create a pipe.
\n
"
);
ret
=
pUpdateProcThreadAttribute
(
si
.
lpAttributeList
,
0
,
PROC_THREAD_ATTRIBUTE_HANDLE_LIST
,
&
pipe
[
0
],
sizeof
(
pipe
[
0
]),
NULL
,
NULL
);
ok
(
ret
,
"Got unexpected ret %#x, GetLastError() %u.
\n
"
,
ret
,
GetLastError
());
sprintf
(
buffer
,
"
\"
%s
\"
process handlelist %p %p"
,
selfname
,
pipe
[
0
],
pipe
[
1
]);
ret
=
CreateProcessA
(
NULL
,
buffer
,
NULL
,
NULL
,
TRUE
,
EXTENDED_STARTUPINFO_PRESENT
,
NULL
,
NULL
,
(
STARTUPINFOA
*
)
&
si
,
&
info
);
ok
(
ret
,
"Got unexpected ret %#x, GetLastError() %u.
\n
"
,
ret
,
GetLastError
());
wait_and_close_child_process
(
&
info
);
CloseHandle
(
pipe
[
0
]);
CloseHandle
(
pipe
[
1
]);
}
START_TEST
(
process
)
START_TEST
(
process
)
{
{
HANDLE
job
;
HANDLE
job
,
hproc
,
h
,
h2
;
HANDLE
hproc
;
BOOL
b
=
init
();
BOOL
b
=
init
();
ok
(
b
,
"Basic init of CreateProcess test
\n
"
);
ok
(
b
,
"Basic init of CreateProcess test
\n
"
);
if
(
!
b
)
return
;
if
(
!
b
)
return
;
...
@@ -4146,12 +4204,17 @@ START_TEST(process)
...
@@ -4146,12 +4204,17 @@ START_TEST(process)
}
}
else
if
(
!
strcmp
(
myARGV
[
2
],
"parent"
)
&&
myARGC
>=
5
)
else
if
(
!
strcmp
(
myARGV
[
2
],
"parent"
)
&&
myARGC
>=
5
)
{
{
HANDLE
h
;
sscanf
(
myARGV
[
4
],
"%p"
,
&
h
);
sscanf
(
myARGV
[
4
],
"%p"
,
&
h
);
test_parent_process_attribute
(
atoi
(
myARGV
[
3
]),
h
);
test_parent_process_attribute
(
atoi
(
myARGV
[
3
]),
h
);
return
;
return
;
}
}
else
if
(
!
strcmp
(
myARGV
[
2
],
"handlelist"
)
&&
myARGC
>=
5
)
{
sscanf
(
myARGV
[
3
],
"%p"
,
&
h
);
sscanf
(
myARGV
[
4
],
"%p"
,
&
h2
);
test_handle_list_attribute
(
TRUE
,
h
,
h2
);
return
;
}
ok
(
0
,
"Unexpected command %s
\n
"
,
myARGV
[
2
]);
ok
(
0
,
"Unexpected command %s
\n
"
,
myARGV
[
2
]);
return
;
return
;
...
@@ -4220,4 +4283,5 @@ START_TEST(process)
...
@@ -4220,4 +4283,5 @@ START_TEST(process)
test_BreakawayOk
(
job
);
test_BreakawayOk
(
job
);
CloseHandle
(
job
);
CloseHandle
(
job
);
test_parent_process_attribute
(
0
,
NULL
);
test_parent_process_attribute
(
0
,
NULL
);
test_handle_list_attribute
(
FALSE
,
NULL
,
NULL
);
}
}
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