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
e0ca118f
Commit
e0ca118f
authored
Sep 02, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prntvpt: Use CRT allocation functions.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
d19814cb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
27 deletions
+15
-27
main.c
dlls/prntvpt/main.c
+6
-17
ticket.c
dlls/prntvpt/ticket.c
+9
-10
No files found.
dlls/prntvpt/main.c
View file @
e0ca118f
...
...
@@ -26,26 +26,15 @@
#include "winspool.h"
#include "objbase.h"
#include "prntvpt.h"
#include "wine/heap.h"
#include "wine/debug.h"
#include "prntvpt_private.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
prntvpt
);
static
WCHAR
*
heap_strdupW
(
const
WCHAR
*
src
)
{
WCHAR
*
dst
;
size_t
len
;
if
(
!
src
)
return
NULL
;
len
=
(
wcslen
(
src
)
+
1
)
*
sizeof
(
WCHAR
);
if
((
dst
=
heap_alloc
(
len
)))
memcpy
(
dst
,
src
,
len
);
return
dst
;
}
HRESULT
WINAPI
PTReleaseMemory
(
PVOID
mem
)
{
heap_
free
(
mem
);
free
(
mem
);
return
S_OK
;
}
...
...
@@ -65,9 +54,9 @@ HRESULT WINAPI PTCloseProvider(HPTPROVIDER provider)
return
E_HANDLE
;
prov
->
owner
=
0
;
heap_
free
(
prov
->
name
);
free
(
prov
->
name
);
ClosePrinter
(
prov
->
hprn
);
heap_
free
(
prov
);
free
(
prov
);
return
S_OK
;
}
...
...
@@ -92,16 +81,16 @@ HRESULT WINAPI PTOpenProviderEx(const WCHAR *printer, DWORD max_version, DWORD p
if
(
!
max_version
||
!
provider
||
!
used_version
)
return
E_INVALIDARG
;
prov
=
heap_
alloc
(
sizeof
(
*
prov
));
prov
=
m
alloc
(
sizeof
(
*
prov
));
if
(
!
prov
)
return
E_OUTOFMEMORY
;
if
(
!
OpenPrinterW
((
LPWSTR
)
printer
,
&
prov
->
hprn
,
NULL
))
{
heap_
free
(
prov
);
free
(
prov
);
return
HRESULT_FROM_WIN32
(
GetLastError
());
}
prov
->
name
=
heap_strdupW
(
printer
);
prov
->
name
=
wcsdup
(
printer
);
prov
->
owner
=
GetCurrentThreadId
();
*
provider
=
(
HPTPROVIDER
)
prov
;
*
used_version
=
1
;
...
...
dlls/prntvpt/ticket.c
View file @
e0ca118f
...
...
@@ -30,7 +30,6 @@
#include "prntvpt.h"
#include "initguid.h"
#include "msxml2.h"
#include "wine/heap.h"
#include "wine/debug.h"
#include "prntvpt_private.h"
...
...
@@ -709,7 +708,7 @@ static HRESULT initialize_ticket(struct prn_provider *prov, struct ticket *ticke
if
(
GetLastError
()
!=
ERROR_INSUFFICIENT_BUFFER
)
return
HRESULT_FROM_WIN32
(
GetLastError
());
pi2
=
heap_
alloc
(
size
);
pi2
=
m
alloc
(
size
);
if
(
!
pi2
)
return
E_OUTOFMEMORY
;
if
(
!
GetPrinterW
(
prov
->
hprn
,
2
,
(
LPBYTE
)
pi2
,
size
,
NULL
))
...
...
@@ -717,7 +716,7 @@ static HRESULT initialize_ticket(struct prn_provider *prov, struct ticket *ticke
else
devmode_to_ticket
(
pi2
->
pDevMode
,
ticket
);
heap_
free
(
pi2
);
free
(
pi2
);
return
hr
;
}
...
...
@@ -739,7 +738,7 @@ HRESULT WINAPI PTConvertPrintTicketToDevMode(HPTPROVIDER provider, IStream *stre
hr
=
parse_ticket
(
stream
,
scope
,
&
ticket
);
if
(
hr
!=
S_OK
)
return
hr
;
*
dm
=
heap_
alloc
(
sizeof
(
**
dm
));
*
dm
=
m
alloc
(
sizeof
(
**
dm
));
if
(
!*
dm
)
return
E_OUTOFMEMORY
;
ticket_to_devmode
(
&
ticket
,
*
dm
);
...
...
@@ -1279,7 +1278,7 @@ static HRESULT write_PageMediaSize_caps(const WCHAR *device, IXMLDOMElement *roo
if
(
count
<=
0
)
return
HRESULT_FROM_WIN32
(
GetLastError
());
pt
=
heap_alloc
(
count
*
sizeof
(
*
pt
));
pt
=
calloc
(
count
,
sizeof
(
*
pt
));
if
(
!
pt
)
return
E_OUTOFMEMORY
;
count
=
DeviceCapabilitiesW
(
device
,
NULL
,
DC_PAPERSIZE
,
(
LPWSTR
)
pt
,
NULL
);
...
...
@@ -1298,7 +1297,7 @@ static HRESULT write_PageMediaSize_caps(const WCHAR *device, IXMLDOMElement *roo
fail:
if
(
feature
)
IXMLDOMElement_Release
(
feature
);
heap_
free
(
pt
);
free
(
pt
);
return
hr
;
}
...
...
@@ -1353,7 +1352,7 @@ static HRESULT write_PageResolution_caps(const WCHAR *device, IXMLDOMElement *ro
if
(
count
<=
0
)
return
HRESULT_FROM_WIN32
(
GetLastError
());
res
=
heap_alloc
(
count
*
sizeof
(
*
res
));
res
=
calloc
(
count
,
sizeof
(
*
res
));
if
(
!
res
)
return
E_OUTOFMEMORY
;
count
=
DeviceCapabilitiesW
(
device
,
NULL
,
DC_ENUMRESOLUTIONS
,
(
LPWSTR
)
res
,
NULL
);
...
...
@@ -1372,7 +1371,7 @@ static HRESULT write_PageResolution_caps(const WCHAR *device, IXMLDOMElement *ro
fail:
if
(
feature
)
IXMLDOMElement_Release
(
feature
);
heap_
free
(
res
);
free
(
res
);
return
hr
;
}
...
...
@@ -1427,7 +1426,7 @@ static HRESULT write_JobInputBin_caps(const WCHAR *device, IXMLDOMElement *root)
if
(
count
<=
0
)
return
HRESULT_FROM_WIN32
(
GetLastError
());
bin
=
heap_alloc
(
count
*
sizeof
(
*
bin
));
bin
=
calloc
(
count
,
sizeof
(
*
bin
));
if
(
!
bin
)
return
E_OUTOFMEMORY
;
count
=
DeviceCapabilitiesW
(
device
,
NULL
,
DC_BINS
,
(
LPWSTR
)
bin
,
NULL
);
...
...
@@ -1446,7 +1445,7 @@ static HRESULT write_JobInputBin_caps(const WCHAR *device, IXMLDOMElement *root)
fail:
if
(
feature
)
IXMLDOMElement_Release
(
feature
);
heap_
free
(
bin
);
free
(
bin
);
return
hr
;
}
...
...
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