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
289ed3ad
Commit
289ed3ad
authored
Oct 14, 2009
by
Detlef Riekenberg
Committed by
Alexandre Julliard
Oct 15, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winspool/tests: Add tests for EnumPrintProcessors.
parent
353fe2ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
121 additions
and
0 deletions
+121
-0
info.c
dlls/winspool.drv/tests/info.c
+121
-0
No files found.
dlls/winspool.drv/tests/info.c
View file @
289ed3ad
...
...
@@ -1238,6 +1238,126 @@ static void test_EnumPrinterDrivers(void)
/* ########################### */
static
void
test_EnumPrintProcessors
(
void
)
{
DWORD
res
;
LPBYTE
buffer
;
DWORD
cbBuf
;
DWORD
pcbNeeded
;
DWORD
pcReturned
;
cbBuf
=
0xdeadbeef
;
pcReturned
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
res
=
EnumPrintProcessorsA
(
NULL
,
NULL
,
1
,
NULL
,
0
,
&
cbBuf
,
&
pcReturned
);
RETURN_ON_DEACTIVATED_SPOOLER
(
res
)
if
(
res
&&
!
cbBuf
)
{
skip
(
"No Printprocessor installed
\n
"
);
return
;
}
ok
((
!
res
)
&&
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
),
"got %u with %u (expected '0' with ERROR_INSUFFICIENT_BUFFER)
\n
"
,
res
,
GetLastError
());
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
cbBuf
+
4
);
if
(
buffer
==
NULL
)
return
;
SetLastError
(
0xdeadbeef
);
pcbNeeded
=
0xdeadbeef
;
res
=
EnumPrintProcessorsA
(
NULL
,
NULL
,
1
,
buffer
,
cbBuf
,
&
pcbNeeded
,
&
pcReturned
);
ok
(
res
,
"got %u with %u (expected '!=0')
\n
"
,
res
,
GetLastError
());
/* validate the returned Data here. */
SetLastError
(
0xdeadbeef
);
pcReturned
=
0xdeadbeef
;
pcbNeeded
=
0xdeadbeef
;
res
=
EnumPrintProcessorsA
(
NULL
,
NULL
,
1
,
buffer
,
cbBuf
+
1
,
&
pcbNeeded
,
&
pcReturned
);
ok
(
res
,
"got %u with %u (expected '!=0')
\n
"
,
res
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
pcbNeeded
=
0xdeadbeef
;
res
=
EnumPrintProcessorsA
(
NULL
,
NULL
,
1
,
buffer
,
cbBuf
-
1
,
&
pcbNeeded
,
&
pcReturned
);
ok
(
!
res
&&
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
),
"got %u with %u (expected '0' with ERROR_INSUFFICIENT_BUFFER)
\n
"
,
res
,
GetLastError
());
/* only level 1 is valid */
if
(
0
)
{
/* both tests crash on win98se */
SetLastError
(
0xdeadbeef
);
pcbNeeded
=
0xdeadbeef
;
pcReturned
=
0xdeadbeef
;
res
=
EnumPrintProcessorsA
(
NULL
,
NULL
,
0
,
buffer
,
cbBuf
,
&
pcbNeeded
,
&
pcReturned
);
ok
(
!
res
&&
(
GetLastError
()
==
ERROR_INVALID_LEVEL
),
"got %u with %u (expected '0' with ERROR_INVALID_LEVEL)
\n
"
,
res
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
pcbNeeded
=
0xdeadbeef
;
res
=
EnumPrintProcessorsA
(
NULL
,
NULL
,
2
,
buffer
,
cbBuf
,
&
pcbNeeded
,
&
pcReturned
);
ok
(
!
res
&&
(
GetLastError
()
==
ERROR_INVALID_LEVEL
),
"got %u with %u (expected '0' with ERROR_INVALID_LEVEL)
\n
"
,
res
,
GetLastError
());
}
/* an empty environment is ignored */
SetLastError
(
0xdeadbeef
);
pcbNeeded
=
0xdeadbeef
;
res
=
EnumPrintProcessorsA
(
NULL
,
empty
,
1
,
buffer
,
cbBuf
,
&
pcbNeeded
,
&
pcReturned
);
ok
(
res
,
"got %u with %u (expected '!=0')
\n
"
,
res
,
GetLastError
());
/* the environment is checked */
SetLastError
(
0xdeadbeef
);
pcbNeeded
=
0xdeadbeef
;
res
=
EnumPrintProcessorsA
(
NULL
,
invalid_env
,
1
,
buffer
,
cbBuf
,
&
pcbNeeded
,
&
pcReturned
);
/* NT5: ERROR_INVALID_ENVIRONMENT, 9x: ERROR_INVALID_PARAMETER */
ok
(
!
res
&&
((
GetLastError
()
==
ERROR_INVALID_ENVIRONMENT
)
||
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
)),
"got %u with %u (expected '0' with ERROR_INVALID_ENVIRONMENT or "
"ERROR_INVALID_PARAMETER)
\n
"
,
res
,
GetLastError
());
/* failure-Codes for NULL */
if
(
0
)
{
/* this test crash on win98se */
SetLastError
(
0xdeadbeef
);
pcbNeeded
=
0xdeadbeef
;
pcReturned
=
0xdeadbeef
;
res
=
EnumPrintProcessorsA
(
NULL
,
NULL
,
1
,
NULL
,
cbBuf
,
&
pcbNeeded
,
&
pcReturned
);
ok
(
!
res
&&
(
GetLastError
()
==
ERROR_INVALID_USER_BUFFER
)
,
"got %u with %u (expected '0' with ERROR_INVALID_USER_BUFFER)
\n
"
,
res
,
GetLastError
());
}
SetLastError
(
0xdeadbeef
);
pcbNeeded
=
0xdeadbeef
;
pcReturned
=
0xdeadbeef
;
res
=
EnumPrintProcessorsA
(
NULL
,
NULL
,
1
,
buffer
,
cbBuf
,
NULL
,
&
pcReturned
);
/* the NULL is ignored on win9x */
ok
(
broken
(
res
)
||
(
!
res
&&
(
GetLastError
()
==
RPC_X_NULL_REF_POINTER
)),
"got %u with %u (expected '0' with RPC_X_NULL_REF_POINTER)
\n
"
,
res
,
GetLastError
());
pcbNeeded
=
0xdeadbeef
;
pcReturned
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
res
=
EnumPrintProcessorsA
(
NULL
,
NULL
,
1
,
buffer
,
cbBuf
,
&
pcbNeeded
,
NULL
);
/* the NULL is ignored on win9x */
ok
(
broken
(
res
)
||
(
!
res
&&
(
GetLastError
()
==
RPC_X_NULL_REF_POINTER
)),
"got %u with %u (expected '0' with RPC_X_NULL_REF_POINTER)
\n
"
,
res
,
GetLastError
());
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
}
/* ########################### */
static
void
test_GetDefaultPrinter
(
void
)
{
BOOL
retval
;
...
...
@@ -2426,6 +2546,7 @@ START_TEST(info)
test_EnumPorts
();
test_EnumPrinterDrivers
();
test_EnumPrinters
();
test_EnumPrintProcessors
();
test_GetDefaultPrinter
();
test_GetPrinterDriverDirectory
();
test_GetPrintProcessorDirectory
();
...
...
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