Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
c5da6019
Commit
c5da6019
authored
Mar 19, 2007
by
Detlef Riekenberg
Committed by
Alexandre Julliard
Mar 19, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
localspl/tests: Rename hXcv for special tests.
parent
0739ad22
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
41 deletions
+38
-41
localmon.c
dlls/localspl/tests/localmon.c
+38
-41
No files found.
dlls/localspl/tests/localmon.c
View file @
c5da6019
...
...
@@ -65,6 +65,9 @@ static BOOL (WINAPI *pAddPortUI)(PCWSTR, HWND, PCWSTR, PWSTR *);
static
BOOL
(
WINAPI
*
pConfigurePortUI
)(
PCWSTR
,
HWND
,
PCWSTR
);
static
BOOL
(
WINAPI
*
pDeletePortUI
)(
PCWSTR
,
HWND
,
PCWSTR
);
static
HANDLE
hXcv_noaccess
;
/* ########################### */
static
const
WCHAR
cmd_AddPortW
[]
=
{
'A'
,
'd'
,
'd'
,
'P'
,
'o'
,
'r'
,
't'
,
0
};
static
const
WCHAR
cmd_ConfigureLPTPortCommandOKW
[]
=
{
'C'
,
'o'
,
'n'
,
'f'
,
'i'
,
'g'
,
'u'
,
'r'
,
'e'
,
...
...
@@ -345,7 +348,7 @@ static void test_InitializePrintMonitor(void)
static
void
test_XcvClosePort
(
void
)
{
DWORD
res
;
HANDLE
hXcv
;
HANDLE
hXcv
2
;
if
(
0
)
...
...
@@ -357,19 +360,19 @@ static void test_XcvClosePort(void)
SetLastError
(
0xdeadbeef
);
hXcv
=
(
HANDLE
)
0xdeadbeef
;
res
=
pXcvOpenPort
(
emptyW
,
SERVER_ACCESS_ADMINISTER
,
&
hXcv
);
ok
(
res
,
"returned %d with %u and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hXcv
);
hXcv
2
=
(
HANDLE
)
0xdeadbeef
;
res
=
pXcvOpenPort
(
emptyW
,
SERVER_ACCESS_ADMINISTER
,
&
hXcv
2
);
ok
(
res
,
"returned %d with %u and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hXcv
2
);
if
(
res
)
{
SetLastError
(
0xdeadbeef
);
res
=
pXcvClosePort
(
hXcv
);
res
=
pXcvClosePort
(
hXcv
2
);
ok
(
res
,
"returned %d with %u (expected '!= 0')
\n
"
,
res
,
GetLastError
());
if
(
0
)
{
/* test for "Double Free": crash with native localspl.dll (w2k+xp) */
res
=
pXcvClosePort
(
hXcv
);
res
=
pXcvClosePort
(
hXcv
2
);
}
}
}
...
...
@@ -797,22 +800,15 @@ static void test_XcvDataPort_MonitorUI(void)
/* small check without access-rights: */
hXcv
=
(
HANDLE
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
res
=
pXcvOpenPort
(
emptyW
,
0
,
&
hXcv
);
ok
(
res
,
"returned %d with %u and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hXcv
);
if
(
!
res
)
return
;
if
(
!
hXcv_noaccess
)
return
;
/* The ACCESS_MASK is ignored for "MonitorUI" */
memset
(
buffer
,
0
,
len
);
needed
=
(
DWORD
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
res
=
pXcvDataPort
(
hXcv
,
cmd_MonitorUIW
,
NULL
,
0
,
buffer
,
sizeof
(
buffer
),
&
needed
);
res
=
pXcvDataPort
(
hXcv
_noaccess
,
cmd_MonitorUIW
,
NULL
,
0
,
buffer
,
sizeof
(
buffer
),
&
needed
);
ok
(
res
==
ERROR_SUCCESS
,
"returned %d with %u and 0x%x "
"(expected 'ERROR_SUCCESS')
\n
"
,
res
,
GetLastError
(),
needed
);
pXcvClosePort
(
hXcv
);
}
/* ########################### */
...
...
@@ -956,20 +952,14 @@ static void test_XcvDataPort_PortIsValid(void)
/* small check without access-rights: */
hXcv
=
(
HANDLE
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
res
=
pXcvOpenPort
(
emptyW
,
0
,
&
hXcv
);
ok
(
res
,
"returned %d with %u and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hXcv
);
if
(
!
res
)
return
;
if
(
!
hXcv_noaccess
)
return
;
/* The ACCESS_MASK from XcvOpenPort is ignored in "PortIsValid" */
needed
=
(
DWORD
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
res
=
pXcvDataPort
(
hXcv
,
cmd_PortIsValidW
,
(
PBYTE
)
portname_lpt1W
,
sizeof
(
portname_lpt1W
),
NULL
,
0
,
&
needed
);
res
=
pXcvDataPort
(
hXcv
_noaccess
,
cmd_PortIsValidW
,
(
PBYTE
)
portname_lpt1W
,
sizeof
(
portname_lpt1W
),
NULL
,
0
,
&
needed
);
ok
(
res
==
ERROR_SUCCESS
,
"returned %d with %u (expected ERROR_SUCCESS)
\n
"
,
res
,
GetLastError
());
pXcvClosePort
(
hXcv
);
}
/* ########################### */
...
...
@@ -977,45 +967,45 @@ static void test_XcvDataPort_PortIsValid(void)
static
void
test_XcvOpenPort
(
void
)
{
DWORD
res
;
HANDLE
hXcv
;
HANDLE
hXcv
2
;
if
(
0
)
{
/* crash with native localspl.dll (w2k+xp) */
res
=
pXcvOpenPort
(
NULL
,
SERVER_ACCESS_ADMINISTER
,
&
hXcv
);
res
=
pXcvOpenPort
(
NULL
,
SERVER_ACCESS_ADMINISTER
,
&
hXcv
2
);
res
=
pXcvOpenPort
(
emptyW
,
SERVER_ACCESS_ADMINISTER
,
NULL
);
}
/* The returned handle is the result from a previous "spoolss.dll,DllAllocSplMem" */
SetLastError
(
0xdeadbeef
);
hXcv
=
(
HANDLE
)
0xdeadbeef
;
res
=
pXcvOpenPort
(
emptyW
,
SERVER_ACCESS_ADMINISTER
,
&
hXcv
);
ok
(
res
,
"returned %d with %u and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hXcv
);
if
(
res
)
pXcvClosePort
(
hXcv
);
hXcv
2
=
(
HANDLE
)
0xdeadbeef
;
res
=
pXcvOpenPort
(
emptyW
,
SERVER_ACCESS_ADMINISTER
,
&
hXcv
2
);
ok
(
res
,
"returned %d with %u and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hXcv
2
);
if
(
res
)
pXcvClosePort
(
hXcv
2
);
/* The ACCESS_MASK is not checked in XcvOpenPort */
SetLastError
(
0xdeadbeef
);
hXcv
=
(
HANDLE
)
0xdeadbeef
;
res
=
pXcvOpenPort
(
emptyW
,
0
,
&
hXcv
);
ok
(
res
,
"returned %d with %u and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hXcv
);
if
(
res
)
pXcvClosePort
(
hXcv
);
hXcv
2
=
(
HANDLE
)
0xdeadbeef
;
res
=
pXcvOpenPort
(
emptyW
,
0
,
&
hXcv
2
);
ok
(
res
,
"returned %d with %u and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hXcv
2
);
if
(
res
)
pXcvClosePort
(
hXcv
2
);
/* A copy of pszObject is saved in the Memory-Block */
SetLastError
(
0xdeadbeef
);
hXcv
=
(
HANDLE
)
0xdeadbeef
;
res
=
pXcvOpenPort
(
portname_lpt1W
,
SERVER_ALL_ACCESS
,
&
hXcv
);
ok
(
res
,
"returned %d with %u and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hXcv
);
if
(
res
)
pXcvClosePort
(
hXcv
);
hXcv
2
=
(
HANDLE
)
0xdeadbeef
;
res
=
pXcvOpenPort
(
portname_lpt1W
,
SERVER_ALL_ACCESS
,
&
hXcv
2
);
ok
(
res
,
"returned %d with %u and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hXcv
2
);
if
(
res
)
pXcvClosePort
(
hXcv
2
);
SetLastError
(
0xdeadbeef
);
hXcv
=
(
HANDLE
)
0xdeadbeef
;
res
=
pXcvOpenPort
(
portname_fileW
,
SERVER_ALL_ACCESS
,
&
hXcv
);
ok
(
res
,
"returned %d with %u and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hXcv
);
if
(
res
)
pXcvClosePort
(
hXcv
);
hXcv
2
=
(
HANDLE
)
0xdeadbeef
;
res
=
pXcvOpenPort
(
portname_fileW
,
SERVER_ALL_ACCESS
,
&
hXcv
2
);
ok
(
res
,
"returned %d with %u and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hXcv
2
);
if
(
res
)
pXcvClosePort
(
hXcv
2
);
}
...
...
@@ -1084,6 +1074,12 @@ START_TEST(localmon)
GET_MONITOR_FUNC
(
XcvOpenPort
);
GET_MONITOR_FUNC
(
XcvDataPort
);
GET_MONITOR_FUNC
(
XcvClosePort
);
if
((
pXcvOpenPort
)
&&
(
pXcvDataPort
)
&&
(
pXcvClosePort
))
{
SetLastError
(
0xdeadbeef
);
res
=
pXcvOpenPort
(
emptyW
,
0
,
&
hXcv_noaccess
);
ok
(
res
,
"hXcv_noaccess: %d with %u and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hXcv_noaccess
);
}
}
if
((
!
pInitializePrintMonitorUI
)
&&
(
pXcvOpenPort
)
&&
(
pXcvDataPort
)
&&
(
pXcvClosePort
))
{
...
...
@@ -1137,6 +1133,7 @@ START_TEST(localmon)
test_XcvDataPort_PortIsValid
();
test_XcvOpenPort
();
}
if
(
hXcv_noaccess
)
pXcvClosePort
(
hXcv_noaccess
);
/* Cleanup our temporary file */
DeleteFileW
(
tempfileW
);
...
...
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