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
fd37d30a
Commit
fd37d30a
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: Open the default Xcv-channel only once.
parent
c5da6019
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
73 deletions
+13
-73
localmon.c
dlls/localspl/tests/localmon.c
+13
-73
No files found.
dlls/localspl/tests/localmon.c
View file @
fd37d30a
...
...
@@ -65,6 +65,7 @@ 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
;
static
HANDLE
hXcv_noaccess
;
/* ########################### */
...
...
@@ -382,15 +383,8 @@ static void test_XcvClosePort(void)
static
void
test_XcvDataPort_AddPort
(
void
)
{
DWORD
res
;
HANDLE
hXcv
;
hXcv
=
(
HANDLE
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
res
=
pXcvOpenPort
(
emptyW
,
SERVER_ALL_ACCESS
,
&
hXcv
);
ok
(
res
,
"hXcv: %d with %u and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hXcv
);
if
(
!
res
)
return
;
/*
* The following tests crash with native localspl.dll on w2k and xp,
* but it works, when the native dll (w2k and xp) is used in wine.
...
...
@@ -427,7 +421,6 @@ static void test_XcvDataPort_AddPort(void)
res
=
pXcvDataPort
(
hXcv
,
cmd_DeletePortW
,
(
PBYTE
)
tempfileW
,
(
lstrlenW
(
tempfileW
)
+
1
)
*
sizeof
(
WCHAR
),
NULL
,
0
,
NULL
);
}
pXcvClosePort
(
hXcv
);
}
/* ########################### */
...
...
@@ -437,28 +430,19 @@ static void test_XcvDataPort_ConfigureLPTPortCommandOK(void)
CHAR
org_value
[
16
];
CHAR
buffer
[
16
];
HKEY
hroot
=
NULL
;
HANDLE
hXcv
;
DWORD
res
;
DWORD
needed
;
hXcv
=
(
HANDLE
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
res
=
pXcvOpenPort
(
emptyW
,
SERVER_ACCESS_ADMINISTER
,
&
hXcv
);
ok
(
res
,
"hXcv: %d with %u and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hXcv
);
if
(
!
res
)
return
;
/* Read the original value from the registry */
res
=
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
WinNT_CV_WindowsA
,
0
,
KEY_ALL_ACCESS
,
&
hroot
);
if
(
res
==
ERROR_ACCESS_DENIED
)
{
pXcvClosePort
(
hXcv
);
skip
(
"ACCESS_DENIED
\n
"
);
return
;
}
if
(
res
!=
ERROR_SUCCESS
)
{
/* unable to open the registry: skip the test */
pXcvClosePort
(
hXcv
);
skip
(
"got %d
\n
"
,
res
);
return
;
}
...
...
@@ -476,7 +460,6 @@ static void test_XcvDataPort_ConfigureLPTPortCommandOK(void)
SetLastError
(
0xdeadbeef
);
res
=
pXcvDataPort
(
hXcv
,
cmd_ConfigureLPTPortCommandOKW
,
(
PBYTE
)
num_0W
,
sizeof
(
num_0W
),
NULL
,
0
,
&
needed
);
if
(
res
==
ERROR_INVALID_PARAMETER
)
{
pXcvClosePort
(
hXcv
);
skip
(
"'ConfigureLPTPortCommandOK' not supported
\n
"
);
return
;
}
...
...
@@ -533,7 +516,6 @@ static void test_XcvDataPort_ConfigureLPTPortCommandOK(void)
}
RegCloseKey
(
hroot
);
pXcvClosePort
(
hXcv
);
}
...
...
@@ -542,16 +524,9 @@ static void test_XcvDataPort_ConfigureLPTPortCommandOK(void)
static
void
test_XcvDataPort_DeletePort
(
void
)
{
DWORD
res
;
HANDLE
hXcv
;
DWORD
needed
;
hXcv
=
(
HANDLE
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
res
=
pXcvOpenPort
(
emptyW
,
SERVER_ALL_ACCESS
,
&
hXcv
);
ok
(
res
,
"hXcv: %d with %u and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hXcv
);
if
(
!
res
)
return
;
/* cleanup: just to make sure */
needed
=
(
DWORD
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
...
...
@@ -574,7 +549,6 @@ static void test_XcvDataPort_DeletePort(void)
/* emptyW as Portname: ERROR_FILE_NOT_FOUND is returned */
/* NULL as Portname: Native localspl.dll crashed */
pXcvClosePort
(
hXcv
);
}
/* ########################### */
...
...
@@ -583,25 +557,17 @@ static void test_XcvDataPort_GetTransmissionRetryTimeout(void)
{
CHAR
org_value
[
16
];
HKEY
hroot
=
NULL
;
HANDLE
hXcv
;
DWORD
buffer
[
2
];
DWORD
res
;
DWORD
needed
;
DWORD
len
;
hXcv
=
(
HANDLE
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
res
=
pXcvOpenPort
(
emptyW
,
SERVER_ACCESS_ADMINISTER
,
&
hXcv
);
ok
(
res
,
"hXcv: %d with %u and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hXcv
);
if
(
!
res
)
return
;
/* ask for needed size */
needed
=
(
DWORD
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
res
=
pXcvDataPort
(
hXcv
,
cmd_GetTransmissionRetryTimeoutW
,
NULL
,
0
,
NULL
,
0
,
&
needed
);
if
(
res
==
ERROR_INVALID_PARAMETER
)
{
pXcvClosePort
(
hXcv
);
skip
(
"'GetTransmissionRetryTimeout' not supported
\n
"
);
return
;
}
...
...
@@ -614,14 +580,12 @@ static void test_XcvDataPort_GetTransmissionRetryTimeout(void)
/* Read the original value from the registry */
res
=
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
WinNT_CV_WindowsA
,
0
,
KEY_ALL_ACCESS
,
&
hroot
);
if
(
res
==
ERROR_ACCESS_DENIED
)
{
pXcvClosePort
(
hXcv
);
skip
(
"ACCESS_DENIED
\n
"
);
return
;
}
if
(
res
!=
ERROR_SUCCESS
)
{
/* unable to open the registry: skip the test */
pXcvClosePort
(
hXcv
);
skip
(
"got %d
\n
"
,
res
);
return
;
}
...
...
@@ -700,7 +664,6 @@ static void test_XcvDataPort_GetTransmissionRetryTimeout(void)
}
RegCloseKey
(
hroot
);
pXcvClosePort
(
hXcv
);
}
/* ########################### */
...
...
@@ -708,24 +671,16 @@ static void test_XcvDataPort_GetTransmissionRetryTimeout(void)
static
void
test_XcvDataPort_MonitorUI
(
void
)
{
DWORD
res
;
HANDLE
hXcv
;
BYTE
buffer
[
MAX_PATH
+
2
];
DWORD
needed
;
DWORD
len
;
hXcv
=
(
HANDLE
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
res
=
pXcvOpenPort
(
emptyW
,
SERVER_ACCESS_ADMINISTER
,
&
hXcv
);
ok
(
res
,
"returned %d with %u and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hXcv
);
if
(
!
res
)
return
;
/* ask for needed size */
needed
=
(
DWORD
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
res
=
pXcvDataPort
(
hXcv
,
cmd_MonitorUIW
,
NULL
,
0
,
NULL
,
0
,
&
needed
);
if
(
res
==
ERROR_INVALID_PARAMETER
)
{
pXcvClosePort
(
hXcv
);
skip
(
"'MonitorUI' nor supported
\n
"
);
return
;
}
...
...
@@ -734,7 +689,6 @@ static void test_XcvDataPort_MonitorUI(void)
" and '<= MAX_PATH')
\n
"
,
res
,
GetLastError
(),
needed
);
if
(
needed
>
MAX_PATH
)
{
pXcvClosePort
(
hXcv
);
skip
(
"buffer overflow (%u)
\n
"
,
needed
);
return
;
}
...
...
@@ -796,9 +750,6 @@ static void test_XcvDataPort_MonitorUI(void)
"(expected 'ERROR_SUCCESS')
\n
"
,
res
,
GetLastError
(),
needed
);
pXcvClosePort
(
hXcv
);
/* small check without access-rights: */
if
(
!
hXcv_noaccess
)
return
;
...
...
@@ -816,22 +767,13 @@ static void test_XcvDataPort_MonitorUI(void)
static
void
test_XcvDataPort_PortIsValid
(
void
)
{
DWORD
res
;
HANDLE
hXcv
;
DWORD
needed
;
hXcv
=
(
HANDLE
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
res
=
pXcvOpenPort
(
emptyW
,
SERVER_ACCESS_ADMINISTER
,
&
hXcv
);
ok
(
res
,
"hXcv: %d with %u and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hXcv
);
if
(
!
res
)
return
;
/* normal use: "LPT1:" */
needed
=
(
DWORD
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
res
=
pXcvDataPort
(
hXcv
,
cmd_PortIsValidW
,
(
PBYTE
)
portname_lpt1W
,
sizeof
(
portname_lpt1W
),
NULL
,
0
,
&
needed
);
if
(
res
==
ERROR_INVALID_PARAMETER
)
{
pXcvClosePort
(
hXcv
);
skip
(
"'PostIsValid' not supported
\n
"
);
return
;
}
...
...
@@ -948,8 +890,6 @@ static void test_XcvDataPort_PortIsValid(void)
"returned %d with %u and 0x%x (expected ERROR_SUCCESS)
\n
"
,
res
,
GetLastError
(),
needed
);
pXcvClosePort
(
hXcv
);
/* small check without access-rights: */
if
(
!
hXcv_noaccess
)
return
;
...
...
@@ -1077,25 +1017,23 @@ START_TEST(localmon)
if
((
pXcvOpenPort
)
&&
(
pXcvDataPort
)
&&
(
pXcvClosePort
))
{
SetLastError
(
0xdeadbeef
);
res
=
pXcvOpenPort
(
emptyW
,
0
,
&
hXcv
);
ok
(
res
,
"hXcv: %d with %u and %p (expected '!= 0')
\n
"
,
res
,
GetLastError
(),
hXcv
);
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
))
{
if
((
!
pInitializePrintMonitorUI
)
&&
(
hXcv
))
{
/* The user interface for "Local Ports" is in a separate dll since w2k */
BYTE
buffer
[
MAX_PATH
];
DWORD
res
;
DWORD
len
;
HANDLE
hXcv
;
res
=
pXcvOpenPort
(
emptyW
,
SERVER_ACCESS_ADMINISTER
,
&
hXcv
);
if
(
res
)
{
res
=
pXcvDataPort
(
hXcv
,
cmd_MonitorUIW
,
NULL
,
0
,
buffer
,
MAX_PATH
,
&
len
);
if
(
res
==
ERROR_SUCCESS
)
hlocalui
=
LoadLibraryW
(
(
LPWSTR
)
buffer
);
if
(
hlocalui
)
pInitializePrintMonitorUI
=
(
void
*
)
GetProcAddress
(
hlocalui
,
"InitializePrintMonitorUI"
);
pXcvClosePort
(
hXcv
);
}
res
=
pXcvDataPort
(
hXcv
,
cmd_MonitorUIW
,
NULL
,
0
,
buffer
,
MAX_PATH
,
&
len
);
if
(
res
==
ERROR_SUCCESS
)
hlocalui
=
LoadLibraryW
(
(
LPWSTR
)
buffer
);
if
(
hlocalui
)
pInitializePrintMonitorUI
=
(
void
*
)
GetProcAddress
(
hlocalui
,
"InitializePrintMonitorUI"
);
}
if
(
pInitializePrintMonitorUI
)
{
...
...
@@ -1119,7 +1057,7 @@ START_TEST(localmon)
test_ConfigurePort
();
test_DeletePort
();
test_EnumPorts
();
if
(
(
pXcvOpenPort
==
NULL
)
||
(
pXcvDataPort
==
NULL
)
||
(
pXcvClosePort
==
NULL
)
)
{
if
(
!
hXcv
)
{
skip
(
"Xcv not supported
\n
"
);
}
else
...
...
@@ -1132,6 +1070,8 @@ START_TEST(localmon)
test_XcvDataPort_MonitorUI
();
test_XcvDataPort_PortIsValid
();
test_XcvOpenPort
();
pXcvClosePort
(
hXcv
);
}
if
(
hXcv_noaccess
)
pXcvClosePort
(
hXcv_noaccess
);
...
...
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