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
388aca4b
Commit
388aca4b
authored
Oct 16, 2009
by
Detlef Riekenberg
Committed by
Alexandre Julliard
Oct 16, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winspool: Use the backend for GetPrintProcessorDirectory and update the tests.
parent
065599a4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
63 deletions
+38
-63
info.c
dlls/winspool.drv/info.c
+8
-43
info.c
dlls/winspool.drv/tests/info.c
+30
-20
No files found.
dlls/winspool.drv/info.c
View file @
388aca4b
...
...
@@ -175,8 +175,6 @@ static const WCHAR Version3_RegPathW[] = {'\\','V','e','r','s','i','o','n','-','
static
const
WCHAR
Version3_SubdirW
[]
=
{
'\\'
,
'3'
,
0
};
static
const
WCHAR
spooldriversW
[]
=
{
'\\'
,
's'
,
'p'
,
'o'
,
'o'
,
'l'
,
'\\'
,
'd'
,
'r'
,
'i'
,
'v'
,
'e'
,
'r'
,
's'
,
'\\'
,
0
};
static
const
WCHAR
spoolprtprocsW
[]
=
{
'\\'
,
's'
,
'p'
,
'o'
,
'o'
,
'l'
,
'\\'
,
'p'
,
'r'
,
't'
,
'p'
,
'r'
,
'o'
,
'c'
,
's'
,
'\\'
,
0
};
static
const
WCHAR
backslashW
[]
=
{
'\\'
,
0
};
static
const
WCHAR
Configuration_FileW
[]
=
{
'C'
,
'o'
,
'n'
,
'f'
,
'i'
,
'g'
,
'u'
,
'r'
,
'a'
,
't'
,
'i'
,
'o'
,
'n'
,
' '
,
'F'
,
'i'
,
'l'
,
'e'
,
0
};
...
...
@@ -2162,58 +2160,25 @@ BOOL WINAPI GetPrintProcessorDirectoryW(LPWSTR server, LPWSTR env,
DWORD
level
,
LPBYTE
Info
,
DWORD
cbBuf
,
LPDWORD
pcbNeeded
)
{
DWORD
needed
;
const
printenv_t
*
env_t
;
TRACE
(
"(%s, %s, %d, %p, %d, %p)
\n
"
,
debugstr_w
(
server
),
debugstr_w
(
env
),
level
,
Info
,
cbBuf
,
pcbNeeded
);
if
(
server
!=
NULL
&&
server
[
0
])
{
FIXME
(
"server not supported: %s
\n
"
,
debugstr_w
(
server
));
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
TRACE
(
"(%s, %s, %d, %p, %d, %p)
\n
"
,
debugstr_w
(
server
),
debugstr_w
(
env
),
level
,
Info
,
cbBuf
,
pcbNeeded
);
env_t
=
validate_envW
(
env
);
if
(
!
env_t
)
return
FALSE
;
/* environment invalid or unsupported */
if
((
backend
==
NULL
)
&&
!
load_backend
())
return
FALSE
;
if
(
level
!=
1
)
{
WARN
(
"(Level: %d) is ignored in win9x
\n
"
,
level
);
if
(
level
!=
1
)
{
/* (Level != 1) is ignored in win9x */
SetLastError
(
ERROR_INVALID_LEVEL
);
return
FALSE
;
}
/* GetSystemDirectoryW returns number of WCHAR including the '\0' */
needed
=
GetSystemDirectoryW
(
NULL
,
0
);
/* add the Size for the Subdirectories */
needed
+=
lstrlenW
(
spoolprtprocsW
);
needed
+=
lstrlenW
(
env_t
->
subdir
);
needed
*=
sizeof
(
WCHAR
);
/* return-value is size in Bytes */
if
(
pcbNeeded
)
*
pcbNeeded
=
needed
;
TRACE
(
"required: 0x%x/%d
\n
"
,
needed
,
needed
);
if
(
needed
>
cbBuf
)
{
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
return
FALSE
;
}
if
(
pcbNeeded
==
NULL
)
{
/* NT: RPC_X_NULL_REF_POINTER, 9x: ignored */
WARN
(
"(pcbNeeded == NULL) is ignored in win9x
\n
"
);
SetLastError
(
RPC_X_NULL_REF_POINTER
);
return
FALSE
;
}
if
(
Info
==
NULL
)
{
/* NT: RPC_X_NULL_REF_POINTER, 9x: ERROR_INVALID_PARAMETER */
if
(
pcbNeeded
==
NULL
)
{
/* (pcbNeeded == NULL) is ignored in win9x */
SetLastError
(
RPC_X_NULL_REF_POINTER
);
return
FALSE
;
}
GetSystemDirectoryW
((
LPWSTR
)
Info
,
cbBuf
/
sizeof
(
WCHAR
));
/* add the Subdirectories */
lstrcatW
((
LPWSTR
)
Info
,
spoolprtprocsW
);
lstrcatW
((
LPWSTR
)
Info
,
env_t
->
subdir
);
TRACE
(
" => %s
\n
"
,
debugstr_w
((
LPWSTR
)
Info
));
return
TRUE
;
return
backend
->
fpGetPrintProcessorDirectory
(
server
,
env
,
level
,
Info
,
cbBuf
,
pcbNeeded
);
}
/*****************************************************************************
...
...
dlls/winspool.drv/tests/info.c
View file @
388aca4b
...
...
@@ -50,7 +50,7 @@ static CHAR LocalPortA[] = "Local Port";
static
CHAR
portname_com1
[]
=
"COM1:"
;
static
CHAR
portname_file
[]
=
"FILE:"
;
static
CHAR
portname_lpt1
[]
=
"LPT1:"
;
static
CHAR
server_does_not_exist
[]
=
"
\\
does_not_exist"
;
static
CHAR
server_does_not_exist
[]
=
"
\\
\\
does_not_exist"
;
static
CHAR
version_dll
[]
=
"version.dll"
;
static
CHAR
winetest
[]
=
"winetest"
;
static
CHAR
xcv_localport
[]
=
",XcvMonitor Local Port"
;
...
...
@@ -1628,41 +1628,49 @@ static void test_GetPrintProcessorDirectory(void)
pcbNeeded
=
0
;
SetLastError
(
0xdeadbeef
);
res
=
GetPrintProcessorDirectoryA
(
NULL
,
NULL
,
1
,
NULL
,
cbBuf
,
&
pcbNeeded
);
/* NT: ERROR_INVALID_USER_BUFFER, 9x: res != 0 */
ok
(
(
!
res
&&
(
GetLastError
()
==
ERROR_INVALID_USER_BUFFER
))
||
broken
(
res
),
"returned %d with %d (expected '0' with ERROR_INVALID_USER_BUFFER)
\n
"
,
res
,
GetLastError
());
}
buffer
[
0
]
=
'\0'
;
SetLastError
(
0xdeadbeef
);
res
=
GetPrintProcessorDirectoryA
(
NULL
,
NULL
,
1
,
buffer
,
cbBuf
,
NULL
);
/* NT: RPC_X_NULL_REF_POINTER, 9x: res != 0 */
ok
(
res
||
(
GetLastError
()
==
RPC_X_NULL_REF_POINTER
),
"returned %d with %d (expected '!= 0' or '0' with "
"
RPC_X_NULL_REF_POINTER)
\n
"
,
res
,
GetLastError
());
ok
(
(
!
res
&&
(
GetLastError
()
==
RPC_X_NULL_REF_POINTER
))
||
broken
(
res
),
"
returned %d with %d (expected '0' with RPC_X_NULL_REF_POINTER)
\n
"
,
res
,
GetLastError
());
buffer
[
0
]
=
'\0'
;
SetLastError
(
0xdeadbeef
);
res
=
GetPrintProcessorDirectoryA
(
NULL
,
NULL
,
1
,
NULL
,
cbBuf
,
NULL
);
/* NT: RPC_X_NULL_REF_POINTER, 9x: res != 0 */
ok
(
res
||
(
GetLastError
()
==
RPC_X_NULL_REF_POINTER
),
"returned %d with %d (expected '!= 0' or '0' with "
"
RPC_X_NULL_REF_POINTER)
\n
"
,
res
,
GetLastError
());
ok
(
(
!
res
&&
(
GetLastError
()
==
RPC_X_NULL_REF_POINTER
))
||
broken
(
res
),
"
returned %d with %d (expected '0' with RPC_X_NULL_REF_POINTER)
\n
"
,
res
,
GetLastError
());
/* with a valid buffer, but level is invalid */
buffer
[
0
]
=
'\0'
;
SetLastError
(
0xdeadbeef
);
res
=
GetPrintProcessorDirectoryA
(
NULL
,
NULL
,
0
,
buffer
,
cbBuf
,
&
pcbNeeded
);
/* Level is ignored in win9x*/
ok
(
(
!
res
&&
(
GetLastError
()
==
ERROR_INVALID_LEVEL
))
||
broken
(
res
&&
buffer
[
0
]),
"returned %d with %d (expected '0' with ERROR_INVALID_LEVEL)
\n
"
,
res
,
GetLastError
());
buffer
[
0
]
=
'\0'
;
SetLastError
(
0xdeadbeef
);
res
=
GetPrintProcessorDirectoryA
(
NULL
,
NULL
,
2
,
buffer
,
cbBuf
,
&
pcbNeeded
);
if
(
res
&&
buffer
[
0
])
{
/* Level is ignored in win9x*/
trace
(
"invalid level (2) was ignored
\n
"
);
}
else
{
ok
(
!
res
&&
(
GetLastError
()
==
ERROR_INVALID_LEVEL
),
ok
(
(
!
res
&&
(
GetLastError
()
==
ERROR_INVALID_LEVEL
))
||
broken
(
res
&&
buffer
[
0
]),
"returned %d with %d (expected '0' with ERROR_INVALID_LEVEL)
\n
"
,
res
,
GetLastError
());
}
/* Empty environment is the same as the default environment */
buffer
[
0
]
=
'\0'
;
...
...
@@ -1703,9 +1711,11 @@ static void test_GetPrintProcessorDirectory(void)
buffer
[
0
]
=
'\0'
;
SetLastError
(
0xdeadbeef
);
res
=
GetPrintProcessorDirectoryA
(
server_does_not_exist
,
NULL
,
1
,
buffer
,
cbBuf
*
2
,
&
pcbNeeded
);
ok
(
!
res
&&
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
),
"returned %d with %d (expected '0' with ERROR_INVALID_PARAMETER)
\n
"
,
res
,
GetLastError
());
/* NT: RPC_S_SERVER_UNAVAILABLE, 9x: ERROR_INVALID_PARAMETER */
ok
(
!
res
&&
(
GetLastError
()
==
RPC_S_SERVER_UNAVAILABLE
||
GetLastError
()
==
ERROR_INVALID_PARAMETER
),
"returned %d with %d (expected '0' with RPC_S_SERVER_UNAVAILABLE or "
"ERROR_INVALID_PARAMETER)
\n
"
,
res
,
GetLastError
());
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
}
...
...
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