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
9498fabf
Commit
9498fabf
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 EnumPorts tests when InitializePrintMonitor2 is used.
parent
8e9bcf42
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
18 deletions
+25
-18
localmon.c
dlls/localspl/tests/localmon.c
+25
-18
No files found.
dlls/localspl/tests/localmon.c
View file @
9498fabf
...
...
@@ -234,6 +234,14 @@ static BOOL delete_port(LPWSTR portname)
(
lstrlenW
(
portname
)
+
1
)
*
sizeof
(
WCHAR
),
NULL
,
0
,
NULL
)
==
ERROR_SUCCESS
;
}
static
BOOL
call_EnumPorts
(
WCHAR
*
name
,
DWORD
level
,
BYTE
*
buf
,
DWORD
size
,
DWORD
*
needed
,
DWORD
*
count
)
{
if
(
pEnumPorts
)
return
pEnumPorts
(
name
,
level
,
buf
,
size
,
needed
,
count
);
return
pEnumPorts2
(
hmon
,
name
,
level
,
buf
,
size
,
needed
,
count
);
}
static
BOOL
call_AddPortEx
(
WCHAR
*
name
,
DWORD
level
,
BYTE
*
buf
,
WCHAR
*
mon
)
{
if
(
pAddPortEx
)
...
...
@@ -256,13 +264,13 @@ static void find_installed_ports(void)
have_lpt
[
0
]
=
'\0'
;
have_file
[
0
]
=
'\0'
;
if
(
!
pEnumPorts
)
return
;
if
(
!
pEnumPorts
&&
!
pEnumPorts2
)
return
;
res
=
p
EnumPorts
(
NULL
,
1
,
NULL
,
0
,
&
needed
,
&
returned
);
res
=
call_
EnumPorts
(
NULL
,
1
,
NULL
,
0
,
&
needed
,
&
returned
);
if
(
!
res
&&
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
))
{
pi
=
HeapAlloc
(
GetProcessHeap
(),
0
,
needed
);
}
res
=
p
EnumPorts
(
NULL
,
1
,
(
LPBYTE
)
pi
,
needed
,
&
needed
,
&
returned
);
res
=
call_
EnumPorts
(
NULL
,
1
,
(
LPBYTE
)
pi
,
needed
,
&
needed
,
&
returned
);
if
(
!
res
)
{
skip
(
"no ports found
\n
"
);
...
...
@@ -619,7 +627,7 @@ static void test_EnumPorts(void)
DWORD
pcbNeeded
;
DWORD
pcReturned
;
if
(
!
pEnumPorts
)
return
;
if
(
!
pEnumPorts
&&
!
pEnumPorts2
)
return
;
/* valid levels are 1 and 2 */
for
(
level
=
0
;
level
<
4
;
level
++
)
{
...
...
@@ -627,15 +635,14 @@ static void test_EnumPorts(void)
cbBuf
=
0xdeadbeef
;
pcReturned
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
res
=
p
EnumPorts
(
NULL
,
level
,
NULL
,
0
,
&
cbBuf
,
&
pcReturned
);
res
=
call_
EnumPorts
(
NULL
,
level
,
NULL
,
0
,
&
cbBuf
,
&
pcReturned
);
/* use only a short test, when we test with an invalid level */
if
(
!
level
||
(
level
>
2
))
{
/* NT4 fails with ERROR_INVALID_LEVEL (as expected)
XP succeeds with ERROR_SUCCESS () */
ok
(
(
cbBuf
==
0
)
&&
(
pcReturned
==
0
),
"(%ld) returned %ld with %lu and %ld, %ld (expected 0, 0)
\n
"
,
level
,
res
,
GetLastError
(),
cbBuf
,
pcReturned
);
todo_wine
ok
(
!
res
||
broken
(
res
&&
!
GetLastError
()),
"EnumPorts succeeded with level %ld
\n
"
,
level
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_LEVEL
||
broken
(
res
&&
!
GetLastError
()),
"GetLastError() = %ld
\n
"
,
GetLastError
());
continue
;
}
...
...
@@ -650,7 +657,7 @@ static void test_EnumPorts(void)
pcbNeeded
=
0xdeadbeef
;
pcReturned
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
res
=
p
EnumPorts
(
NULL
,
level
,
buffer
,
cbBuf
,
&
pcbNeeded
,
&
pcReturned
);
res
=
call_
EnumPorts
(
NULL
,
level
,
buffer
,
cbBuf
,
&
pcbNeeded
,
&
pcReturned
);
ok
(
res
,
"(%ld) returned %ld with %lu and %ld, %ld (expected '!= 0')
\n
"
,
level
,
res
,
GetLastError
(),
pcbNeeded
,
pcReturned
);
/* We can compare the returned Data with the Registry / "win.ini",[Ports] here */
...
...
@@ -658,14 +665,14 @@ static void test_EnumPorts(void)
pcbNeeded
=
0xdeadbeef
;
pcReturned
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
res
=
p
EnumPorts
(
NULL
,
level
,
buffer
,
cbBuf
+
1
,
&
pcbNeeded
,
&
pcReturned
);
res
=
call_
EnumPorts
(
NULL
,
level
,
buffer
,
cbBuf
+
1
,
&
pcbNeeded
,
&
pcReturned
);
ok
(
res
,
"(%ld) returned %ld with %lu and %ld, %ld (expected '!= 0')
\n
"
,
level
,
res
,
GetLastError
(),
pcbNeeded
,
pcReturned
);
pcbNeeded
=
0xdeadbeef
;
pcReturned
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
res
=
p
EnumPorts
(
NULL
,
level
,
buffer
,
cbBuf
-
1
,
&
pcbNeeded
,
&
pcReturned
);
res
=
call_
EnumPorts
(
NULL
,
level
,
buffer
,
cbBuf
-
1
,
&
pcbNeeded
,
&
pcReturned
);
ok
(
!
res
&&
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
),
"(%ld) returned %ld with %lu and %ld, %ld (expected '0' with "
"ERROR_INSUFFICIENT_BUFFER)
\n
"
,
...
...
@@ -674,23 +681,23 @@ static void test_EnumPorts(void)
if
(
0
)
{
/* The following tests crash this app with native localmon/localspl */
p
EnumPorts
(
NULL
,
level
,
NULL
,
cbBuf
,
&
pcbNeeded
,
&
pcReturned
);
p
EnumPorts
(
NULL
,
level
,
buffer
,
cbBuf
,
NULL
,
&
pcReturned
);
p
EnumPorts
(
NULL
,
level
,
buffer
,
cbBuf
,
&
pcbNeeded
,
NULL
);
call_
EnumPorts
(
NULL
,
level
,
NULL
,
cbBuf
,
&
pcbNeeded
,
&
pcReturned
);
call_
EnumPorts
(
NULL
,
level
,
buffer
,
cbBuf
,
NULL
,
&
pcReturned
);
call_
EnumPorts
(
NULL
,
level
,
buffer
,
cbBuf
,
&
pcbNeeded
,
NULL
);
}
/* The Servername is ignored */
pcbNeeded
=
0xdeadbeef
;
pcReturned
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
res
=
p
EnumPorts
(
emptyW
,
level
,
buffer
,
cbBuf
+
1
,
&
pcbNeeded
,
&
pcReturned
);
res
=
call_
EnumPorts
(
emptyW
,
level
,
buffer
,
cbBuf
+
1
,
&
pcbNeeded
,
&
pcReturned
);
ok
(
res
,
"(%ld) returned %ld with %lu and %ld, %ld (expected '!= 0')
\n
"
,
level
,
res
,
GetLastError
(),
pcbNeeded
,
pcReturned
);
pcbNeeded
=
0xdeadbeef
;
pcReturned
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
res
=
p
EnumPorts
(
server_does_not_existW
,
level
,
buffer
,
cbBuf
+
1
,
&
pcbNeeded
,
&
pcReturned
);
res
=
call_
EnumPorts
(
server_does_not_existW
,
level
,
buffer
,
cbBuf
+
1
,
&
pcbNeeded
,
&
pcReturned
);
ok
(
res
,
"(%ld) returned %ld with %lu and %ld, %ld (expected '!= 0')
\n
"
,
level
,
res
,
GetLastError
(),
pcbNeeded
,
pcReturned
);
...
...
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