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
3a47598b
Commit
3a47598b
authored
Dec 12, 2019
by
Paul Gofman
Committed by
Alexandre Julliard
Dec 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Test invalid parent handle in test_parent_process_attribute().
Signed-off-by:
Paul Gofman
<
gofmanp@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
74a74556
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
86 additions
and
3 deletions
+86
-3
process.c
dlls/kernel32/tests/process.c
+86
-3
No files found.
dlls/kernel32/tests/process.c
View file @
3a47598b
...
...
@@ -2042,7 +2042,7 @@ static void test_QueryFullProcessImageNameW(void)
todo_wine
{
expect_eq_d
(
FALSE
,
pQueryFullProcessImageNameW
(
hSelf
,
flags
,
buf
,
&
size
));
expect_eq_d
(
ARRAY_SIZE
(
buf
),
size
);
/* size not changed */
expect_eq_d
(
(
DWORD
)
ARRAY_SIZE
(
buf
),
size
);
/* size not changed */
expect_eq_d
(
ERROR_INVALID_PARAMETER
,
GetLastError
());
expect_eq_d
(
0x13579acf
,
*
(
DWORD
*
)
buf
);
/* buffer not changed */
}
...
...
@@ -2055,7 +2055,7 @@ static void test_QueryFullProcessImageNameW(void)
todo_wine
{
expect_eq_d
(
FALSE
,
pQueryFullProcessImageNameW
(
hSelf
,
flags
,
buf
,
&
size
));
expect_eq_d
(
ARRAY_SIZE
(
buf
),
size
);
/* size not changed */
expect_eq_d
(
(
DWORD
)
ARRAY_SIZE
(
buf
),
size
);
/* size not changed */
expect_eq_d
(
ERROR_INVALID_PARAMETER
,
GetLastError
());
expect_eq_d
(
0x13579acf
,
*
(
DWORD
*
)
buf
);
/* buffer not changed */
}
...
...
@@ -3812,7 +3812,8 @@ static void test_ProcThreadAttributeList(void)
/* level 0: Main test process
* level 1: Process created by level 0 process without handle inheritance
* 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. */
void
test_parent_process_attribute
(
unsigned
int
level
,
HANDLE
read_pipe
)
{
PROCESS_BASIC_INFORMATION
pbi
;
...
...
@@ -3835,6 +3836,9 @@ void test_parent_process_attribute(unsigned int level, HANDLE read_pipe)
}
parent_data
;
if
(
level
==
255
)
return
;
if
(
!
pInitializeProcThreadAttributeList
)
{
win_skip
(
"No support for ProcThreadAttributeList.
\n
"
);
...
...
@@ -3878,11 +3882,90 @@ void test_parent_process_attribute(unsigned int level, HANDLE read_pipe)
if
(
level
)
{
HANDLE
handle
;
SIZE_T
size
;
ret
=
pInitializeProcThreadAttributeList
(
NULL
,
1
,
0
,
&
size
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"Got unexpected ret %#x, GetLastError() %u.
\n
"
,
ret
,
GetLastError
());
sprintf
(
buffer
,
"
\"
%s
\"
tests/process.c parent %u %p"
,
selfname
,
255
,
read_pipe
);
#if 0
/* Crashes on some Windows installations, otherwise successfully creates process. */
ret = CreateProcessA(NULL, buffer, NULL, NULL, FALSE, EXTENDED_STARTUPINFO_PRESENT,
NULL, NULL, (STARTUPINFOA *)&si, &info);
ok(ret, "Got unexpected ret %#x, GetLastError() %u.\n", ret, GetLastError());
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
CloseHandle(info.hThread);
CloseHandle(info.hProcess);
#endif
si
.
lpAttributeList
=
heap_alloc
(
size
);
ret
=
pInitializeProcThreadAttributeList
(
si
.
lpAttributeList
,
1
,
0
,
&
size
);
ok
(
ret
,
"Got unexpected ret %#x, GetLastError() %u.
\n
"
,
ret
,
GetLastError
());
handle
=
OpenProcess
(
PROCESS_CREATE_PROCESS
,
TRUE
,
GetCurrentProcessId
());
ret
=
pUpdateProcThreadAttribute
(
si
.
lpAttributeList
,
0
,
PROC_THREAD_ATTRIBUTE_PARENT_PROCESS
,
&
handle
,
sizeof
(
handle
),
NULL
,
NULL
);
ok
(
ret
,
"Got unexpected ret %#x, GetLastError() %u.
\n
"
,
ret
,
GetLastError
());
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
());
ok
(
WaitForSingleObject
(
info
.
hProcess
,
30000
)
==
WAIT_OBJECT_0
,
"Child process termination
\n
"
);
CloseHandle
(
info
.
hThread
);
CloseHandle
(
info
.
hProcess
);
CloseHandle
(
handle
);
pDeleteProcThreadAttributeList
(
si
.
lpAttributeList
);
heap_free
(
si
.
lpAttributeList
);
si
.
lpAttributeList
=
heap_alloc
(
size
);
ret
=
pInitializeProcThreadAttributeList
(
si
.
lpAttributeList
,
1
,
0
,
&
size
);
ok
(
ret
,
"Got unexpected ret %#x, GetLastError() %u.
\n
"
,
ret
,
GetLastError
());
handle
=
(
HANDLE
)
0xdeadbeef
;
ret
=
pUpdateProcThreadAttribute
(
si
.
lpAttributeList
,
0
,
PROC_THREAD_ATTRIBUTE_PARENT_PROCESS
,
&
handle
,
sizeof
(
handle
),
NULL
,
NULL
);
ok
(
ret
,
"Got unexpected ret %#x, GetLastError() %u.
\n
"
,
ret
,
GetLastError
());
ret
=
CreateProcessA
(
NULL
,
buffer
,
NULL
,
NULL
,
TRUE
,
EXTENDED_STARTUPINFO_PRESENT
,
NULL
,
NULL
,
(
STARTUPINFOA
*
)
&
si
,
&
info
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"Got unexpected ret %#x, GetLastError() %u.
\n
"
,
ret
,
GetLastError
());
pDeleteProcThreadAttributeList
(
si
.
lpAttributeList
);
heap_free
(
si
.
lpAttributeList
);
si
.
lpAttributeList
=
heap_alloc
(
size
);
ret
=
pInitializeProcThreadAttributeList
(
si
.
lpAttributeList
,
1
,
0
,
&
size
);
ok
(
ret
,
"Got unexpected ret %#x, GetLastError() %u.
\n
"
,
ret
,
GetLastError
());
handle
=
NULL
;
ret
=
pUpdateProcThreadAttribute
(
si
.
lpAttributeList
,
0
,
PROC_THREAD_ATTRIBUTE_PARENT_PROCESS
,
&
handle
,
sizeof
(
handle
),
NULL
,
NULL
);
ok
(
ret
,
"Got unexpected ret %#x, GetLastError() %u.
\n
"
,
ret
,
GetLastError
());
ret
=
CreateProcessA
(
NULL
,
buffer
,
NULL
,
NULL
,
TRUE
,
EXTENDED_STARTUPINFO_PRESENT
,
NULL
,
NULL
,
(
STARTUPINFOA
*
)
&
si
,
&
info
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"Got unexpected ret %#x, GetLastError() %u.
\n
"
,
ret
,
GetLastError
());
pDeleteProcThreadAttributeList
(
si
.
lpAttributeList
);
heap_free
(
si
.
lpAttributeList
);
si
.
lpAttributeList
=
heap_alloc
(
size
);
ret
=
pInitializeProcThreadAttributeList
(
si
.
lpAttributeList
,
1
,
0
,
&
size
);
ok
(
ret
,
"Got unexpected ret %#x, GetLastError() %u.
\n
"
,
ret
,
GetLastError
());
handle
=
GetCurrentProcess
();
ret
=
pUpdateProcThreadAttribute
(
si
.
lpAttributeList
,
0
,
PROC_THREAD_ATTRIBUTE_PARENT_PROCESS
,
&
handle
,
sizeof
(
handle
),
NULL
,
NULL
);
ok
(
ret
,
"Got unexpected ret %#x, GetLastError() %u.
\n
"
,
ret
,
GetLastError
());
ret
=
CreateProcessA
(
NULL
,
buffer
,
NULL
,
NULL
,
TRUE
,
EXTENDED_STARTUPINFO_PRESENT
,
NULL
,
NULL
,
(
STARTUPINFOA
*
)
&
si
,
&
info
);
/* Broken on Vista / w7 / w10. */
ok
(
ret
||
broken
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_HANDLE
),
"Got unexpected ret %#x, GetLastError() %u.
\n
"
,
ret
,
GetLastError
());
if
(
ret
)
{
ok
(
WaitForSingleObject
(
info
.
hProcess
,
30000
)
==
WAIT_OBJECT_0
,
"Child process termination
\n
"
);
CloseHandle
(
info
.
hThread
);
CloseHandle
(
info
.
hProcess
);
}
pDeleteProcThreadAttributeList
(
si
.
lpAttributeList
);
heap_free
(
si
.
lpAttributeList
);
si
.
lpAttributeList
=
heap_alloc
(
size
);
ret
=
pInitializeProcThreadAttributeList
(
si
.
lpAttributeList
,
1
,
0
,
&
size
);
ok
(
ret
,
"Got unexpected ret %#x, GetLastError() %u.
\n
"
,
ret
,
GetLastError
());
...
...
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