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
a01ba785
Commit
a01ba785
authored
Mar 24, 2009
by
Hans Leidekker
Committed by
Alexandre Julliard
Mar 24, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winspool: Support special environment value "all" in EnumPrinterDrivers.
A custom action in the sp1 installer passes this value.
parent
86af8769
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
14 deletions
+73
-14
info.c
dlls/winspool.drv/info.c
+54
-14
info.c
dlls/winspool.drv/tests/info.c
+19
-0
No files found.
dlls/winspool.drv/info.c
View file @
a01ba785
...
...
@@ -267,6 +267,12 @@ static const DWORD pi_sizeof[] = {0, sizeof(PRINTER_INFO_1W), sizeof(PRINTER_INF
sizeof
(
PRINTER_INFO_7W
),
sizeof
(
PRINTER_INFO_8W
),
sizeof
(
PRINTER_INFO_9W
)};
static
const
printenv_t
env_x64
=
{
envname_x64W
,
subdir_x64W
,
3
,
Version3_RegPathW
,
Version3_SubdirW
};
static
const
printenv_t
env_x86
=
{
envname_x86W
,
subdir_x86W
,
3
,
Version3_RegPathW
,
Version3_SubdirW
};
static
const
printenv_t
env_win40
=
{
envname_win40W
,
subdir_win40W
,
0
,
Version0_RegPathW
,
Version0_SubdirW
};
static
const
printenv_t
*
const
all_printenv
[]
=
{
&
env_x86
,
&
env_x64
,
&
env_win40
};
/******************************************************************
* validate the user-supplied printing-environment [internal]
*
...
...
@@ -285,15 +291,6 @@ static const DWORD pi_sizeof[] = {0, sizeof(PRINTER_INFO_1W), sizeof(PRINTER_INF
static
const
printenv_t
*
validate_envW
(
LPCWSTR
env
)
{
static
const
printenv_t
env_x64
=
{
envname_x64W
,
subdir_x64W
,
3
,
Version3_RegPathW
,
Version3_SubdirW
};
static
const
printenv_t
env_x86
=
{
envname_x86W
,
subdir_x86W
,
3
,
Version3_RegPathW
,
Version3_SubdirW
};
static
const
printenv_t
env_win40
=
{
envname_win40W
,
subdir_win40W
,
0
,
Version0_RegPathW
,
Version0_SubdirW
};
static
const
printenv_t
*
const
all_printenv
[]
=
{
&
env_x86
,
&
env_x64
,
&
env_win40
};
const
printenv_t
*
result
=
NULL
;
unsigned
int
i
;
...
...
@@ -5169,7 +5166,7 @@ static BOOL WINSPOOL_EnumPrinterDrivers(LPWSTR pName, LPCWSTR pEnvironment,
RegCloseKey
(
hkeyDrivers
);
return
FALSE
;
}
(
*
pcbNeeded
)
+=
needed
;
*
pcbNeeded
+=
needed
;
}
RegCloseKey
(
hkeyDrivers
);
...
...
@@ -5192,6 +5189,29 @@ BOOL WINAPI EnumPrinterDriversW(LPWSTR pName, LPWSTR pEnvironment, DWORD Level,
LPBYTE
pDriverInfo
,
DWORD
cbBuf
,
LPDWORD
pcbNeeded
,
LPDWORD
pcReturned
)
{
static
const
WCHAR
allW
[]
=
{
'a'
,
'l'
,
'l'
,
0
};
if
(
pEnvironment
&&
!
strcmpW
(
pEnvironment
,
allW
))
{
BOOL
ret
;
DWORD
i
,
needed
,
returned
,
bufsize
=
cbBuf
;
for
(
i
=
0
;
i
<
sizeof
(
all_printenv
)
/
sizeof
(
all_printenv
[
0
]);
i
++
)
{
needed
=
returned
=
0
;
ret
=
WINSPOOL_EnumPrinterDrivers
(
pName
,
all_printenv
[
i
]
->
envname
,
Level
,
pDriverInfo
,
bufsize
,
&
needed
,
&
returned
,
TRUE
);
if
(
!
ret
&&
GetLastError
()
!=
ERROR_INSUFFICIENT_BUFFER
)
return
FALSE
;
else
if
(
ret
)
{
bufsize
-=
needed
;
if
(
pDriverInfo
)
pDriverInfo
+=
needed
;
if
(
pcReturned
)
*
pcReturned
+=
returned
;
}
if
(
pcbNeeded
)
*
pcbNeeded
+=
needed
;
}
return
ret
;
}
return
WINSPOOL_EnumPrinterDrivers
(
pName
,
pEnvironment
,
Level
,
pDriverInfo
,
cbBuf
,
pcbNeeded
,
pcReturned
,
TRUE
);
}
...
...
@@ -5204,16 +5224,36 @@ BOOL WINAPI EnumPrinterDriversW(LPWSTR pName, LPWSTR pEnvironment, DWORD Level,
BOOL
WINAPI
EnumPrinterDriversA
(
LPSTR
pName
,
LPSTR
pEnvironment
,
DWORD
Level
,
LPBYTE
pDriverInfo
,
DWORD
cbBuf
,
LPDWORD
pcbNeeded
,
LPDWORD
pcReturned
)
{
BOOL
ret
;
{
BOOL
ret
;
UNICODE_STRING
pNameW
,
pEnvironmentW
;
PWSTR
pwstrNameW
,
pwstrEnvironmentW
;
pwstrNameW
=
asciitounicode
(
&
pNameW
,
pName
);
pwstrEnvironmentW
=
asciitounicode
(
&
pEnvironmentW
,
pEnvironment
);
ret
=
WINSPOOL_EnumPrinterDrivers
(
pwstrNameW
,
pwstrEnvironmentW
,
Level
,
pDriverInfo
,
cbBuf
,
pcbNeeded
,
pcReturned
,
FALSE
);
if
(
pEnvironment
&&
!
strcmp
(
pEnvironment
,
"all"
))
{
DWORD
i
,
needed
,
returned
,
bufsize
=
cbBuf
;
for
(
i
=
0
;
i
<
sizeof
(
all_printenv
)
/
sizeof
(
all_printenv
[
0
]);
i
++
)
{
needed
=
returned
=
0
;
ret
=
WINSPOOL_EnumPrinterDrivers
(
pwstrNameW
,
all_printenv
[
i
]
->
envname
,
Level
,
pDriverInfo
,
bufsize
,
&
needed
,
&
returned
,
FALSE
);
if
(
!
ret
&&
GetLastError
()
!=
ERROR_INSUFFICIENT_BUFFER
)
break
;
else
if
(
ret
)
{
bufsize
-=
needed
;
if
(
pDriverInfo
)
pDriverInfo
+=
needed
;
if
(
pcReturned
)
*
pcReturned
+=
returned
;
}
if
(
pcbNeeded
)
*
pcbNeeded
+=
needed
;
}
}
else
ret
=
WINSPOOL_EnumPrinterDrivers
(
pwstrNameW
,
pwstrEnvironmentW
,
Level
,
pDriverInfo
,
cbBuf
,
pcbNeeded
,
pcReturned
,
FALSE
);
RtlFreeUnicodeString
(
&
pNameW
);
RtlFreeUnicodeString
(
&
pEnvironmentW
);
...
...
dlls/winspool.drv/tests/info.c
View file @
a01ba785
...
...
@@ -1107,6 +1107,8 @@ static void test_EnumPorts(void)
static
void
test_EnumPrinterDrivers
(
void
)
{
static
char
env_all
[]
=
"all"
;
DWORD
res
;
LPBYTE
buffer
;
DWORD
cbBuf
;
...
...
@@ -1210,6 +1212,23 @@ static void test_EnumPrinterDrivers(void)
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
}
/* for(level ... */
pcbNeeded
=
0
;
pcReturned
=
0
;
SetLastError
(
0xdeadbeef
);
res
=
EnumPrinterDriversA
(
NULL
,
env_all
,
1
,
NULL
,
0
,
&
pcbNeeded
,
&
pcReturned
);
if
(
res
)
{
skip
(
"no printer drivers found
\n
"
);
return
;
}
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"unexpected error %u
\n
"
,
GetLastError
());
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
pcbNeeded
);
res
=
EnumPrinterDriversA
(
NULL
,
env_all
,
1
,
buffer
,
pcbNeeded
,
&
pcbNeeded
,
&
pcReturned
);
ok
(
res
,
"EnumPrinterDriversA failed %u
\n
"
,
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