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
0dad77af
Commit
0dad77af
authored
Apr 11, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Apr 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hlink: Use CRT allocation functions.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
28423d79
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
61 deletions
+39
-61
browse_ctx.c
dlls/hlink/browse_ctx.c
+7
-8
extserv.c
dlls/hlink/extserv.c
+13
-16
hlink_main.c
dlls/hlink/hlink_main.c
+3
-3
hlink_private.h
dlls/hlink/hlink_private.h
+0
-17
link.c
dlls/hlink/link.c
+16
-17
No files found.
dlls/hlink/browse_ctx.c
View file @
0dad77af
...
@@ -88,11 +88,11 @@ static ULONG WINAPI IHlinkBC_fnRelease (IHlinkBrowseContext* iface)
...
@@ -88,11 +88,11 @@ static ULONG WINAPI IHlinkBC_fnRelease (IHlinkBrowseContext* iface)
{
{
list_remove
(
&
link
->
entry
);
list_remove
(
&
link
->
entry
);
IHlink_Release
(
link
->
link
);
IHlink_Release
(
link
->
link
);
heap_
free
(
link
);
free
(
link
);
}
}
heap_
free
(
This
->
BrowseWindowInfo
);
free
(
This
->
BrowseWindowInfo
);
heap_
free
(
This
);
free
(
This
);
}
}
return
ref
;
return
ref
;
...
@@ -174,8 +174,8 @@ static HRESULT WINAPI IHlinkBC_SetBrowseWindowInfo(IHlinkBrowseContext* iface,
...
@@ -174,8 +174,8 @@ static HRESULT WINAPI IHlinkBC_SetBrowseWindowInfo(IHlinkBrowseContext* iface,
if
(
!
phlbwi
)
if
(
!
phlbwi
)
return
E_INVALIDARG
;
return
E_INVALIDARG
;
heap_
free
(
This
->
BrowseWindowInfo
);
free
(
This
->
BrowseWindowInfo
);
This
->
BrowseWindowInfo
=
heap_
alloc
(
phlbwi
->
cbSize
);
This
->
BrowseWindowInfo
=
m
alloc
(
phlbwi
->
cbSize
);
memcpy
(
This
->
BrowseWindowInfo
,
phlbwi
,
phlbwi
->
cbSize
);
memcpy
(
This
->
BrowseWindowInfo
,
phlbwi
,
phlbwi
->
cbSize
);
return
S_OK
;
return
S_OK
;
...
@@ -209,7 +209,7 @@ static HRESULT WINAPI IHlinkBC_SetInitialHlink(IHlinkBrowseContext* iface,
...
@@ -209,7 +209,7 @@ static HRESULT WINAPI IHlinkBC_SetInitialHlink(IHlinkBrowseContext* iface,
if
(
!
list_empty
(
&
This
->
links
))
if
(
!
list_empty
(
&
This
->
links
))
return
CO_E_ALREADYINITIALIZED
;
return
CO_E_ALREADYINITIALIZED
;
link
=
heap_
alloc
(
sizeof
(
struct
link_entry
));
link
=
m
alloc
(
sizeof
(
struct
link_entry
));
if
(
!
link
)
return
E_OUTOFMEMORY
;
if
(
!
link
)
return
E_OUTOFMEMORY
;
HlinkCreateFromMoniker
(
pimkTarget
,
pwzLocation
,
pwzFriendlyName
,
NULL
,
HlinkCreateFromMoniker
(
pimkTarget
,
pwzLocation
,
pwzFriendlyName
,
NULL
,
...
@@ -375,14 +375,13 @@ HRESULT HLinkBrowseContext_Constructor(IUnknown *pUnkOuter, REFIID riid, void **
...
@@ -375,14 +375,13 @@ HRESULT HLinkBrowseContext_Constructor(IUnknown *pUnkOuter, REFIID riid, void **
if
(
pUnkOuter
)
if
(
pUnkOuter
)
return
CLASS_E_NOAGGREGATION
;
return
CLASS_E_NOAGGREGATION
;
hl
=
heap_alloc_zero
(
sizeof
(
HlinkBCImp
l
));
hl
=
calloc
(
1
,
sizeof
(
*
h
l
));
if
(
!
hl
)
if
(
!
hl
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
hl
->
ref
=
1
;
hl
->
ref
=
1
;
hl
->
IHlinkBrowseContext_iface
.
lpVtbl
=
&
hlvt
;
hl
->
IHlinkBrowseContext_iface
.
lpVtbl
=
&
hlvt
;
list_init
(
&
hl
->
links
);
list_init
(
&
hl
->
links
);
hl
->
current
=
NULL
;
*
ppv
=
hl
;
*
ppv
=
hl
;
return
S_OK
;
return
S_OK
;
...
...
dlls/hlink/extserv.c
View file @
0dad77af
...
@@ -89,10 +89,10 @@ static ULONG WINAPI ExtServUnk_Release(IUnknown *iface)
...
@@ -89,10 +89,10 @@ static ULONG WINAPI ExtServUnk_Release(IUnknown *iface)
TRACE
(
"(%p) ref=%ld
\n
"
,
This
,
ref
);
TRACE
(
"(%p) ref=%ld
\n
"
,
This
,
ref
);
if
(
!
ref
)
{
if
(
!
ref
)
{
heap_
free
(
This
->
username
);
free
(
This
->
username
);
heap_
free
(
This
->
password
);
free
(
This
->
password
);
heap_
free
(
This
->
headers
);
free
(
This
->
headers
);
heap_
free
(
This
);
free
(
This
);
}
}
return
ref
;
return
ref
;
...
@@ -236,7 +236,7 @@ static HRESULT ExtServ_ImplSetAdditionalHeaders(ExtensionService* This, LPCWSTR
...
@@ -236,7 +236,7 @@ static HRESULT ExtServ_ImplSetAdditionalHeaders(ExtensionService* This, LPCWSTR
{
{
int
len
;
int
len
;
heap_
free
(
This
->
headers
);
free
(
This
->
headers
);
This
->
headers
=
NULL
;
This
->
headers
=
NULL
;
if
(
!
pwzAdditionalHeaders
)
if
(
!
pwzAdditionalHeaders
)
...
@@ -245,11 +245,11 @@ static HRESULT ExtServ_ImplSetAdditionalHeaders(ExtensionService* This, LPCWSTR
...
@@ -245,11 +245,11 @@ static HRESULT ExtServ_ImplSetAdditionalHeaders(ExtensionService* This, LPCWSTR
len
=
lstrlenW
(
pwzAdditionalHeaders
);
len
=
lstrlenW
(
pwzAdditionalHeaders
);
if
(
len
&&
pwzAdditionalHeaders
[
len
-
1
]
!=
'\n'
&&
pwzAdditionalHeaders
[
len
-
1
]
!=
'\r'
)
{
if
(
len
&&
pwzAdditionalHeaders
[
len
-
1
]
!=
'\n'
&&
pwzAdditionalHeaders
[
len
-
1
]
!=
'\r'
)
{
This
->
headers
=
heap_
alloc
(
len
*
sizeof
(
WCHAR
)
+
sizeof
(
L"
\r\n
"
));
This
->
headers
=
m
alloc
(
len
*
sizeof
(
WCHAR
)
+
sizeof
(
L"
\r\n
"
));
memcpy
(
This
->
headers
,
pwzAdditionalHeaders
,
len
*
sizeof
(
WCHAR
));
memcpy
(
This
->
headers
,
pwzAdditionalHeaders
,
len
*
sizeof
(
WCHAR
));
memcpy
(
This
->
headers
+
len
,
L"
\r\n
"
,
sizeof
(
L"
\r\n
"
));
memcpy
(
This
->
headers
+
len
,
L"
\r\n
"
,
sizeof
(
L"
\r\n
"
));
}
else
{
}
else
{
This
->
headers
=
hlink_strdupW
(
pwzAdditionalHeaders
);
This
->
headers
=
wcsdup
(
pwzAdditionalHeaders
);
}
}
return
S_OK
;
return
S_OK
;
...
@@ -266,12 +266,12 @@ static HRESULT WINAPI ExtServ_SetAdditionalHeaders(IExtensionServices* iface, LP
...
@@ -266,12 +266,12 @@ static HRESULT WINAPI ExtServ_SetAdditionalHeaders(IExtensionServices* iface, LP
static
HRESULT
ExtServ_ImplSetAuthenticateData
(
ExtensionService
*
This
,
HWND
phwnd
,
LPCWSTR
pwzUsername
,
LPCWSTR
pwzPassword
)
static
HRESULT
ExtServ_ImplSetAuthenticateData
(
ExtensionService
*
This
,
HWND
phwnd
,
LPCWSTR
pwzUsername
,
LPCWSTR
pwzPassword
)
{
{
heap_
free
(
This
->
username
);
free
(
This
->
username
);
heap_
free
(
This
->
password
);
free
(
This
->
password
);
This
->
hwnd
=
phwnd
;
This
->
hwnd
=
phwnd
;
This
->
username
=
hlink_strdupW
(
pwzUsername
);
This
->
username
=
wcsdup
(
pwzUsername
);
This
->
password
=
hlink_strdupW
(
pwzPassword
);
This
->
password
=
wcsdup
(
pwzPassword
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -307,17 +307,14 @@ HRESULT WINAPI HlinkCreateExtensionServices(LPCWSTR pwzAdditionalHeaders,
...
@@ -307,17 +307,14 @@ HRESULT WINAPI HlinkCreateExtensionServices(LPCWSTR pwzAdditionalHeaders,
phwnd
,
debugstr_w
(
pszUsername
),
debugstr_w
(
pszPassword
),
phwnd
,
debugstr_w
(
pszUsername
),
debugstr_w
(
pszPassword
),
punkOuter
,
debugstr_guid
(
riid
),
ppv
);
punkOuter
,
debugstr_guid
(
riid
),
ppv
);
ret
=
heap_alloc
(
sizeof
(
*
ret
));
if
(
!
(
ret
=
calloc
(
1
,
sizeof
(
*
ret
))))
return
E_OUTOFMEMORY
;
ret
->
IUnknown_inner
.
lpVtbl
=
&
ExtServUnkVtbl
;
ret
->
IUnknown_inner
.
lpVtbl
=
&
ExtServUnkVtbl
;
ret
->
IAuthenticate_iface
.
lpVtbl
=
&
AuthenticateVtbl
;
ret
->
IAuthenticate_iface
.
lpVtbl
=
&
AuthenticateVtbl
;
ret
->
IHttpNegotiate_iface
.
lpVtbl
=
&
HttpNegotiateVtbl
;
ret
->
IHttpNegotiate_iface
.
lpVtbl
=
&
HttpNegotiateVtbl
;
ret
->
IExtensionServices_iface
.
lpVtbl
=
&
ExtServVtbl
;
ret
->
IExtensionServices_iface
.
lpVtbl
=
&
ExtServVtbl
;
ret
->
ref
=
1
;
ret
->
ref
=
1
;
ret
->
headers
=
NULL
;
ret
->
hwnd
=
NULL
;
ret
->
username
=
NULL
;
ret
->
password
=
NULL
;
ExtServ_ImplSetAuthenticateData
(
ret
,
phwnd
,
pszUsername
,
pszPassword
);
ExtServ_ImplSetAuthenticateData
(
ret
,
phwnd
,
pszUsername
,
pszPassword
);
ExtServ_ImplSetAdditionalHeaders
(
ret
,
pwzAdditionalHeaders
);
ExtServ_ImplSetAdditionalHeaders
(
ret
,
pwzAdditionalHeaders
);
...
...
dlls/hlink/hlink_main.c
View file @
0dad77af
...
@@ -103,7 +103,7 @@ HRESULT WINAPI HlinkCreateFromString( LPCWSTR pwzTarget, LPCWSTR pwzLocation,
...
@@ -103,7 +103,7 @@ HRESULT WINAPI HlinkCreateFromString( LPCWSTR pwzTarget, LPCWSTR pwzLocation,
else
else
{
{
int
tgt_len
=
hash
-
pwzTarget
;
int
tgt_len
=
hash
-
pwzTarget
;
tgt
=
heap_
alloc
((
tgt_len
+
1
)
*
sizeof
(
WCHAR
));
tgt
=
m
alloc
((
tgt_len
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
tgt
)
if
(
!
tgt
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
memcpy
(
tgt
,
pwzTarget
,
tgt_len
*
sizeof
(
WCHAR
));
memcpy
(
tgt
,
pwzTarget
,
tgt_len
*
sizeof
(
WCHAR
));
...
@@ -116,7 +116,7 @@ HRESULT WINAPI HlinkCreateFromString( LPCWSTR pwzTarget, LPCWSTR pwzLocation,
...
@@ -116,7 +116,7 @@ HRESULT WINAPI HlinkCreateFromString( LPCWSTR pwzTarget, LPCWSTR pwzLocation,
}
}
else
else
{
{
tgt
=
hlink_strdupW
(
pwzTarget
);
tgt
=
wcsdup
(
pwzTarget
);
if
(
!
tgt
)
if
(
!
tgt
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
loc
=
pwzLocation
;
loc
=
pwzLocation
;
...
@@ -130,7 +130,7 @@ HRESULT WINAPI HlinkCreateFromString( LPCWSTR pwzTarget, LPCWSTR pwzLocation,
...
@@ -130,7 +130,7 @@ HRESULT WINAPI HlinkCreateFromString( LPCWSTR pwzTarget, LPCWSTR pwzLocation,
IHlink_SetStringReference
(
hl
,
HLINKSETF_TARGET
|
HLINKSETF_LOCATION
,
tgt
,
loc
);
IHlink_SetStringReference
(
hl
,
HLINKSETF_TARGET
|
HLINKSETF_LOCATION
,
tgt
,
loc
);
heap_
free
(
tgt
);
free
(
tgt
);
if
(
pwzFriendlyName
)
if
(
pwzFriendlyName
)
IHlink_SetFriendlyName
(
hl
,
pwzFriendlyName
);
IHlink_SetFriendlyName
(
hl
,
pwzFriendlyName
);
...
...
dlls/hlink/hlink_private.h
View file @
0dad77af
...
@@ -27,26 +27,9 @@
...
@@ -27,26 +27,9 @@
#include "ole2.h"
#include "ole2.h"
#include "hlink.h"
#include "hlink.h"
#include "wine/heap.h"
extern
HRESULT
HLink_Constructor
(
IUnknown
*
,
REFIID
,
void
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
HLink_Constructor
(
IUnknown
*
,
REFIID
,
void
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
HLinkBrowseContext_Constructor
(
IUnknown
*
,
REFIID
,
void
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
HLinkBrowseContext_Constructor
(
IUnknown
*
,
REFIID
,
void
**
)
DECLSPEC_HIDDEN
;
static
inline
LPWSTR
hlink_strdupW
(
LPCWSTR
str
)
{
LPWSTR
ret
=
NULL
;
if
(
str
)
{
DWORD
size
;
size
=
(
lstrlenW
(
str
)
+
1
)
*
sizeof
(
WCHAR
);
ret
=
heap_alloc
(
size
);
memcpy
(
ret
,
str
,
size
);
}
return
ret
;
}
static
inline
LPWSTR
hlink_co_strdupW
(
LPCWSTR
str
)
static
inline
LPWSTR
hlink_co_strdupW
(
LPCWSTR
str
)
{
{
LPWSTR
ret
=
NULL
;
LPWSTR
ret
=
NULL
;
...
...
dlls/hlink/link.c
View file @
0dad77af
...
@@ -169,14 +169,14 @@ static ULONG WINAPI IHlink_fnRelease (IHlink* iface)
...
@@ -169,14 +169,14 @@ static ULONG WINAPI IHlink_fnRelease (IHlink* iface)
return
refCount
;
return
refCount
;
TRACE
(
"-- destroying IHlink (%p)
\n
"
,
This
);
TRACE
(
"-- destroying IHlink (%p)
\n
"
,
This
);
heap_
free
(
This
->
FriendlyName
);
free
(
This
->
FriendlyName
);
heap_
free
(
This
->
TargetFrameName
);
free
(
This
->
TargetFrameName
);
heap_
free
(
This
->
Location
);
free
(
This
->
Location
);
if
(
This
->
Moniker
)
if
(
This
->
Moniker
)
IMoniker_Release
(
This
->
Moniker
);
IMoniker_Release
(
This
->
Moniker
);
if
(
This
->
Site
)
if
(
This
->
Site
)
IHlinkSite_Release
(
This
->
Site
);
IHlinkSite_Release
(
This
->
Site
);
heap_
free
(
This
);
free
(
This
);
return
0
;
return
0
;
}
}
...
@@ -248,8 +248,8 @@ static HRESULT WINAPI IHlink_fnSetMonikerReference( IHlink* iface,
...
@@ -248,8 +248,8 @@ static HRESULT WINAPI IHlink_fnSetMonikerReference( IHlink* iface,
}
}
if
(
rfHLSETF
&
HLINKSETF_LOCATION
){
if
(
rfHLSETF
&
HLINKSETF_LOCATION
){
heap_
free
(
This
->
Location
);
free
(
This
->
Location
);
This
->
Location
=
hlink_strdupW
(
pwzLocation
);
This
->
Location
=
wcsdup
(
pwzLocation
);
}
}
return
S_OK
;
return
S_OK
;
...
@@ -310,10 +310,10 @@ static HRESULT WINAPI IHlink_fnSetStringReference(IHlink* iface,
...
@@ -310,10 +310,10 @@ static HRESULT WINAPI IHlink_fnSetStringReference(IHlink* iface,
if
(
grfHLSETF
&
HLINKSETF_LOCATION
)
if
(
grfHLSETF
&
HLINKSETF_LOCATION
)
{
{
heap_
free
(
This
->
Location
);
free
(
This
->
Location
);
This
->
Location
=
NULL
;
This
->
Location
=
NULL
;
if
(
pwzLocation
&&
*
pwzLocation
)
if
(
pwzLocation
&&
*
pwzLocation
)
This
->
Location
=
hlink_strdupW
(
pwzLocation
);
This
->
Location
=
wcsdup
(
pwzLocation
);
}
}
return
S_OK
;
return
S_OK
;
...
@@ -399,8 +399,8 @@ static HRESULT WINAPI IHlink_fnSetFriendlyName (IHlink *iface,
...
@@ -399,8 +399,8 @@ static HRESULT WINAPI IHlink_fnSetFriendlyName (IHlink *iface,
TRACE
(
"(%p) -> (%s)
\n
"
,
This
,
debugstr_w
(
pwzFriendlyName
));
TRACE
(
"(%p) -> (%s)
\n
"
,
This
,
debugstr_w
(
pwzFriendlyName
));
heap_
free
(
This
->
FriendlyName
);
free
(
This
->
FriendlyName
);
This
->
FriendlyName
=
hlink_strdupW
(
pwzFriendlyName
);
This
->
FriendlyName
=
wcsdup
(
pwzFriendlyName
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -447,8 +447,8 @@ static HRESULT WINAPI IHlink_fnSetTargetFrameName(IHlink* iface,
...
@@ -447,8 +447,8 @@ static HRESULT WINAPI IHlink_fnSetTargetFrameName(IHlink* iface,
HlinkImpl
*
This
=
impl_from_IHlink
(
iface
);
HlinkImpl
*
This
=
impl_from_IHlink
(
iface
);
TRACE
(
"(%p)->(%s)
\n
"
,
This
,
debugstr_w
(
pwzTargetFramename
));
TRACE
(
"(%p)->(%s)
\n
"
,
This
,
debugstr_w
(
pwzTargetFramename
));
heap_
free
(
This
->
TargetFrameName
);
free
(
This
->
TargetFrameName
);
This
->
TargetFrameName
=
hlink_strdupW
(
pwzTargetFramename
);
This
->
TargetFrameName
=
wcsdup
(
pwzTargetFramename
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -767,18 +767,18 @@ static HRESULT read_hlink_string(IStream *pStm, LPWSTR *out_str)
...
@@ -767,18 +767,18 @@ static HRESULT read_hlink_string(IStream *pStm, LPWSTR *out_str)
TRACE
(
"read len %ld
\n
"
,
len
);
TRACE
(
"read len %ld
\n
"
,
len
);
str
=
heap_
alloc
(
len
*
sizeof
(
WCHAR
));
str
=
m
alloc
(
len
*
sizeof
(
WCHAR
));
if
(
!
str
)
return
E_OUTOFMEMORY
;
if
(
!
str
)
return
E_OUTOFMEMORY
;
hr
=
IStream_Read
(
pStm
,
str
,
len
*
sizeof
(
WCHAR
),
&
read
);
hr
=
IStream_Read
(
pStm
,
str
,
len
*
sizeof
(
WCHAR
),
&
read
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
{
{
heap_
free
(
str
);
free
(
str
);
return
hr
;
return
hr
;
}
}
if
(
read
!=
len
*
sizeof
(
WCHAR
))
if
(
read
!=
len
*
sizeof
(
WCHAR
))
{
{
heap_
free
(
str
);
free
(
str
);
return
STG_E_READFAULT
;
return
STG_E_READFAULT
;
}
}
TRACE
(
"read string %s
\n
"
,
debugstr_w
(
str
));
TRACE
(
"read string %s
\n
"
,
debugstr_w
(
str
));
...
@@ -1137,8 +1137,7 @@ HRESULT HLink_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv)
...
@@ -1137,8 +1137,7 @@ HRESULT HLink_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv)
if
(
pUnkOuter
)
if
(
pUnkOuter
)
return
CLASS_E_NOAGGREGATION
;
return
CLASS_E_NOAGGREGATION
;
hl
=
heap_alloc_zero
(
sizeof
(
HlinkImpl
));
if
(
!
(
hl
=
calloc
(
1
,
sizeof
(
*
hl
))))
if
(
!
hl
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
hl
->
ref
=
1
;
hl
->
ref
=
1
;
...
...
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