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
3a910c7d
Commit
3a910c7d
authored
Aug 12, 2003
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Aug 12, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert CreateDC to unicode in the driver interface.
parent
06e34ffc
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
184 additions
and
82 deletions
+184
-82
driver.c
dlls/gdi/driver.c
+78
-17
gdi32.spec
dlls/gdi/gdi32.spec
+1
-0
dc.c
dlls/ttydrv/dc.c
+4
-4
init.c
dlls/wineps/init.c
+52
-8
Makefile.in
dlls/winspool/Makefile.in
+1
-1
info.c
dlls/winspool/info.c
+7
-26
init.c
graphics/x11drv/init.c
+2
-2
gdi.h
include/gdi.h
+3
-3
wingdi.h
include/wingdi.h
+1
-0
dc.c
objects/dc.c
+35
-21
No files found.
dlls/gdi/driver.c
View file @
3a910c7d
...
...
@@ -26,6 +26,7 @@
#include "winreg.h"
#include "gdi.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
driver
);
...
...
@@ -232,22 +233,23 @@ static struct graphics_driver *load_display_driver(void)
/**********************************************************************
* DRIVER_load_driver
*/
const
DC_FUNCTIONS
*
DRIVER_load_driver
(
LPCSTR
name
)
const
DC_FUNCTIONS
*
DRIVER_load_driver
(
LPC
W
STR
name
)
{
HMODULE
module
;
struct
graphics_driver
*
driver
;
static
const
WCHAR
displayW
[]
=
{
'd'
,
'i'
,
's'
,
'p'
,
'l'
,
'a'
,
'y'
,
0
};
EnterCriticalSection
(
&
driver_section
);
/* display driver is a special case */
if
(
!
strc
asecmp
(
name
,
"display"
))
if
(
!
strc
mpiW
(
name
,
displayW
))
{
driver
=
load_display_driver
();
LeaveCriticalSection
(
&
driver_section
);
return
&
driver
->
funcs
;
}
if
((
module
=
GetModuleHandle
A
(
name
)))
if
((
module
=
GetModuleHandle
W
(
name
)))
{
for
(
driver
=
first_driver
;
driver
;
driver
=
driver
->
next
)
{
...
...
@@ -260,7 +262,7 @@ const DC_FUNCTIONS *DRIVER_load_driver( LPCSTR name )
}
}
if
(
!
(
module
=
LoadLibrary
A
(
name
)))
if
(
!
(
module
=
LoadLibrary
W
(
name
)))
{
LeaveCriticalSection
(
&
driver_section
);
return
NULL
;
...
...
@@ -273,7 +275,7 @@ const DC_FUNCTIONS *DRIVER_load_driver( LPCSTR name )
return
NULL
;
}
TRACE
(
"loaded driver %p for %s
\n
"
,
driver
,
name
);
TRACE
(
"loaded driver %p for %s
\n
"
,
driver
,
debugstr_w
(
name
)
);
LeaveCriticalSection
(
&
driver_section
);
return
&
driver
->
funcs
;
}
...
...
@@ -332,33 +334,74 @@ void DRIVER_release_driver( const DC_FUNCTIONS *funcs )
* DRIVER_GetDriverName
*
*/
BOOL
DRIVER_GetDriverName
(
LPC
STR
device
,
LP
STR
driver
,
DWORD
size
)
BOOL
DRIVER_GetDriverName
(
LPC
WSTR
device
,
LPW
STR
driver
,
DWORD
size
)
{
char
*
p
;
static
const
WCHAR
displayW
[]
=
{
'd'
,
'i'
,
's'
,
'p'
,
'l'
,
'a'
,
'y'
,
0
};
static
const
WCHAR
devicesW
[]
=
{
'd'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
's'
,
0
};
static
const
WCHAR
empty_strW
[]
=
{
0
};
WCHAR
*
p
;
/* display is a special case */
if
(
!
strc
asecmp
(
device
,
"display"
))
if
(
!
strc
mpiW
(
device
,
displayW
))
{
lstrcpyn
A
(
driver
,
"display"
,
size
);
lstrcpyn
W
(
driver
,
displayW
,
size
);
return
TRUE
;
}
size
=
GetProfileString
A
(
"devices"
,
device
,
""
,
driver
,
size
);
size
=
GetProfileString
W
(
devicesW
,
device
,
empty_strW
,
driver
,
size
);
if
(
!
size
)
{
WARN
(
"Unable to find
'%s' in [devices] section of win.ini
\n
"
,
device
);
WARN
(
"Unable to find
%s in [devices] section of win.ini
\n
"
,
debugstr_w
(
device
)
);
return
FALSE
;
}
p
=
strchr
(
driver
,
','
);
p
=
strchr
W
(
driver
,
','
);
if
(
!
p
)
{
WARN
(
"
'%s' entry in [devices] section of win.ini is malformed.
\n
"
,
device
);
WARN
(
"
%s entry in [devices] section of win.ini is malformed.
\n
"
,
debugstr_w
(
device
)
);
return
FALSE
;
}
*
p
=
'\0'
;
TRACE
(
"Found
'%s' for '%s'
\n
"
,
driver
,
device
);
*
p
=
0
;
TRACE
(
"Found
%s for %s
\n
"
,
debugstr_w
(
driver
),
debugstr_w
(
device
)
);
return
TRUE
;
}
/***********************************************************************
* GdiConvertToDevmodeW (GDI32.@)
*/
DEVMODEW
*
WINAPI
GdiConvertToDevmodeW
(
const
DEVMODEA
*
dmA
)
{
DEVMODEW
*
dmW
;
WORD
dmW_size
;
dmW_size
=
dmA
->
dmSize
+
CCHDEVICENAME
;
if
(
dmA
->
dmSize
>=
(
char
*
)
dmA
->
dmFormName
-
(
char
*
)
dmA
+
CCHFORMNAME
)
dmW_size
+=
CCHFORMNAME
;
dmW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dmW_size
+
dmA
->
dmDriverExtra
);
if
(
!
dmW
)
return
NULL
;
MultiByteToWideChar
(
CP_ACP
,
0
,
dmA
->
dmDeviceName
,
CCHDEVICENAME
,
dmW
->
dmDeviceName
,
CCHDEVICENAME
);
/* copy slightly more, to avoid long computations */
memcpy
(
&
dmW
->
dmSpecVersion
,
&
dmA
->
dmSpecVersion
,
dmA
->
dmSize
-
CCHDEVICENAME
);
if
(
dmA
->
dmSize
>=
(
char
*
)
dmA
->
dmFormName
-
(
char
*
)
dmA
+
CCHFORMNAME
)
{
MultiByteToWideChar
(
CP_ACP
,
0
,
dmA
->
dmFormName
,
CCHFORMNAME
,
dmW
->
dmFormName
,
CCHFORMNAME
);
if
(
dmA
->
dmSize
>
(
char
*
)
&
dmA
->
dmLogPixels
-
(
char
*
)
dmA
)
memcpy
(
&
dmW
->
dmLogPixels
,
&
dmA
->
dmLogPixels
,
dmA
->
dmSize
-
((
char
*
)
&
dmA
->
dmLogPixels
-
(
char
*
)
dmA
));
}
if
(
dmA
->
dmDriverExtra
)
memcpy
((
char
*
)
dmW
+
dmW_size
,
(
char
*
)
dmA
+
dmA
->
dmSize
,
dmA
->
dmDriverExtra
);
dmW
->
dmSize
=
dmW_size
;
return
dmW
;
}
/*****************************************************************************
* @ [GDI32.100]
*
...
...
@@ -400,12 +443,16 @@ INT WINAPI GDI_CallExtDeviceModePropSheet16( HWND hWnd, LPCSTR lpszDevice,
*
* This should load the correct driver for lpszDevice and calls this driver's
* ExtDeviceMode proc.
*
* FIXME: convert ExtDeviceMode to unicode in the driver interface
*/
INT
WINAPI
GDI_CallExtDeviceMode16
(
HWND
hwnd
,
LPDEVMODEA
lpdmOutput
,
LPSTR
lpszDevice
,
LPSTR
lpszPort
,
LPDEVMODEA
lpdmInput
,
LPSTR
lpszProfile
,
DWORD
fwMode
)
{
WCHAR
deviceW
[
300
];
WCHAR
bufW
[
300
];
char
buf
[
300
];
HDC
hdc
;
DC
*
dc
;
...
...
@@ -415,7 +462,12 @@ INT WINAPI GDI_CallExtDeviceMode16( HWND hwnd,
TRACE
(
"(%p, %p, %s, %s, %p, %s, %ld)
\n
"
,
hwnd
,
lpdmOutput
,
lpszDevice
,
lpszPort
,
lpdmInput
,
lpszProfile
,
fwMode
);
if
(
!
DRIVER_GetDriverName
(
lpszDevice
,
buf
,
sizeof
(
buf
)
))
return
-
1
;
if
(
!
lpszDevice
)
return
-
1
;
if
(
!
MultiByteToWideChar
(
CP_ACP
,
0
,
lpszDevice
,
-
1
,
deviceW
,
300
))
return
-
1
;
if
(
!
DRIVER_GetDriverName
(
deviceW
,
bufW
,
300
))
return
-
1
;
if
(
!
WideCharToMultiByte
(
CP_ACP
,
0
,
bufW
,
-
1
,
buf
,
300
,
NULL
,
NULL
))
return
-
1
;
if
(
!
(
hdc
=
CreateICA
(
buf
,
lpszDevice
,
lpszPort
,
NULL
)))
return
-
1
;
...
...
@@ -449,11 +501,15 @@ INT WINAPI GDI_CallAdvancedSetupDialog16( HWND hwnd, LPSTR lpszDevice,
*
* This should load the correct driver for lpszDevice and calls this driver's
* DeviceCapabilities proc.
*
* FIXME: convert DeviceCapabilities to unicode in the driver interface
*/
DWORD
WINAPI
GDI_CallDeviceCapabilities16
(
LPCSTR
lpszDevice
,
LPCSTR
lpszPort
,
WORD
fwCapability
,
LPSTR
lpszOutput
,
LPDEVMODEA
lpdm
)
{
WCHAR
deviceW
[
300
];
WCHAR
bufW
[
300
];
char
buf
[
300
];
HDC
hdc
;
DC
*
dc
;
...
...
@@ -461,7 +517,12 @@ DWORD WINAPI GDI_CallDeviceCapabilities16( LPCSTR lpszDevice, LPCSTR lpszPort,
TRACE
(
"(%s, %s, %d, %p, %p)
\n
"
,
lpszDevice
,
lpszPort
,
fwCapability
,
lpszOutput
,
lpdm
);
if
(
!
DRIVER_GetDriverName
(
lpszDevice
,
buf
,
sizeof
(
buf
)
))
return
-
1
;
if
(
!
lpszDevice
)
return
-
1
;
if
(
!
MultiByteToWideChar
(
CP_ACP
,
0
,
lpszDevice
,
-
1
,
deviceW
,
300
))
return
-
1
;
if
(
!
DRIVER_GetDriverName
(
deviceW
,
bufW
,
300
))
return
-
1
;
if
(
!
WideCharToMultiByte
(
CP_ACP
,
0
,
bufW
,
-
1
,
buf
,
300
,
NULL
,
NULL
))
return
-
1
;
if
(
!
(
hdc
=
CreateICA
(
buf
,
lpszDevice
,
lpszPort
,
NULL
)))
return
-
1
;
...
...
dlls/gdi/gdi32.spec
View file @
3a910c7d
...
...
@@ -130,6 +130,7 @@
@ stub GdiConvertMetaFilePict
@ stub GdiConvertPalette
@ stub GdiConvertRegion
@ stdcall GdiConvertToDevmodeW(ptr)
@ stub GdiCreateLocalBitmap
@ stub GdiCreateLocalBrush
@ stub GdiCreateLocalEnhMetaFile
...
...
dlls/ttydrv/dc.c
View file @
3a910c7d
...
...
@@ -39,14 +39,14 @@ BOOL TTYDRV_GDI_Initialize(void)
/***********************************************************************
* TTYDRV_DC_CreateDC
*/
BOOL
TTYDRV_DC_CreateDC
(
DC
*
dc
,
TTYDRV_PDEVICE
**
pdev
,
LPC
STR
driver
,
LPC
STR
device
,
LPC
STR
output
,
const
DEVMODEA
*
initData
)
BOOL
TTYDRV_DC_CreateDC
(
DC
*
dc
,
TTYDRV_PDEVICE
**
pdev
,
LPC
WSTR
driver
,
LPCW
STR
device
,
LPC
WSTR
output
,
const
DEVMODEW
*
initData
)
{
TTYDRV_PDEVICE
*
physDev
;
TRACE
(
"(%p, %s, %s, %s, %p)
\n
"
,
dc
,
debugstr_
a
(
driver
),
debugstr_a
(
device
),
debugstr_
a
(
output
),
initData
);
dc
,
debugstr_
w
(
driver
),
debugstr_w
(
device
),
debugstr_
w
(
output
),
initData
);
physDev
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
TTYDRV_PDEVICE
));
if
(
!
physDev
)
{
...
...
dlls/wineps/init.c
View file @
3a910c7d
...
...
@@ -35,6 +35,7 @@
#include "winreg.h"
#include "winspool.h"
#include "winerror.h"
#include "heap.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
psdrv
);
...
...
@@ -251,14 +252,53 @@ static void PSDRV_UpdateDevCaps( PSDRV_PDEVICE *physDev )
}
/***********************************************************
* DEVMODEdupWtoA
*
* Creates an ascii copy of supplied devmode on heap
*
* Copied from dlls/winspool/info.c until full unicodification
*/
static
LPDEVMODEA
DEVMODEdupWtoA
(
HANDLE
heap
,
const
DEVMODEW
*
dmW
)
{
LPDEVMODEA
dmA
;
DWORD
size
;
BOOL
Formname
;
ptrdiff_t
off_formname
=
(
char
*
)
dmW
->
dmFormName
-
(
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
);
WideCharToMultiByte
(
CP_ACP
,
0
,
dmW
->
dmDeviceName
,
-
1
,
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
,
dmA
->
dmFormName
,
CCHFORMNAME
,
NULL
,
NULL
);
memcpy
(
&
dmA
->
dmLogPixels
,
&
dmW
->
dmLogPixels
,
dmW
->
dmSize
-
(
off_formname
+
CCHFORMNAME
*
sizeof
(
WCHAR
)));
}
dmA
->
dmSize
=
size
;
memcpy
((
char
*
)
dmA
+
dmA
->
dmSize
,
(
char
*
)
dmW
+
dmW
->
dmSize
,
dmW
->
dmDriverExtra
);
return
dmA
;
}
/**********************************************************************
* PSDRV_CreateDC
*/
BOOL
PSDRV_CreateDC
(
DC
*
dc
,
PSDRV_PDEVICE
**
pdev
,
LPC
STR
driver
,
LPC
STR
device
,
LPC
STR
output
,
const
DEVMODEA
*
initData
)
BOOL
PSDRV_CreateDC
(
DC
*
dc
,
PSDRV_PDEVICE
**
pdev
,
LPC
WSTR
driver
,
LPCW
STR
device
,
LPC
WSTR
output
,
const
DEVMODEW
*
initData
)
{
PSDRV_PDEVICE
*
physDev
;
PRINTERINFO
*
pi
;
char
deviceA
[
CCHDEVICENAME
];
/* If no device name was specified, retrieve the device name
* from the DEVMODE structure from the DC's physDev.
...
...
@@ -266,11 +306,14 @@ BOOL PSDRV_CreateDC( DC *dc, PSDRV_PDEVICE **pdev, LPCSTR driver, LPCSTR device,
if
(
!
device
&&
*
pdev
)
{
physDev
=
*
pdev
;
device
=
physDev
->
Devmode
->
dmPublic
.
dmDeviceName
;
strcpy
(
deviceA
,
physDev
->
Devmode
->
dmPublic
.
dmDeviceName
)
;
}
pi
=
PSDRV_FindPrinterInfo
(
device
);
else
WideCharToMultiByte
(
CP_ACP
,
0
,
device
,
-
1
,
deviceA
,
sizeof
(
deviceA
),
NULL
,
NULL
);
pi
=
PSDRV_FindPrinterInfo
(
deviceA
);
TRACE
(
"(%s %s %s %p)
\n
"
,
driver
,
device
,
output
,
initData
);
TRACE
(
"(%s %s %s %p)
\n
"
,
debugstr_w
(
driver
),
debugstr_w
(
device
),
debugstr_w
(
output
),
initData
);
if
(
!
pi
)
return
FALSE
;
...
...
@@ -301,14 +344,15 @@ BOOL PSDRV_CreateDC( DC *dc, PSDRV_PDEVICE **pdev, LPCSTR driver, LPCSTR device,
physDev
->
logPixelsY
=
physDev
->
pi
->
ppd
->
DefaultResolution
;
if
(
output
)
{
physDev
->
job
.
output
=
HeapAlloc
(
PSDRV_Heap
,
0
,
strlen
(
output
)
+
1
);
strcpy
(
physDev
->
job
.
output
,
output
);
physDev
->
job
.
output
=
HEAP_strdupWtoA
(
PSDRV_Heap
,
0
,
output
);
}
else
physDev
->
job
.
output
=
NULL
;
physDev
->
job
.
hJob
=
0
;
if
(
initData
)
{
PSDRV_MergeDevmodes
(
physDev
->
Devmode
,
(
PSDRV_DEVMODEA
*
)
initData
,
pi
);
DEVMODEA
*
devmodeA
=
DEVMODEdupWtoA
(
PSDRV_Heap
,
initData
);
PSDRV_MergeDevmodes
(
physDev
->
Devmode
,
(
PSDRV_DEVMODEA
*
)
devmodeA
,
pi
);
HeapFree
(
PSDRV_Heap
,
0
,
devmodeA
);
}
PSDRV_UpdateDevCaps
(
physDev
);
...
...
dlls/winspool/Makefile.in
View file @
3a910c7d
...
...
@@ -4,7 +4,7 @@ TOPOBJDIR = ../..
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
MODULE
=
winspool.drv
IMPORTS
=
user32 advapi32 kernel32 ntdll
IMPORTS
=
user32
gdi32
advapi32 kernel32 ntdll
LDDLLFLAGS
=
@LDDLLFLAGS@
SYMBOLFILE
=
$(MODULE)
.tmp.o
...
...
dlls/winspool/info.c
View file @
3a910c7d
...
...
@@ -516,27 +516,6 @@ static LPDEVMODEW DEVMODEcpyAtoW(DEVMODEW *dmW, const DEVMODEA *dmA)
}
/***********************************************************
* DEVMODEdupAtoW
* Creates a unicode copy of supplied devmode on heap
*/
static
LPDEVMODEW
DEVMODEdupAtoW
(
HANDLE
heap
,
const
DEVMODEA
*
dmA
)
{
LPDEVMODEW
dmW
;
DWORD
size
;
BOOL
Formname
;
ptrdiff_t
off_formname
;
TRACE
(
"
\n
"
);
if
(
!
dmA
)
return
NULL
;
off_formname
=
(
char
*
)
dmA
->
dmFormName
-
(
char
*
)
dmA
;
Formname
=
(
dmA
->
dmSize
>
off_formname
);
size
=
dmA
->
dmSize
+
CCHDEVICENAME
+
(
Formname
?
CCHFORMNAME
:
0
);
dmW
=
HeapAlloc
(
heap
,
HEAP_ZERO_MEMORY
,
size
+
dmA
->
dmDriverExtra
);
return
DEVMODEcpyAtoW
(
dmW
,
dmA
);
}
/***********************************************************
* DEVMODEdupWtoA
* Creates an ascii copy of supplied devmode on heap
*/
...
...
@@ -590,7 +569,7 @@ static LPPRINTER_INFO_2W PRINTER_INFO_2AtoW(HANDLE heap, LPPRINTER_INFO_2A piA)
piW
->
pDriverName
=
asciitounicode
(
&
usBuffer
,
piA
->
pDriverName
);
piW
->
pComment
=
asciitounicode
(
&
usBuffer
,
piA
->
pComment
);
piW
->
pLocation
=
asciitounicode
(
&
usBuffer
,
piA
->
pLocation
);
piW
->
pDevMode
=
DEVMODEdupAtoW
(
heap
,
piA
->
pDevMode
);
piW
->
pDevMode
=
GdiConvertToDevmodeW
(
piA
->
pDevMode
);
piW
->
pSepFile
=
asciitounicode
(
&
usBuffer
,
piA
->
pSepFile
);
piW
->
pPrintProcessor
=
asciitounicode
(
&
usBuffer
,
piA
->
pPrintProcessor
);
piW
->
pDatatype
=
asciitounicode
(
&
usBuffer
,
piA
->
pDatatype
);
...
...
@@ -711,6 +690,7 @@ INT WINAPI DeviceCapabilitiesW(LPCWSTR pDevice, LPCWSTR pPort,
/******************************************************************
* DocumentPropertiesA [WINSPOOL.@]
*
* FIXME: implement DocumentPropertiesA via DocumentPropertiesW, not vice versa
*/
LONG
WINAPI
DocumentPropertiesA
(
HWND
hWnd
,
HANDLE
hPrinter
,
LPSTR
pDeviceName
,
LPDEVMODEA
pDevModeOutput
,
...
...
@@ -752,6 +732,8 @@ LONG WINAPI DocumentPropertiesA(HWND hWnd,HANDLE hPrinter,
/*****************************************************************************
* DocumentPropertiesW (WINSPOOL.@)
*
* FIXME: implement DocumentPropertiesA via DocumentPropertiesW, not vice versa
*/
LONG
WINAPI
DocumentPropertiesW
(
HWND
hWnd
,
HANDLE
hPrinter
,
LPWSTR
pDeviceName
,
...
...
@@ -802,8 +784,7 @@ BOOL WINAPI OpenPrinterA(LPSTR lpPrinterName,HANDLE *phPrinter,
if
(
pDefault
)
{
DefaultW
.
pDatatype
=
asciitounicode
(
&
usBuffer
,
pDefault
->
pDatatype
);
DefaultW
.
pDevMode
=
DEVMODEdupAtoW
(
GetProcessHeap
(),
pDefault
->
pDevMode
);
DefaultW
.
pDevMode
=
GdiConvertToDevmodeW
(
pDefault
->
pDevMode
);
DefaultW
.
DesiredAccess
=
pDefault
->
DesiredAccess
;
pDefaultW
=
&
DefaultW
;
}
...
...
@@ -1565,7 +1546,7 @@ static void WINSPOOL_GetDefaultDevMode(
if
(
unicode
)
{
if
(
buflen
>=
sizeof
(
DEVMODEW
))
{
DEVMODEW
*
pdmW
=
DEVMODEdupAtoW
(
GetProcessHeap
(),
&
dm
);
DEVMODEW
*
pdmW
=
GdiConvertToDevmodeW
(
&
dm
);
memcpy
(
ptr
,
pdmW
,
sizeof
(
DEVMODEW
));
HeapFree
(
GetProcessHeap
(),
0
,
pdmW
);
}
...
...
@@ -1608,7 +1589,7 @@ static BOOL WINSPOOL_GetDevModeFromReg(HKEY hkey, LPCWSTR ValueName,
if
(
unicode
)
{
sz
+=
(
CCHDEVICENAME
+
CCHFORMNAME
);
if
(
buflen
>=
sz
)
{
DEVMODEW
*
dmW
=
DEVMODEdupAtoW
(
GetProcessHeap
(),
(
DEVMODEA
*
)
ptr
);
DEVMODEW
*
dmW
=
GdiConvertToDevmodeW
(
(
DEVMODEA
*
)
ptr
);
memcpy
(
ptr
,
dmW
,
sz
);
HeapFree
(
GetProcessHeap
(),
0
,
dmW
);
}
...
...
graphics/x11drv/init.c
View file @
3a910c7d
...
...
@@ -87,8 +87,8 @@ void X11DRV_GDI_Finalize(void)
/**********************************************************************
* X11DRV_CreateDC
*/
BOOL
X11DRV_CreateDC
(
DC
*
dc
,
X11DRV_PDEVICE
**
pdev
,
LPC
STR
driver
,
LPC
STR
device
,
LPC
STR
output
,
const
DEVMODEA
*
initData
)
BOOL
X11DRV_CreateDC
(
DC
*
dc
,
X11DRV_PDEVICE
**
pdev
,
LPC
WSTR
driver
,
LPCW
STR
device
,
LPC
WSTR
output
,
const
DEVMODEW
*
initData
)
{
X11DRV_PDEVICE
*
physDev
;
...
...
include/gdi.h
View file @
3a910c7d
...
...
@@ -181,7 +181,7 @@ typedef struct tagDC_FUNCS
BOOL
(
*
pChord
)(
PHYSDEV
,
INT
,
INT
,
INT
,
INT
,
INT
,
INT
,
INT
,
INT
);
BOOL
(
*
pCloseFigure
)(
PHYSDEV
);
BOOL
(
*
pCreateBitmap
)(
PHYSDEV
,
HBITMAP
);
BOOL
(
*
pCreateDC
)(
DC
*
,
PHYSDEV
*
,
LPC
STR
,
LPCSTR
,
LPCSTR
,
const
DEVMODEA
*
);
BOOL
(
*
pCreateDC
)(
DC
*
,
PHYSDEV
*
,
LPC
WSTR
,
LPCWSTR
,
LPCWSTR
,
const
DEVMODEW
*
);
HBITMAP
(
*
pCreateDIBSection
)(
PHYSDEV
,
BITMAPINFO
*
,
UINT
,
LPVOID
*
,
HANDLE
,
DWORD
,
DWORD
);
BOOL
(
*
pDeleteBitmap
)(
HBITMAP
);
BOOL
(
*
pDeleteDC
)(
PHYSDEV
);
...
...
@@ -451,10 +451,10 @@ extern void *GDI_GetObjPtr( HGDIOBJ, WORD );
extern
void
GDI_ReleaseObj
(
HGDIOBJ
);
extern
void
GDI_CheckNotLock
(
void
);
extern
const
DC_FUNCTIONS
*
DRIVER_load_driver
(
LPCSTR
name
);
extern
const
DC_FUNCTIONS
*
DRIVER_load_driver
(
LPC
W
STR
name
);
extern
const
DC_FUNCTIONS
*
DRIVER_get_driver
(
const
DC_FUNCTIONS
*
funcs
);
extern
void
DRIVER_release_driver
(
const
DC_FUNCTIONS
*
funcs
);
extern
BOOL
DRIVER_GetDriverName
(
LPC
STR
device
,
LP
STR
driver
,
DWORD
size
);
extern
BOOL
DRIVER_GetDriverName
(
LPC
WSTR
device
,
LPW
STR
driver
,
DWORD
size
);
extern
POINT
*
GDI_Bezier
(
const
POINT
*
Points
,
INT
count
,
INT
*
nPtsOut
);
...
...
include/wingdi.h
View file @
3a910c7d
...
...
@@ -3228,6 +3228,7 @@ BOOL WINAPI FlattenPath(HDC);
BOOL
WINAPI
FloodFill
(
HDC
,
INT
,
INT
,
COLORREF
);
BOOL
WINAPI
FrameRgn
(
HDC
,
HRGN
,
HBRUSH
,
INT
,
INT
);
BOOL
WINAPI
GdiComment
(
HDC
,
UINT
,
const
BYTE
*
);
DEVMODEW
*
WINAPI
GdiConvertToDevmodeW
(
const
DEVMODEA
*
);
BOOL
WINAPI
GdiFlush
(
void
);
INT
WINAPI
GetArcDirection
(
HDC
);
BOOL
WINAPI
GetAspectRatioFilterEx
(
HDC
,
LPSIZE
);
...
...
objects/dc.c
View file @
3a910c7d
...
...
@@ -24,11 +24,13 @@
#include <string.h>
#include "windef.h"
#include "wingdi.h"
#include "winternl.h"
#include "winerror.h"
#include "wownt32.h"
#include "wine/winuser16.h"
#include "gdi.h"
#include "heap.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
dc
);
...
...
@@ -565,27 +567,27 @@ BOOL WINAPI RestoreDC( HDC hdc, INT level )
/***********************************************************************
* CreateDC
A
(GDI32.@)
* CreateDC
W
(GDI32.@)
*/
HDC
WINAPI
CreateDC
A
(
LPCSTR
driver
,
LPCSTR
device
,
LPC
STR
output
,
const
DEVMODEA
*
initData
)
HDC
WINAPI
CreateDC
W
(
LPCWSTR
driver
,
LPCWSTR
device
,
LPCW
STR
output
,
const
DEVMODEW
*
initData
)
{
HDC
hdc
;
DC
*
dc
;
const
DC_FUNCTIONS
*
funcs
;
char
buf
[
300
];
WCHAR
buf
[
300
];
GDI_CheckNotLock
();
if
(
!
device
||
!
DRIVER_GetDriverName
(
device
,
buf
,
sizeof
(
buf
)
))
if
(
!
device
||
!
DRIVER_GetDriverName
(
device
,
buf
,
300
))
{
if
(
!
driver
)
return
0
;
strcpy
(
buf
,
driver
);
strcpy
W
(
buf
,
driver
);
}
if
(
!
(
funcs
=
DRIVER_load_driver
(
buf
)))
{
ERR
(
"no driver found for %s
\n
"
,
buf
);
ERR
(
"no driver found for %s
\n
"
,
debugstr_w
(
buf
)
);
return
0
;
}
if
(
!
(
dc
=
DC_AllocDC
(
funcs
,
DC_MAGIC
)))
...
...
@@ -597,7 +599,7 @@ HDC WINAPI CreateDCA( LPCSTR driver, LPCSTR device, LPCSTR output,
dc
->
hBitmap
=
GetStockObject
(
DEFAULT_BITMAP
);
TRACE
(
"(driver=%s, device=%s, output=%s): returning %p
\n
"
,
debugstr_
a
(
driver
),
debugstr_a
(
device
),
debugstr_a
(
output
),
dc
->
hSelf
);
debugstr_
w
(
driver
),
debugstr_w
(
device
),
debugstr_w
(
output
),
dc
->
hSelf
);
if
(
dc
->
funcs
->
pCreateDC
&&
!
dc
->
funcs
->
pCreateDC
(
dc
,
&
dc
->
physDev
,
buf
,
device
,
output
,
initData
))
...
...
@@ -622,20 +624,31 @@ HDC WINAPI CreateDCA( LPCSTR driver, LPCSTR device, LPCSTR output,
/***********************************************************************
* CreateDC
W
(GDI32.@)
* CreateDC
A
(GDI32.@)
*/
HDC
WINAPI
CreateDC
W
(
LPCWSTR
driver
,
LPCWSTR
device
,
LPCW
STR
output
,
const
DEVMODEW
*
initData
)
HDC
WINAPI
CreateDC
A
(
LPCSTR
driver
,
LPCSTR
device
,
LPC
STR
output
,
const
DEVMODEA
*
initData
)
{
LPSTR
driverA
=
HEAP_strdupWtoA
(
GetProcessHeap
(),
0
,
driver
);
LPSTR
deviceA
=
HEAP_strdupWtoA
(
GetProcessHeap
(),
0
,
device
);
LPSTR
outputA
=
HEAP_strdupWtoA
(
GetProcessHeap
(),
0
,
output
);
HDC
res
=
CreateDCA
(
driverA
,
deviceA
,
outputA
,
(
const
DEVMODEA
*
)
initData
/*FIXME*/
);
HeapFree
(
GetProcessHeap
(),
0
,
driverA
);
HeapFree
(
GetProcessHeap
(),
0
,
deviceA
);
HeapFree
(
GetProcessHeap
(),
0
,
outputA
);
return
res
;
UNICODE_STRING
driverW
,
deviceW
,
outputW
;
HDC
ret
;
if
(
driver
)
RtlCreateUnicodeStringFromAsciiz
(
&
driverW
,
driver
);
else
driverW
.
Buffer
=
NULL
;
if
(
device
)
RtlCreateUnicodeStringFromAsciiz
(
&
deviceW
,
device
);
else
deviceW
.
Buffer
=
NULL
;
if
(
output
)
RtlCreateUnicodeStringFromAsciiz
(
&
outputW
,
output
);
else
outputW
.
Buffer
=
NULL
;
ret
=
CreateDCW
(
driverW
.
Buffer
,
deviceW
.
Buffer
,
outputW
.
Buffer
,
(
const
DEVMODEW
*
)
initData
/*FIXME*/
);
RtlFreeUnicodeString
(
&
driverW
);
RtlFreeUnicodeString
(
&
deviceW
);
RtlFreeUnicodeString
(
&
outputW
);
return
ret
;
}
...
...
@@ -681,7 +694,8 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
}
else
{
funcs
=
DRIVER_load_driver
(
"DISPLAY"
);
static
const
WCHAR
displayW
[]
=
{
'd'
,
'i'
,
's'
,
'p'
,
'l'
,
'a'
,
'y'
,
0
};
funcs
=
DRIVER_load_driver
(
displayW
);
physDev
=
NULL
;
}
...
...
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