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
e2f81f1b
Commit
e2f81f1b
authored
Jan 22, 2009
by
Huw Davies
Committed by
Alexandre Julliard
Jan 23, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comdlg32: Simplify the DEVNAMES access functions are unify the release.
parent
2e2a0774
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
38 deletions
+35
-38
printdlg.c
dlls/comdlg32/printdlg.c
+35
-38
No files found.
dlls/comdlg32/printdlg.c
View file @
e2f81f1b
...
...
@@ -2660,59 +2660,56 @@ static void pagesetup_set_defaultsource(pagesetup_data *data, WORD source)
GlobalUnlock
(
data
->
dlga
->
hDevMode
);
}
static
WCHAR
*
pagesetup_get_drvname
(
const
pagesetup_data
*
data
)
typedef
enum
{
DEVNAMES
*
dn
;
int
len
;
WCHAR
*
name
;
devnames_driver_name
,
devnames_device_name
,
devnames_output_name
}
devnames_name
;
dn
=
GlobalLock
(
data
->
dlga
->
hDevNames
);
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
dn
+
dn
->
wDriverOffset
,
-
1
,
NULL
,
0
);
name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
dn
+
dn
->
wDriverOffset
,
-
1
,
name
,
len
);
GlobalUnlock
(
data
->
dlga
->
hDevNames
);
return
name
;
}
static
void
pagesetup_release_drvname
(
const
pagesetup_data
*
data
,
WCHAR
*
name
)
static
inline
WORD
get_devname_offset
(
DEVNAMES
*
dn
,
devnames_name
which
)
{
HeapFree
(
GetProcessHeap
(),
0
,
name
);
switch
(
which
)
{
case
devnames_driver_name
:
return
dn
->
wDriverOffset
;
case
devnames_device_name
:
return
dn
->
wDeviceOffset
;
case
devnames_output_name
:
return
dn
->
wOutputOffset
;
}
ERR
(
"Souldn't be here
\n
"
);
return
0
;
}
static
WCHAR
*
pagesetup_get_
devname
(
const
pagesetup_data
*
data
)
static
WCHAR
*
pagesetup_get_
a_devname
(
const
pagesetup_data
*
data
,
devnames_name
which
)
{
DEVNAMES
*
dn
;
int
len
;
WCHAR
*
name
;
dn
=
GlobalLock
(
data
->
dlga
->
hDevNames
);
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
dn
+
dn
->
wDeviceOffset
,
-
1
,
NULL
,
0
);
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
dn
+
get_devname_offset
(
dn
,
which
)
,
-
1
,
NULL
,
0
);
name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
dn
+
dn
->
wDeviceOffset
,
-
1
,
name
,
len
);
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
dn
+
get_devname_offset
(
dn
,
which
)
,
-
1
,
name
,
len
);
GlobalUnlock
(
data
->
dlga
->
hDevNames
);
return
name
;
}
static
void
pagesetup_release_devname
(
const
pagesetup_data
*
data
,
WCHAR
*
name
)
static
WCHAR
*
pagesetup_get_drvname
(
const
pagesetup_data
*
data
)
{
HeapFree
(
GetProcessHeap
(),
0
,
name
);
return
pagesetup_get_a_devname
(
data
,
devnames_driver_
name
);
}
static
WCHAR
*
pagesetup_get_
port
name
(
const
pagesetup_data
*
data
)
static
WCHAR
*
pagesetup_get_
dev
name
(
const
pagesetup_data
*
data
)
{
DEVNAMES
*
dn
;
int
len
;
WCHAR
*
name
;
return
pagesetup_get_a_devname
(
data
,
devnames_device_name
);
}
dn
=
GlobalLock
(
data
->
dlga
->
hDevNames
);
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
dn
+
dn
->
wOutputOffset
,
-
1
,
NULL
,
0
);
name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
dn
+
dn
->
wOutputOffset
,
-
1
,
name
,
len
);
GlobalUnlock
(
data
->
dlga
->
hDevNames
);
return
name
;
static
WCHAR
*
pagesetup_get_portname
(
const
pagesetup_data
*
data
)
{
return
pagesetup_get_a_devname
(
data
,
devnames_output_name
);
}
static
void
pagesetup_release_
port
name
(
const
pagesetup_data
*
data
,
WCHAR
*
name
)
static
void
pagesetup_release_
a_dev
name
(
const
pagesetup_data
*
data
,
WCHAR
*
name
)
{
HeapFree
(
GetProcessHeap
(),
0
,
name
);
}
...
...
@@ -2860,8 +2857,8 @@ static BOOL pagesetup_update_papersize(pagesetup_data *data)
end:
HeapFree
(
GetProcessHeap
(),
0
,
words
);
HeapFree
(
GetProcessHeap
(),
0
,
points
);
pagesetup_release_
port
name
(
data
,
portname
);
pagesetup_release_devname
(
data
,
devname
);
pagesetup_release_
a_dev
name
(
data
,
portname
);
pagesetup_release_
a_
devname
(
data
,
devname
);
pagesetup_release_devmode
(
data
,
dm
);
return
retval
;
...
...
@@ -2991,8 +2988,8 @@ static void pagesetup_init_combos(HWND hDlg, pagesetup_data *data)
PRINTDLG_SetUpPaperComboBoxW
(
hDlg
,
cmb2
,
devname
,
portname
,
dm
);
PRINTDLG_SetUpPaperComboBoxW
(
hDlg
,
cmb3
,
devname
,
portname
,
dm
);
pagesetup_release_
port
name
(
data
,
portname
);
pagesetup_release_devname
(
data
,
devname
);
pagesetup_release_
a_dev
name
(
data
,
portname
);
pagesetup_release_
a_
devname
(
data
,
devname
);
pagesetup_release_devmode
(
data
,
dm
);
}
...
...
@@ -3020,9 +3017,9 @@ static void pagesetup_change_printer_dialog(HWND hDlg, pagesetup_data *data)
portname
=
pagesetup_get_portname
(
data
);
prnt
.
hDevNames
=
0
;
PRINTDLG_CreateDevNamesW
(
&
prnt
.
hDevNames
,
drvname
,
devname
,
portname
);
pagesetup_release_
port
name
(
data
,
portname
);
pagesetup_release_devname
(
data
,
devname
);
pagesetup_release_
dr
vname
(
data
,
drvname
);
pagesetup_release_
a_dev
name
(
data
,
portname
);
pagesetup_release_
a_
devname
(
data
,
devname
);
pagesetup_release_
a_de
vname
(
data
,
drvname
);
tmp_dm
=
pagesetup_get_devmode
(
data
);
prnt
.
hDevMode
=
GlobalAlloc
(
GMEM_MOVEABLE
,
tmp_dm
->
dmSize
+
tmp_dm
->
dmDriverExtra
);
...
...
@@ -3259,7 +3256,7 @@ static void pagesetup_printer_properties(HWND hDlg, pagesetup_data *data)
if
(
!
OpenPrinterW
(
devname
,
&
hprn
,
NULL
))
{
FIXME
(
"Call to OpenPrinter did not succeed!
\n
"
);
pagesetup_release_devname
(
data
,
devname
);
pagesetup_release_
a_
devname
(
data
,
devname
);
return
;
}
...
...
@@ -3267,7 +3264,7 @@ static void pagesetup_printer_properties(HWND hDlg, pagesetup_data *data)
DocumentPropertiesW
(
hDlg
,
hprn
,
devname
,
dm
,
dm
,
DM_IN_BUFFER
|
DM_OUT_BUFFER
|
DM_IN_PROMPT
);
pagesetup_set_devmode
(
data
,
dm
);
pagesetup_release_devmode
(
data
,
dm
);
pagesetup_release_devname
(
data
,
devname
);
pagesetup_release_
a_
devname
(
data
,
devname
);
ClosePrinter
(
hprn
);
/* Changing paper */
...
...
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