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
741fa21f
Commit
741fa21f
authored
Mar 09, 2008
by
Detlef Riekenberg
Committed by
Alexandre Julliard
Mar 10, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winspool: Cleanup for DEVMODEdupWtoA.
parent
94a87841
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
24 deletions
+28
-24
info.c
dlls/winspool.drv/info.c
+28
-24
No files found.
dlls/winspool.drv/info.c
View file @
741fa21f
...
...
@@ -1693,36 +1693,40 @@ static LPDEVMODEW DEVMODEcpyAtoW(DEVMODEW *dmW, const DEVMODEA *dmA)
}
/***********************************************************
*
DEVMODEdupWtoA
* Creates an a
scii copy of supplied devmode on heap
* DEVMODEdupWtoA
* Creates an a
nsi copy of supplied devmode
*/
static
LPDEVMODEA
DEVMODEdupWtoA
(
HANDLE
heap
,
const
DEVMODEW
*
dmW
)
static
LPDEVMODEA
DEVMODEdupWtoA
(
const
DEVMODEW
*
dmW
)
{
LPDEVMODEA
dmA
;
DWORD
size
;
BOOL
Formname
;
ptrdiff_t
off_formname
=
(
const
char
*
)
dmW
->
dmFormName
-
(
const
char
*
)
dmW
;
if
(
!
dmW
)
return
NULL
;
Formname
=
(
dmW
->
dmSize
>
off_formname
);
size
=
dmW
->
dmSize
-
CCHDEVICENAME
-
(
Formname
?
CCHFORMNAME
:
0
);
dmA
=
HeapAlloc
(
heap
,
HEAP_ZERO_MEMORY
,
size
+
dmW
->
dmDriverExtra
);
if
(
!
dmW
)
return
NULL
;
size
=
dmW
->
dmSize
-
CCHDEVICENAME
-
((
dmW
->
dmSize
>
FIELD_OFFSET
(
DEVMODEW
,
dmFormName
))
?
CCHFORMNAME
:
0
);
dmA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
+
dmW
->
dmDriverExtra
);
if
(
!
dmA
)
return
NULL
;
WideCharToMultiByte
(
CP_ACP
,
0
,
dmW
->
dmDeviceName
,
-
1
,
(
LPSTR
)
dmA
->
dmDeviceName
,
CCHDEVICENAME
,
NULL
,
NULL
);
if
(
!
Formname
)
{
memcpy
(
&
dmA
->
dmSpecVersion
,
&
dmW
->
dmSpecVersion
,
dmW
->
dmSize
-
CCHDEVICENAME
*
sizeof
(
WCHAR
));
}
else
{
memcpy
(
&
dmA
->
dmSpecVersion
,
&
dmW
->
dmSpecVersion
,
off_formname
-
CCHDEVICENAME
*
sizeof
(
WCHAR
));
WideCharToMultiByte
(
CP_ACP
,
0
,
dmW
->
dmFormName
,
-
1
,
(
LPSTR
)
dmA
->
dmFormName
,
CCHFORMNAME
,
NULL
,
NULL
);
memcpy
(
&
dmA
->
dmLogPixels
,
&
dmW
->
dmLogPixels
,
dmW
->
dmSize
-
(
off_formname
+
CCHFORMNAME
*
sizeof
(
WCHAR
)));
if
(
FIELD_OFFSET
(
DEVMODEW
,
dmFormName
)
>=
dmW
->
dmSize
)
{
memcpy
(
&
dmA
->
dmSpecVersion
,
&
dmW
->
dmSpecVersion
,
dmW
->
dmSize
-
FIELD_OFFSET
(
DEVMODEW
,
dmSpecVersion
));
}
else
{
memcpy
(
&
dmA
->
dmSpecVersion
,
&
dmW
->
dmSpecVersion
,
FIELD_OFFSET
(
DEVMODEW
,
dmFormName
)
-
FIELD_OFFSET
(
DEVMODEW
,
dmSpecVersion
));
WideCharToMultiByte
(
CP_ACP
,
0
,
dmW
->
dmFormName
,
-
1
,
(
LPSTR
)
dmA
->
dmFormName
,
CCHFORMNAME
,
NULL
,
NULL
);
memcpy
(
&
dmA
->
dmLogPixels
,
&
dmW
->
dmLogPixels
,
dmW
->
dmSize
-
FIELD_OFFSET
(
DEVMODEW
,
dmLogPixels
));
}
dmA
->
dmSize
=
size
;
memcpy
((
char
*
)
dmA
+
dmA
->
dmSize
,
(
const
char
*
)
dmW
+
dmW
->
dmSize
,
dmW
->
dmDriverExtra
);
memcpy
((
char
*
)
dmA
+
dmA
->
dmSize
,
(
const
char
*
)
dmW
+
dmW
->
dmSize
,
dmW
->
dmDriverExtra
);
return
dmA
;
}
...
...
@@ -1823,7 +1827,7 @@ INT WINAPI DeviceCapabilitiesW(LPCWSTR pDevice, LPCWSTR pPort,
WORD
fwCapability
,
LPWSTR
pOutput
,
const
DEVMODEW
*
pDevMode
)
{
LPDEVMODEA
dmA
=
DEVMODEdupWtoA
(
GetProcessHeap
(),
pDevMode
);
LPDEVMODEA
dmA
=
DEVMODEdupWtoA
(
pDevMode
);
LPSTR
pDeviceA
=
strdupWtoA
(
pDevice
);
LPSTR
pPortA
=
strdupWtoA
(
pPort
);
INT
ret
;
...
...
@@ -1921,7 +1925,7 @@ LONG WINAPI DocumentPropertiesW(HWND hWnd, HANDLE hPrinter,
{
LPSTR
pDeviceNameA
=
strdupWtoA
(
pDeviceName
);
LPDEVMODEA
pDevModeInputA
=
DEVMODEdupWtoA
(
GetProcessHeap
(),
pDevModeInput
);
LPDEVMODEA
pDevModeInputA
=
DEVMODEdupWtoA
(
pDevModeInput
);
LPDEVMODEA
pDevModeOutputA
=
NULL
;
LONG
ret
;
...
...
@@ -2884,7 +2888,7 @@ HANDLE WINAPI AddPrinterW(LPWSTR pName, DWORD Level, LPBYTE pPrinter)
drivers */
if
(
dmW
)
{
dmA
=
DEVMODEdupWtoA
(
GetProcessHeap
(),
dmW
);
dmA
=
DEVMODEdupWtoA
(
dmW
);
RegSetValueExW
(
hkeyPrinter
,
default_devmodeW
,
0
,
REG_BINARY
,
(
LPBYTE
)
dmA
,
dmA
->
dmSize
+
dmA
->
dmDriverExtra
);
HeapFree
(
GetProcessHeap
(),
0
,
dmA
);
...
...
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