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
3d62544f
Commit
3d62544f
authored
Nov 24, 2022
by
Piotr Caban
Committed by
Alexandre Julliard
Nov 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
localspl: Run OpenPort tests when InitializePrintMonitor2 is used.
parent
9498fabf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
24 deletions
+29
-24
localmon.c
dlls/localspl/tests/localmon.c
+29
-24
No files found.
dlls/localspl/tests/localmon.c
View file @
3d62544f
...
@@ -242,6 +242,13 @@ static BOOL call_EnumPorts(WCHAR *name, DWORD level, BYTE *buf, DWORD size,
...
@@ -242,6 +242,13 @@ static BOOL call_EnumPorts(WCHAR *name, DWORD level, BYTE *buf, DWORD size,
return
pEnumPorts2
(
hmon
,
name
,
level
,
buf
,
size
,
needed
,
count
);
return
pEnumPorts2
(
hmon
,
name
,
level
,
buf
,
size
,
needed
,
count
);
}
}
static
BOOL
call_OpenPort
(
WCHAR
*
name
,
HANDLE
*
h
)
{
if
(
pOpenPort
)
return
pOpenPort
(
name
,
h
);
return
pOpenPort2
(
hmon
,
name
,
h
);
}
static
BOOL
call_AddPortEx
(
WCHAR
*
name
,
DWORD
level
,
BYTE
*
buf
,
WCHAR
*
mon
)
static
BOOL
call_AddPortEx
(
WCHAR
*
name
,
DWORD
level
,
BYTE
*
buf
,
WCHAR
*
mon
)
{
{
if
(
pAddPortEx
)
if
(
pAddPortEx
)
...
@@ -456,15 +463,15 @@ static void test_ClosePort(void)
...
@@ -456,15 +463,15 @@ static void test_ClosePort(void)
DWORD
res2
;
DWORD
res2
;
if
(
!
pOpenPort
||
!
pClosePort
)
return
;
if
(
(
!
pOpenPort
&&
!
pOpenPort2
)
||
!
pClosePort
)
return
;
if
(
have_com
[
0
])
{
if
(
have_com
[
0
])
{
nameW
=
have_com
;
nameW
=
have_com
;
hPort
=
(
HANDLE
)
0xdeadbeef
;
hPort
=
(
HANDLE
)
0xdeadbeef
;
res
=
p
OpenPort
(
nameW
,
&
hPort
);
res
=
call_
OpenPort
(
nameW
,
&
hPort
);
hPort2
=
(
HANDLE
)
0xdeadbeef
;
hPort2
=
(
HANDLE
)
0xdeadbeef
;
res2
=
p
OpenPort
(
nameW
,
&
hPort2
);
res2
=
call_
OpenPort
(
nameW
,
&
hPort2
);
if
(
res2
&&
(
hPort2
!=
hPort
))
{
if
(
res2
&&
(
hPort2
!=
hPort
))
{
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
...
@@ -484,9 +491,9 @@ static void test_ClosePort(void)
...
@@ -484,9 +491,9 @@ static void test_ClosePort(void)
nameW
=
have_lpt
;
nameW
=
have_lpt
;
hPort
=
(
HANDLE
)
0xdeadbeef
;
hPort
=
(
HANDLE
)
0xdeadbeef
;
res
=
p
OpenPort
(
nameW
,
&
hPort
);
res
=
call_
OpenPort
(
nameW
,
&
hPort
);
hPort2
=
(
HANDLE
)
0xdeadbeef
;
hPort2
=
(
HANDLE
)
0xdeadbeef
;
res2
=
p
OpenPort
(
nameW
,
&
hPort2
);
res2
=
call_
OpenPort
(
nameW
,
&
hPort2
);
if
(
res2
&&
(
hPort2
!=
hPort
))
{
if
(
res2
&&
(
hPort2
!=
hPort
))
{
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
...
@@ -506,9 +513,9 @@ static void test_ClosePort(void)
...
@@ -506,9 +513,9 @@ static void test_ClosePort(void)
nameW
=
have_file
;
nameW
=
have_file
;
hPort
=
(
HANDLE
)
0xdeadbeef
;
hPort
=
(
HANDLE
)
0xdeadbeef
;
res
=
p
OpenPort
(
nameW
,
&
hPort
);
res
=
call_
OpenPort
(
nameW
,
&
hPort
);
hPort2
=
(
HANDLE
)
0xdeadbeef
;
hPort2
=
(
HANDLE
)
0xdeadbeef
;
res2
=
p
OpenPort
(
nameW
,
&
hPort2
);
res2
=
call_
OpenPort
(
nameW
,
&
hPort2
);
if
(
res2
&&
(
hPort2
!=
hPort
))
{
if
(
res2
&&
(
hPort2
!=
hPort
))
{
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
...
@@ -764,21 +771,21 @@ static void test_OpenPort(void)
...
@@ -764,21 +771,21 @@ static void test_OpenPort(void)
DWORD
res
;
DWORD
res
;
DWORD
res2
;
DWORD
res2
;
if
(
!
pOpenPort
||
!
pClosePort
)
return
;
if
(
(
!
pOpenPort
&&
!
pOpenPort2
)
||
!
pClosePort
)
return
;
if
(
have_com
[
0
])
{
if
(
have_com
[
0
])
{
nameW
=
have_com
;
nameW
=
have_com
;
hPort
=
(
HANDLE
)
0xdeadbeef
;
hPort
=
(
HANDLE
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
res
=
p
OpenPort
(
nameW
,
&
hPort
);
res
=
call_
OpenPort
(
nameW
,
&
hPort
);
ok
(
res
,
"got %lu with %lu and %p (expected '!= 0')
\n
"
,
ok
(
res
,
"got %lu with %lu and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hPort
);
res
,
GetLastError
(),
hPort
);
/* the same HANDLE is returned for a second OpenPort in native localspl */
/* the same HANDLE is returned for a second OpenPort in native localspl */
hPort2
=
(
HANDLE
)
0xdeadbeef
;
hPort2
=
(
HANDLE
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
res2
=
p
OpenPort
(
nameW
,
&
hPort2
);
res2
=
call_
OpenPort
(
nameW
,
&
hPort2
);
ok
(
res2
,
"got %lu with %lu and %p (expected '!= 0')
\n
"
,
ok
(
res2
,
"got %lu with %lu and %p (expected '!= 0')
\n
"
,
res2
,
GetLastError
(),
hPort2
);
res2
,
GetLastError
(),
hPort2
);
...
@@ -791,7 +798,7 @@ static void test_OpenPort(void)
...
@@ -791,7 +798,7 @@ static void test_OpenPort(void)
hPort
=
(
HANDLE
)
0xdeadbeef
;
hPort
=
(
HANDLE
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
res
=
p
OpenPort
(
nameW
,
&
hPort
);
res
=
call_
OpenPort
(
nameW
,
&
hPort
);
ok
(
res
||
(
GetLastError
()
==
ERROR_ACCESS_DENIED
),
ok
(
res
||
(
GetLastError
()
==
ERROR_ACCESS_DENIED
),
"got %lu with %lu and %p (expected '!= 0' or '0' with ERROR_ACCESS_DENIED)
\n
"
,
"got %lu with %lu and %p (expected '!= 0' or '0' with ERROR_ACCESS_DENIED)
\n
"
,
res
,
GetLastError
(),
hPort
);
res
,
GetLastError
(),
hPort
);
...
@@ -799,7 +806,7 @@ static void test_OpenPort(void)
...
@@ -799,7 +806,7 @@ static void test_OpenPort(void)
/* the same HANDLE is returned for a second OpenPort in native localspl */
/* the same HANDLE is returned for a second OpenPort in native localspl */
hPort2
=
(
HANDLE
)
0xdeadbeef
;
hPort2
=
(
HANDLE
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
res2
=
p
OpenPort
(
nameW
,
&
hPort2
);
res2
=
call_
OpenPort
(
nameW
,
&
hPort2
);
ok
(
res2
||
(
GetLastError
()
==
ERROR_ACCESS_DENIED
),
ok
(
res2
||
(
GetLastError
()
==
ERROR_ACCESS_DENIED
),
"got %lu with %lu and %p (expected '!= 0' or '0' with ERROR_ACCESS_DENIED)
\n
"
,
"got %lu with %lu and %p (expected '!= 0' or '0' with ERROR_ACCESS_DENIED)
\n
"
,
res2
,
GetLastError
(),
hPort2
);
res2
,
GetLastError
(),
hPort2
);
...
@@ -813,14 +820,14 @@ static void test_OpenPort(void)
...
@@ -813,14 +820,14 @@ static void test_OpenPort(void)
hPort
=
(
HANDLE
)
0xdeadbeef
;
hPort
=
(
HANDLE
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
res
=
p
OpenPort
(
nameW
,
&
hPort
);
res
=
call_
OpenPort
(
nameW
,
&
hPort
);
ok
(
res
,
"got %lu with %lu and %p (expected '!= 0')
\n
"
,
ok
(
res
,
"got %lu with %lu and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hPort
);
res
,
GetLastError
(),
hPort
);
/* a different HANDLE is returned for a second OpenPort */
/* a different HANDLE is returned for a second OpenPort */
hPort2
=
(
HANDLE
)
0xdeadbeef
;
hPort2
=
(
HANDLE
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
res2
=
p
OpenPort
(
nameW
,
&
hPort2
);
res2
=
call_
OpenPort
(
nameW
,
&
hPort2
);
ok
(
res2
&&
(
hPort2
!=
hPort
),
ok
(
res2
&&
(
hPort2
!=
hPort
),
"got %lu with %lu and %p (expected '!= 0' and '!= %p')
\n
"
,
"got %lu with %lu and %p (expected '!= 0' and '!= %p')
\n
"
,
res2
,
GetLastError
(),
hPort2
,
hPort
);
res2
,
GetLastError
(),
hPort2
,
hPort
);
...
@@ -834,23 +841,21 @@ static void test_OpenPort(void)
...
@@ -834,23 +841,21 @@ static void test_OpenPort(void)
if
(
nameW
)
{
if
(
nameW
)
{
hPort
=
(
HANDLE
)
0xdeadbeef
;
hPort
=
(
HANDLE
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
res
=
p
OpenPort
(
nameW
,
NULL
);
res
=
call_
OpenPort
(
nameW
,
NULL
);
trace
(
"got %lu with %lu and %p
\n
"
,
res
,
GetLastError
(),
hPort
);
trace
(
"got %lu with %lu and %p
\n
"
,
res
,
GetLastError
(),
hPort
);
}
}
}
}
hPort
=
(
HANDLE
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
res
=
p
OpenPort
(
does_not_existW
,
&
hPort
);
res
=
call_
OpenPort
(
does_not_existW
,
&
hPort
);
ok
(
!
res
&&
(
hPort
==
(
HANDLE
)
0xdeadbeef
)
,
ok
(
!
res
,
"got %lu with 0x%lx and %p (expected '0' and 0xdeadbeef)
\n
"
,
"got %lu with 0x%lx and %p (expected '0' and 0xdeadbeef)
\n
"
,
res
,
GetLastError
(),
hPort
);
res
,
GetLastError
(),
hPort
);
if
(
res
)
pClosePort
(
hPort
);
if
(
res
)
pClosePort
(
hPort
);
hPort
=
(
HANDLE
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
res
=
p
OpenPort
(
emptyW
,
&
hPort
);
res
=
call_
OpenPort
(
emptyW
,
&
hPort
);
ok
(
!
res
&&
(
hPort
==
(
HANDLE
)
0xdeadbeef
)
,
ok
(
!
res
,
"got %lu with 0x%lx and %p (expected '0' and 0xdeadbeef)
\n
"
,
"got %lu with 0x%lx and %p (expected '0' and 0xdeadbeef)
\n
"
,
res
,
GetLastError
(),
hPort
);
res
,
GetLastError
(),
hPort
);
if
(
res
)
pClosePort
(
hPort
);
if
(
res
)
pClosePort
(
hPort
);
...
@@ -858,7 +863,7 @@ static void test_OpenPort(void)
...
@@ -858,7 +863,7 @@ static void test_OpenPort(void)
if
(
0
)
{
if
(
0
)
{
hPort
=
(
HANDLE
)
0xdeadbeef
;
hPort
=
(
HANDLE
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
res
=
p
OpenPort
(
NULL
,
&
hPort
);
res
=
call_
OpenPort
(
NULL
,
&
hPort
);
trace
(
"got %lu with %lu and %p
\n
"
,
res
,
GetLastError
(),
hPort
);
trace
(
"got %lu with %lu and %p
\n
"
,
res
,
GetLastError
(),
hPort
);
}
}
...
...
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