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
36663d9a
Commit
36663d9a
authored
Aug 20, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Aug 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Add CreatePseudoConsole tests.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0ec191eb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
0 deletions
+58
-0
console.c
dlls/kernel32/tests/console.c
+58
-0
No files found.
dlls/kernel32/tests/console.c
View file @
36663d9a
...
...
@@ -24,6 +24,8 @@
#include <winternl.h>
#include <stdio.h>
static
void
(
WINAPI
*
pClosePseudoConsole
)(
HPCON
);
static
HRESULT
(
WINAPI
*
pCreatePseudoConsole
)(
COORD
,
HANDLE
,
HANDLE
,
DWORD
,
HPCON
*
);
static
BOOL
(
WINAPI
*
pGetConsoleInputExeNameA
)(
DWORD
,
LPSTR
);
static
DWORD
(
WINAPI
*
pGetConsoleProcessList
)(
LPDWORD
,
DWORD
);
static
HANDLE
(
WINAPI
*
pOpenConsoleW
)(
LPCWSTR
,
DWORD
,
BOOL
,
DWORD
);
...
...
@@ -68,6 +70,8 @@ static void init_function_pointers(void)
if(!p##func) trace("GetProcAddress(hKernel32, '%s') failed\n", #func);
hKernel32
=
GetModuleHandleA
(
"kernel32.dll"
);
KERNEL32_GET_PROC
(
ClosePseudoConsole
);
KERNEL32_GET_PROC
(
CreatePseudoConsole
);
KERNEL32_GET_PROC
(
GetConsoleInputExeNameA
);
KERNEL32_GET_PROC
(
GetConsoleProcessList
);
KERNEL32_GET_PROC
(
OpenConsoleW
);
...
...
@@ -3941,6 +3945,59 @@ static void test_AllocConsole(void)
CloseHandle
(
pipe_write
);
}
static
DWORD
WINAPI
read_pipe_proc
(
void
*
handle
)
{
char
buf
[
64
];
DWORD
size
;
while
(
ReadFile
(
handle
,
buf
,
sizeof
(
buf
),
&
size
,
NULL
));
ok
(
GetLastError
()
==
ERROR_BROKEN_PIPE
,
"ReadFile returned %u
\n
"
,
GetLastError
());
CloseHandle
(
handle
);
return
0
;
}
static
void
test_pseudo_console
(
void
)
{
HANDLE
console_pipe
,
console_pipe2
,
thread
;
HPCON
pseudo_console
;
COORD
size
;
HRESULT
hres
;
if
(
!
pCreatePseudoConsole
)
{
win_skip
(
"CreatePseudoConsole not available
\n
"
);
return
;
}
console_pipe
=
CreateNamedPipeW
(
L"
\\\\
.
\\
pipe
\\
pseudoconsoleconn"
,
PIPE_ACCESS_DUPLEX
,
PIPE_WAIT
|
PIPE_TYPE_BYTE
,
1
,
4096
,
4096
,
NMPWAIT_USE_DEFAULT_WAIT
,
NULL
);
ok
(
console_pipe
!=
INVALID_HANDLE_VALUE
,
"CreateNamedPipeW failed: %u
\n
"
,
GetLastError
());
console_pipe2
=
CreateFileW
(
L"
\\\\
.
\\
pipe
\\
pseudoconsoleconn"
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_FLAG_OVERLAPPED
,
NULL
);
ok
(
console_pipe2
!=
INVALID_HANDLE_VALUE
,
"CreateFile failed: %u
\n
"
,
GetLastError
());
thread
=
CreateThread
(
NULL
,
0
,
read_pipe_proc
,
console_pipe
,
0
,
NULL
);
CloseHandle
(
thread
);
size
.
X
=
0
;
size
.
Y
=
30
;
hres
=
pCreatePseudoConsole
(
size
,
console_pipe2
,
console_pipe2
,
0
,
&
pseudo_console
);
ok
(
hres
==
E_INVALIDARG
,
"CreatePseudoConsole failed: %08x
\n
"
,
hres
);
size
.
X
=
40
;
size
.
Y
=
0
;
hres
=
pCreatePseudoConsole
(
size
,
console_pipe2
,
console_pipe2
,
0
,
&
pseudo_console
);
ok
(
hres
==
E_INVALIDARG
,
"CreatePseudoConsole failed: %08x
\n
"
,
hres
);
size
.
X
=
40
;
size
.
Y
=
30
;
hres
=
pCreatePseudoConsole
(
size
,
console_pipe2
,
console_pipe2
,
0
,
&
pseudo_console
);
ok
(
hres
==
S_OK
,
"CreatePseudoConsole failed: %08x
\n
"
,
hres
);
CloseHandle
(
console_pipe2
);
pClosePseudoConsole
(
pseudo_console
);
}
START_TEST
(
console
)
{
HANDLE
hConIn
,
hConOut
;
...
...
@@ -4123,5 +4180,6 @@ START_TEST(console)
test_AttachConsole
(
hConOut
);
test_AllocConsole
();
test_FreeConsole
();
test_pseudo_console
();
}
}
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