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
14c94296
Commit
14c94296
authored
Oct 28, 2001
by
Gerard Patel
Committed by
Alexandre Julliard
Oct 28, 2001
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix RegSetValueEx calls and crash when DriverName="" in registry.
parent
bf1e9682
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
20 deletions
+22
-20
info.c
dlls/winspool/info.c
+22
-20
No files found.
dlls/winspool/info.c
View file @
14c94296
...
...
@@ -285,6 +285,12 @@ PRINTCAP_LoadPrinters(void) {
return
hadprinter
;
}
static
inline
DWORD
set_reg_szW
(
HKEY
hkey
,
WCHAR
*
keyname
,
WCHAR
*
value
)
{
return
RegSetValueExW
(
hkey
,
keyname
,
0
,
REG_SZ
,
(
LPBYTE
)
value
,
lstrlenW
(
value
)
*
sizeof
(
WCHAR
));
}
void
WINSPOOL_LoadSystemPrinters
()
{
HKEY
hkPPD
;
...
...
@@ -916,7 +922,9 @@ static HKEY WINSPOOL_OpenDriverReg( LPVOID pEnvironment, BOOL unicode)
switch
(
ver
.
dwPlatformId
)
{
case
VER_PLATFORM_WIN32s
:
ERR
(
"win32 style printing used with 16 bits app, try -winver win95
\n
"
);
return
0
;
case
VER_PLATFORM_WIN32_NT
:
p
=
"Windows NT x86"
;
break
;
...
...
@@ -1026,8 +1034,7 @@ HANDLE WINAPI AddPrinterW(LPWSTR pName, DWORD Level, LPBYTE pPrinter)
}
RegSetValueExA
(
hkeyPrinter
,
"Attributes"
,
0
,
REG_DWORD
,
(
LPBYTE
)
&
pi
->
Attributes
,
sizeof
(
DWORD
));
RegSetValueExW
(
hkeyPrinter
,
DatatypeW
,
0
,
REG_SZ
,
(
LPBYTE
)
pi
->
pDatatype
,
0
);
set_reg_szW
(
hkeyPrinter
,
DatatypeW
,
pi
->
pDatatype
);
/* See if we can load the driver. We may need the devmode structure anyway
*
...
...
@@ -1065,24 +1072,18 @@ HANDLE WINAPI AddPrinterW(LPWSTR pName, DWORD Level, LPBYTE pPrinter)
HeapFree
(
GetProcessHeap
(),
0
,
dmA
);
if
(
!
pi
->
pDevMode
)
HeapFree
(
GetProcessHeap
(),
0
,
dmW
);
RegSetValueExW
(
hkeyPrinter
,
DescriptionW
,
0
,
REG_SZ
,
(
LPBYTE
)
pi
->
pComment
,
0
);
RegSetValueExW
(
hkeyPrinter
,
LocationW
,
0
,
REG_SZ
,
(
LPBYTE
)
pi
->
pLocation
,
0
);
RegSetValueExW
(
hkeyPrinter
,
NameW
,
0
,
REG_SZ
,
(
LPBYTE
)
pi
->
pPrinterName
,
0
);
RegSetValueExW
(
hkeyPrinter
,
ParametersW
,
0
,
REG_SZ
,
(
LPBYTE
)
pi
->
pParameters
,
0
);
RegSetValueExW
(
hkeyPrinter
,
PortW
,
0
,
REG_SZ
,
(
LPBYTE
)
pi
->
pPortName
,
0
);
RegSetValueExW
(
hkeyPrinter
,
Print_ProcessorW
,
0
,
REG_SZ
,
(
LPBYTE
)
pi
->
pPrintProcessor
,
0
);
RegSetValueExW
(
hkeyPrinter
,
Printer_DriverW
,
0
,
REG_SZ
,
(
LPBYTE
)
pi
->
pDriverName
,
0
);
set_reg_szW
(
hkeyPrinter
,
DescriptionW
,
pi
->
pComment
);
set_reg_szW
(
hkeyPrinter
,
LocationW
,
pi
->
pLocation
);
set_reg_szW
(
hkeyPrinter
,
NameW
,
pi
->
pPrinterName
);
set_reg_szW
(
hkeyPrinter
,
ParametersW
,
pi
->
pParameters
);
set_reg_szW
(
hkeyPrinter
,
PortW
,
pi
->
pPortName
);
set_reg_szW
(
hkeyPrinter
,
Print_ProcessorW
,
pi
->
pPrintProcessor
);
set_reg_szW
(
hkeyPrinter
,
Printer_DriverW
,
pi
->
pDriverName
);
RegSetValueExA
(
hkeyPrinter
,
"Priority"
,
0
,
REG_DWORD
,
(
LPBYTE
)
&
pi
->
Priority
,
sizeof
(
DWORD
));
RegSetValueExW
(
hkeyPrinter
,
Separator_FileW
,
0
,
REG_SZ
,
(
LPBYTE
)
pi
->
pSepFile
,
0
);
RegSetValueExW
(
hkeyPrinter
,
Share_NameW
,
0
,
REG_SZ
,
(
LPBYTE
)
pi
->
pShareName
,
0
);
set_reg_szW
(
hkeyPrinter
,
Separator_FileW
,
pi
->
pSepFile
);
set_reg_szW
(
hkeyPrinter
,
Share_NameW
,
pi
->
pShareName
);
RegSetValueExA
(
hkeyPrinter
,
"StartTime"
,
0
,
REG_DWORD
,
(
LPBYTE
)
&
pi
->
StartTime
,
sizeof
(
DWORD
));
RegSetValueExA
(
hkeyPrinter
,
"Status"
,
0
,
REG_DWORD
,
...
...
@@ -2092,8 +2093,8 @@ static BOOL WINSPOOL_GetDriverInfoFromReg(
strPtr
=
(
pDriverStrings
)
?
(
pDriverStrings
+
(
*
pcbNeeded
))
:
NULL
;
}
if
(
RegOpenKeyW
(
hkeyDrivers
,
DriverName
,
&
hkeyDriver
)
!=
ERROR_SUCCESS
)
{
ERR
(
"Can't find driver
%s
in registry
\n
"
,
debugstr_w
(
DriverName
));
if
(
!
DriverName
[
0
]
||
RegOpenKeyW
(
hkeyDrivers
,
DriverName
,
&
hkeyDriver
)
!=
ERROR_SUCCESS
)
{
ERR
(
"Can't find driver
'%s'
in registry
\n
"
,
debugstr_w
(
DriverName
));
SetLastError
(
ERROR_UNKNOWN_PRINTER_DRIVER
);
/* ? */
return
FALSE
;
}
...
...
@@ -2250,6 +2251,7 @@ static BOOL WINSPOOL_GetPrinterDriver(HANDLE hPrinter, LPWSTR pEnvironment,
return
FALSE
;
}
size
=
sizeof
(
DriverName
);
DriverName
[
0
]
=
0
;
ret
=
RegQueryValueExW
(
hkeyPrinter
,
Printer_DriverW
,
0
,
&
type
,
(
LPBYTE
)
DriverName
,
&
size
);
RegCloseKey
(
hkeyPrinter
);
...
...
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