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
5db76ad2
Commit
5db76ad2
authored
Dec 02, 2022
by
Piotr Caban
Committed by
Alexandre Julliard
Dec 06, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
localspl: Load printer datatype and print processor information on init.
parent
6a3c382d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
15 deletions
+50
-15
provider.c
dlls/localspl/provider.c
+50
-15
No files found.
dlls/localspl/provider.c
View file @
5db76ad2
...
...
@@ -234,6 +234,8 @@ typedef struct {
LONG
ref
;
WCHAR
*
port
;
WCHAR
*
print_proc
;
WCHAR
*
datatype
;
CRITICAL_SECTION
jobs_cs
;
struct
list
jobs
;
...
...
@@ -521,13 +523,32 @@ static printer_info_t *find_printer_info(const WCHAR *name, unsigned int len)
return
NULL
;
}
static
WCHAR
*
reg_query_value
(
HKEY
key
,
const
WCHAR
*
name
)
{
DWORD
size
,
type
;
WCHAR
*
ret
;
if
(
RegQueryValueExW
(
key
,
name
,
0
,
&
type
,
NULL
,
&
size
)
!=
ERROR_SUCCESS
||
type
!=
REG_SZ
)
return
NULL
;
ret
=
malloc
(
size
);
if
(
!
ret
)
return
NULL
;
if
(
RegQueryValueExW
(
key
,
name
,
0
,
NULL
,
(
BYTE
*
)
ret
,
&
size
)
!=
ERROR_SUCCESS
)
{
free
(
ret
);
return
NULL
;
}
return
ret
;
}
static
printer_info_t
*
get_printer_info
(
const
WCHAR
*
name
)
{
HKEY
hkey
,
hprinter
=
NULL
;
printer_info_t
*
info
;
WCHAR
port
[
MAX_PATH
];
LSTATUS
ret
;
DWORD
size
;
EnterCriticalSection
(
&
printers_cs
);
info
=
find_printer_info
(
name
,
-
1
);
...
...
@@ -541,32 +562,44 @@ static printer_info_t* get_printer_info(const WCHAR *name)
if
(
ret
==
ERROR_SUCCESS
)
ret
=
RegOpenKeyW
(
hkey
,
name
,
&
hprinter
);
RegCloseKey
(
hkey
);
size
=
sizeof
(
port
);
if
(
ret
==
ERROR_SUCCESS
)
ret
=
RegQueryValueExW
(
hprinter
,
L"Port"
,
0
,
NULL
,
(
BYTE
*
)
port
,
&
size
);
RegCloseKey
(
hprinter
);
if
(
ret
!=
ERROR_SUCCESS
)
{
LeaveCriticalSection
(
&
printers_cs
);
return
NULL
;
}
i
f
((
info
=
calloc
(
1
,
sizeof
(
*
info
)))
&&
(
info
->
name
=
wcsdup
(
name
))
&&
(
info
->
port
=
wcsdup
(
port
))
)
i
nfo
=
calloc
(
1
,
sizeof
(
*
info
));
if
(
!
info
)
{
info
->
ref
=
1
;
list_add_head
(
&
printers
,
&
info
->
entry
);
InitializeCriticalSection
(
&
info
->
jobs_cs
);
list_init
(
&
info
->
jobs
);
LeaveCriticalSection
(
&
printers_cs
);
RegCloseKey
(
hprinter
);
return
NULL
;
}
else
if
(
info
)
info
->
name
=
wcsdup
(
name
);
info
->
port
=
reg_query_value
(
hprinter
,
L"Port"
);
info
->
print_proc
=
reg_query_value
(
hprinter
,
L"Print Processor"
);
info
->
datatype
=
reg_query_value
(
hprinter
,
L"Datatype"
);
RegCloseKey
(
hprinter
);
if
(
!
info
->
name
||
!
info
->
port
||
!
info
->
print_proc
||
!
info
->
datatype
)
{
free
(
info
->
name
);
free
(
info
->
port
);
free
(
info
->
print_proc
);
free
(
info
->
datatype
);
free
(
info
);
info
=
NULL
;
LeaveCriticalSection
(
&
printers_cs
);
return
NULL
;
}
LeaveCriticalSection
(
&
printers_cs
);
info
->
ref
=
1
;
list_add_head
(
&
printers
,
&
info
->
entry
);
InitializeCriticalSection
(
&
info
->
jobs_cs
);
list_init
(
&
info
->
jobs
);
LeaveCriticalSection
(
&
printers_cs
);
return
info
;
}
...
...
@@ -594,6 +627,8 @@ static void release_printer_info(printer_info_t *info)
free
(
info
->
name
);
free
(
info
->
port
);
free
(
info
->
print_proc
);
free
(
info
->
datatype
);
DeleteCriticalSection
(
&
info
->
jobs_cs
);
while
(
!
list_empty
(
&
info
->
jobs
))
{
...
...
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