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
4307f642
Commit
4307f642
authored
Jun 18, 2007
by
Detlef Riekenberg
Committed by
Alexandre Julliard
Jun 18, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winspool/tests: Add tests for AddPortEx.
parent
fe40b2d8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
126 additions
and
12 deletions
+126
-12
info.c
dlls/winspool.drv/info.c
+9
-12
info.c
dlls/winspool.drv/tests/info.c
+117
-0
No files found.
dlls/winspool.drv/info.c
View file @
4307f642
...
...
@@ -6144,29 +6144,26 @@ BOOL WINAPI AddPortExW(LPWSTR pName, DWORD level, LPBYTE pBuffer, LPWSTR pMonito
return
FALSE
;
}
if
(
!
pi2
)
{
if
(
(
!
pi2
)
||
(
!
pMonitorName
)
||
(
!
pMonitorName
[
0
])
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
/* we need a valid Monitorname */
if
(
!
pMonitorName
)
{
SetLastError
(
RPC_X_NULL_REF_POINTER
);
return
FALSE
;
}
if
(
!
pMonitorName
[
0
])
{
SetLastError
(
ERROR_NOT_SUPPORTED
);
return
FALSE
;
}
/* load the Monitor */
pm
=
monitor_load
(
pMonitorName
,
NULL
);
if
(
!
pm
)
return
FALSE
;
if
(
!
pm
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
pm
->
monitor
&&
pm
->
monitor
->
pfnAddPortEx
)
{
res
=
pm
->
monitor
->
pfnAddPortEx
(
pName
,
level
,
pBuffer
,
pMonitorName
);
TRACE
(
"got %u with %u
\n
"
,
res
,
GetLastError
());
}
else
{
FIXME
(
"not implemented for %s (%p)
\n
"
,
debugstr_w
(
pMonitorName
),
pm
->
monitor
);
}
monitor_unload
(
pm
);
return
res
;
}
...
...
dlls/winspool.drv/tests/info.c
View file @
4307f642
...
...
@@ -45,6 +45,7 @@ static CHAR env_x86[] = "Windows NT x86";
static
CHAR
env_win9x_case
[]
=
"windowS 4.0"
;
static
CHAR
illegal_name
[]
=
"illegal,name"
;
static
CHAR
invalid_env
[]
=
"invalid_env"
;
static
CHAR
LocalPortA
[]
=
"Local Port"
;
static
CHAR
portname_com1
[]
=
"COM1:"
;
static
CHAR
portname_file
[]
=
"FILE:"
;
static
CHAR
portname_lpt1
[]
=
"LPT1:"
;
...
...
@@ -67,6 +68,7 @@ static HANDLE hwinspool;
static
FARPROC
pGetDefaultPrinterA
;
static
FARPROC
pSetDefaultPrinterA
;
static
DWORD
(
WINAPI
*
pXcvDataW
)(
HANDLE
,
LPCWSTR
,
PBYTE
,
DWORD
,
PBYTE
,
DWORD
,
PDWORD
,
PDWORD
);
static
BOOL
(
WINAPI
*
pAddPortExA
)(
LPSTR
,
DWORD
,
LPBYTE
,
LPSTR
);
/* ################################ */
...
...
@@ -461,6 +463,119 @@ static void test_AddPort(void)
/* ########################### */
static
void
test_AddPortEx
(
void
)
{
PORT_INFO_2A
pi
;
DWORD
res
;
if
(
!
pAddPortExA
)
{
skip
(
"AddPortEx not supported
\n
"
);
return
;
}
/* start test with a clean system */
DeletePortA
(
NULL
,
0
,
tempfileA
);
pi
.
pPortName
=
tempfileA
;
SetLastError
(
0xdeadbeef
);
res
=
pAddPortExA
(
NULL
,
1
,
(
LPBYTE
)
&
pi
,
LocalPortA
);
RETURN_ON_DEACTIVATED_SPOOLER
(
res
)
/* Allowed only for (Printer-)Administrators.
W2K+XP: ERROR_INVALID_PARAMETER */
if
(
!
res
&&
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
))
{
skip
(
"ACCESS_DENIED (ERROR_INVALID_PARAMETER)
\n
"
);
return
;
}
ok
(
res
,
"got %u with %u (expected '!= 0')
\n
"
,
res
,
GetLastError
());
/* Add a port, that already exist */
SetLastError
(
0xdeadbeef
);
res
=
pAddPortExA
(
NULL
,
1
,
(
LPBYTE
)
&
pi
,
LocalPortA
);
ok
(
!
res
&&
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
),
"got %u with %u (expected '0' with ERROR_INVALID_PARAMETER)
\n
"
,
res
,
GetLastError
());
DeletePortA
(
NULL
,
0
,
tempfileA
);
/* the Monitorname must match */
SetLastError
(
0xdeadbeef
);
res
=
pAddPortExA
(
NULL
,
1
,
(
LPBYTE
)
&
pi
,
NULL
);
ok
(
!
res
&&
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
),
"got %u with %u (expected '0' with ERROR_INVALID_PARAMETER)
\n
"
,
res
,
GetLastError
());
if
(
res
)
DeletePortA
(
NULL
,
0
,
tempfileA
);
SetLastError
(
0xdeadbeef
);
res
=
pAddPortExA
(
NULL
,
1
,
(
LPBYTE
)
&
pi
,
empty
);
ok
(
!
res
&&
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
),
"got %u with %u (expected '0' with ERROR_INVALID_PARAMETER)
\n
"
,
res
,
GetLastError
());
if
(
res
)
DeletePortA
(
NULL
,
0
,
tempfileA
);
SetLastError
(
0xdeadbeef
);
res
=
pAddPortExA
(
NULL
,
1
,
(
LPBYTE
)
&
pi
,
does_not_exist
);
ok
(
!
res
&&
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
),
"got %u with %u (expected '0' with ERROR_INVALID_PARAMETER)
\n
"
,
res
,
GetLastError
());
if
(
res
)
DeletePortA
(
NULL
,
0
,
tempfileA
);
/* We need a Portname */
SetLastError
(
0xdeadbeef
);
res
=
pAddPortExA
(
NULL
,
1
,
NULL
,
LocalPortA
);
ok
(
!
res
&&
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
),
"got %u with %u (expected '0' with ERROR_INVALID_PARAMETER)
\n
"
,
res
,
GetLastError
());
pi
.
pPortName
=
NULL
;
SetLastError
(
0xdeadbeef
);
res
=
pAddPortExA
(
NULL
,
1
,
(
LPBYTE
)
&
pi
,
LocalPortA
);
ok
(
!
res
&&
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
),
"got %u with %u (expected '0' with ERROR_INVALID_PARAMETER)
\n
"
,
res
,
GetLastError
());
if
(
res
)
DeletePortA
(
NULL
,
0
,
tempfileA
);
/* level 2 is documented as supported for Printmonitors,
but that is not supported for "Local Port" (localspl.dll) and
AddPortEx fails with ERROR_INVALID_LEVEL */
pi
.
pPortName
=
tempfileA
;
pi
.
pMonitorName
=
LocalPortA
;
pi
.
pDescription
=
winetest
;
pi
.
fPortType
=
PORT_TYPE_WRITE
;
SetLastError
(
0xdeadbeef
);
res
=
pAddPortExA
(
NULL
,
2
,
(
LPBYTE
)
&
pi
,
LocalPortA
);
ok
(
!
res
&&
(
GetLastError
()
==
ERROR_INVALID_LEVEL
),
"got %u with %u (expected '0' with ERROR_INVALID_LEVEL)
\n
"
,
res
,
GetLastError
());
if
(
res
)
DeletePortA
(
NULL
,
0
,
tempfileA
);
/* invalid levels */
SetLastError
(
0xdeadbeef
);
res
=
pAddPortExA
(
NULL
,
0
,
(
LPBYTE
)
&
pi
,
LocalPortA
);
ok
(
!
res
&&
(
GetLastError
()
==
ERROR_INVALID_LEVEL
),
"got %u with %u (expected '0' with ERROR_INVALID_LEVEL)
\n
"
,
res
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
res
=
pAddPortExA
(
NULL
,
3
,
(
LPBYTE
)
&
pi
,
LocalPortA
);
ok
(
!
res
&&
(
GetLastError
()
==
ERROR_INVALID_LEVEL
),
"got %u with %u (expected '0' with ERROR_INVALID_LEVEL)
\n
"
,
res
,
GetLastError
());
/* cleanup */
DeletePortA
(
NULL
,
0
,
tempfileA
);
}
/* ########################### */
static
void
test_ConfigurePort
(
void
)
{
DWORD
res
;
...
...
@@ -2113,6 +2228,7 @@ START_TEST(info)
pGetDefaultPrinterA
=
(
void
*
)
GetProcAddress
(
hwinspool
,
"GetDefaultPrinterA"
);
pSetDefaultPrinterA
=
(
void
*
)
GetProcAddress
(
hwinspool
,
"SetDefaultPrinterA"
);
pXcvDataW
=
(
void
*
)
GetProcAddress
(
hwinspool
,
"XcvDataW"
);
pAddPortExA
=
(
void
*
)
GetProcAddress
(
hwinspool
,
"AddPortExA"
);
find_default_printer
();
find_local_server
();
...
...
@@ -2120,6 +2236,7 @@ START_TEST(info)
test_AddMonitor
();
test_AddPort
();
test_AddPortEx
();
test_ConfigurePort
();
test_DeleteMonitor
();
test_DeletePort
();
...
...
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