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
ec6062c5
Commit
ec6062c5
authored
May 16, 2023
by
Piotr Caban
Committed by
Alexandre Julliard
May 17, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineps: Introduce wine_driver_open_dc wine specific export used to create printer DC.
Doing it this way avoids passing Unix library pointers throught PE.
parent
a8945280
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
58 additions
and
40 deletions
+58
-40
dc.c
dlls/gdi32/dc.c
+9
-4
dc.c
dlls/win32u/dc.c
+4
-5
init.c
dlls/wineps.drv/init.c
+19
-16
unixlib.c
dlls/wineps.drv/unixlib.c
+17
-8
unixlib.h
dlls/wineps.drv/unixlib.h
+8
-6
wineps.drv.spec
dlls/wineps.drv/wineps.drv.spec
+1
-1
No files found.
dlls/gdi32/dc.c
View file @
ec6062c5
...
...
@@ -42,7 +42,8 @@ static CRITICAL_SECTION_DEBUG critsect_debug =
};
static
CRITICAL_SECTION
driver_section
=
{
&
critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
typedef
const
void
*
(
CDECL
*
driver_entry_point
)(
unsigned
int
version
,
const
WCHAR
*
device
);
typedef
HDC
(
CDECL
*
driver_entry_point
)(
const
WCHAR
*
device
,
const
DEVMODEW
*
devmode
,
const
WCHAR
*
output
);
struct
graphics_driver
{
...
...
@@ -138,7 +139,7 @@ static struct graphics_driver *create_driver( HMODULE module )
driver
->
module
=
module
;
if
(
module
)
driver
->
entry_point
=
(
void
*
)
GetProcAddress
(
module
,
"wine_
get_gdi_driver
"
);
driver
->
entry_point
=
(
void
*
)
GetProcAddress
(
module
,
"wine_
driver_open_dc
"
);
else
driver
->
entry_point
=
NULL
;
...
...
@@ -312,8 +313,12 @@ HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
device_str
.
Buffer
=
(
WCHAR
*
)
device
;
}
ret
=
NtGdiOpenDCW
(
device
||
display
?
&
device_str
:
NULL
,
devmode
,
output
?
&
output_str
:
NULL
,
0
,
is_display
,
entry_point
,
NULL
,
NULL
);
if
(
entry_point
)
ret
=
entry_point
(
device
,
devmode
,
output
);
else
ret
=
NtGdiOpenDCW
(
device
||
display
?
&
device_str
:
NULL
,
devmode
,
output
?
&
output_str
:
NULL
,
0
,
is_display
,
entry_point
,
NULL
,
NULL
);
if
(
ret
&&
hspool
&&
(
dc_attr
=
get_dc_attr
(
ret
)))
{
...
...
dlls/win32u/dc.c
View file @
ec6062c5
...
...
@@ -717,11 +717,10 @@ HDC WINAPI NtGdiOpenDCW( UNICODE_STRING *device, const DEVMODEW *devmode, UNICOD
/* gdi_lock should not be locked */
if
(
is_display
)
funcs
=
get_display_driver
();
else
if
(
hspool
)
{
const
struct
gdi_dc_funcs
*
(
CDECL
*
wine_get_gdi_driver
)(
unsigned
int
,
const
WCHAR
*
)
=
hspool
;
funcs
=
wine_get_gdi_driver
(
WINE_GDI_DRIVER_VERSION
,
device
?
device
->
Buffer
:
NULL
);
}
else
if
(
type
!=
WINE_GDI_DRIVER_VERSION
)
ERR
(
"version mismatch: %u
\n
"
,
(
unsigned
int
)
type
);
else
funcs
=
hspool
;
if
(
!
funcs
)
{
ERR
(
"no driver found
\n
"
);
...
...
dlls/wineps.drv/init.c
View file @
ec6062c5
...
...
@@ -897,24 +897,27 @@ fail:
}
/******************************************************************************
* PSDRV_
get_gdi_driver
* PSDRV_
open_printer_dc
*/
const
struct
gdi_dc_funcs
*
CDECL
PSDRV_get_gdi_driver
(
unsigned
int
version
,
const
WCHAR
*
name
)
HDC
CDECL
PSDRV_open_printer_dc
(
const
WCHAR
*
device
,
const
DEVMODEW
*
devmode
,
const
WCHAR
*
output
)
{
PRINTERINFO
*
pi
=
PSDRV_FindPrinterInfo
(
name
);
struct
init_dc_params
params
;
struct
open_dc_params
params
;
PRINTERINFO
*
pi
;
if
(
!
device
)
return
0
;
pi
=
PSDRV_FindPrinterInfo
(
device
);
if
(
!
pi
)
return
NULL
;
if
(
version
!=
WINE_GDI_DRIVER_VERSION
)
{
ERR
(
"version mismatch, gdi32 wants %u but wineps has %u
\n
"
,
version
,
WINE_GDI_DRIVER_VERSION
);
return
NULL
;
}
params
.
name
=
pi
->
friendly_name
;
params
.
devmode
=
pi
->
Devmode
;
params
.
funcs
=
NULL
;
if
(
!
WINE_UNIX_CALL
(
unix_init_dc
,
&
params
))
return
FALSE
;
return
params
.
funcs
;
return
0
;
params
.
device
=
pi
->
friendly_name
;
params
.
devmode
=
devmode
;
params
.
output
=
output
;
params
.
def_devmode
=
pi
->
Devmode
;
params
.
hdc
=
0
;
if
(
!
WINE_UNIX_CALL
(
unix_open_dc
,
&
params
))
return
0
;
return
params
.
hdc
;
}
dlls/wineps.drv/unixlib.c
View file @
ec6062c5
...
...
@@ -1688,23 +1688,32 @@ static NTSTATUS import_ntf(void *arg)
return
add_ntf_fonts
(
params
->
data
,
params
->
size
);
}
static
NTSTATUS
init
_dc
(
void
*
arg
)
static
NTSTATUS
open
_dc
(
void
*
arg
)
{
struct
init_dc_params
*
params
=
arg
;
UNICODE_STRING
device_str
,
output_str
;
struct
open_dc_params
*
params
=
arg
;
struct
printer_info
*
pi
;
pi
=
find_printer_info
(
params
->
nam
e
);
pi
=
find_printer_info
(
params
->
devic
e
);
if
(
!
pi
)
{
pi
=
malloc
(
sizeof
(
*
pi
));
if
(
!
pi
)
return
FALSE
;
pi
->
name
=
params
->
nam
e
;
pi
->
devmode
=
params
->
devmode
;
pi
->
name
=
params
->
devic
e
;
pi
->
devmode
=
params
->
de
f_de
vmode
;
list_add_head
(
&
printer_info_list
,
&
pi
->
entry
);
}
params
->
funcs
=
&
psdrv_funcs
;
device_str
.
Length
=
device_str
.
MaximumLength
=
lstrlenW
(
params
->
device
)
+
1
;
device_str
.
Buffer
=
(
WCHAR
*
)
params
->
device
;
if
(
params
->
output
)
{
output_str
.
Length
=
output_str
.
MaximumLength
=
lstrlenW
(
params
->
output
)
+
1
;
output_str
.
Buffer
=
(
WCHAR
*
)
params
->
output
;
}
params
->
hdc
=
NtGdiOpenDCW
(
&
device_str
,
params
->
devmode
,
params
->
output
?
&
output_str
:
NULL
,
WINE_GDI_DRIVER_VERSION
,
0
,
(
HANDLE
)
&
psdrv_funcs
,
NULL
,
NULL
);
return
TRUE
;
}
...
...
@@ -1727,9 +1736,9 @@ static NTSTATUS free_printer_info(void *arg)
const
unixlib_entry_t
__wine_unix_call_funcs
[]
=
{
import_ntf
,
init_dc
,
free_printer_info
,
import_ntf
,
open_dc
,
};
C_ASSERT
(
ARRAYSIZE
(
__wine_unix_call_funcs
)
==
unix_funcs_count
);
dlls/wineps.drv/unixlib.h
View file @
ec6062c5
...
...
@@ -74,9 +74,9 @@ struct installed_font
/* Unix calls */
enum
wineps_funcs
{
unix_import_ntf
,
unix_init_dc
,
unix_free_printer_info
,
unix_import_ntf
,
unix_open_dc
,
unix_funcs_count
,
};
...
...
@@ -86,9 +86,11 @@ struct import_ntf_params
int
size
;
};
struct
init
_dc_params
struct
open
_dc_params
{
const
WCHAR
*
name
;
PSDRV_DEVMODE
*
devmode
;
const
struct
gdi_dc_funcs
*
funcs
;
const
WCHAR
*
device
;
const
DEVMODEW
*
devmode
;
const
WCHAR
*
output
;
PSDRV_DEVMODE
*
def_devmode
;
HDC
hdc
;
};
dlls/wineps.drv/wineps.drv.spec
View file @
ec6062c5
@ cdecl wine_
get_gdi_driver(long str) PSDRV_get_gdi_driver
@ cdecl wine_
driver_open_dc(wstr ptr wstr) PSDRV_open_printer_dc
@ stdcall -private DllRegisterServer()
# Printer driver config exports
...
...
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