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
9140c673
Commit
9140c673
authored
Apr 05, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Apr 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32/tests: Use CRT memory allocation functions.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f4111937
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
37 additions
and
46 deletions
+37
-46
assoc.c
dlls/shell32/tests/assoc.c
+3
-4
autocomplete.c
dlls/shell32/tests/autocomplete.c
+2
-3
ebrowser.c
dlls/shell32/tests/ebrowser.c
+6
-7
msg.h
dlls/shell32/tests/msg.h
+4
-5
shelldispatch.c
dlls/shell32/tests/shelldispatch.c
+2
-3
shelllink.c
dlls/shell32/tests/shelllink.c
+2
-3
shlexec.c
dlls/shell32/tests/shlexec.c
+4
-5
shlfolder.c
dlls/shell32/tests/shlfolder.c
+10
-11
shlview.c
dlls/shell32/tests/shlview.c
+4
-5
No files found.
dlls/shell32/tests/assoc.c
View file @
9140c673
...
...
@@ -25,7 +25,6 @@
#include "shlguid.h"
#include "shobjidl.h"
#include "wine/heap.h"
#include "wine/test.h"
...
...
@@ -104,8 +103,8 @@ static struct assoc_getstring_test getstring_tests[] =
static
void
getstring_test
(
LPCWSTR
assocName
,
HKEY
progIdKey
,
ASSOCSTR
str
,
LPCWSTR
expected_string
,
int
line
)
{
IQueryAssociations
*
assoc
;
WCHAR
*
buffer
;
HRESULT
hr
;
WCHAR
*
buffer
=
NULL
;
DWORD
len
;
hr
=
CoCreateInstance
(
&
CLSID_QueryAssociations
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IQueryAssociations
,
(
void
*
)
&
assoc
);
...
...
@@ -122,19 +121,19 @@ static void getstring_test(LPCWSTR assocName, HKEY progIdKey, ASSOCSTR str, LPCW
return
;
}
buffer
=
heap_
alloc
(
len
*
sizeof
(
WCHAR
));
buffer
=
m
alloc
(
len
*
sizeof
(
WCHAR
));
ok_
(
__FILE__
,
line
)(
buffer
!=
NULL
,
"out of memory
\n
"
);
hr
=
IQueryAssociations_GetString
(
assoc
,
0
,
str
,
NULL
,
buffer
,
&
len
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"GetString returned 0x%lx, expected S_OK
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
lstrcmpW
(
buffer
,
expected_string
)
==
0
,
"GetString returned %s, expected %s
\n
"
,
wine_dbgstr_w
(
buffer
),
wine_dbgstr_w
(
expected_string
));
free
(
buffer
);
}
else
{
ok_
(
__FILE__
,
line
)(
FAILED
(
hr
),
"GetString returned 0x%lx, expected failure
\n
"
,
hr
);
}
IQueryAssociations_Release
(
assoc
);
heap_free
(
buffer
);
}
static
void
test_IQueryAssociations_GetString
(
void
)
...
...
dlls/shell32/tests/autocomplete.c
View file @
9140c673
...
...
@@ -28,7 +28,6 @@
#include "shldisp.h"
#include "shlobj.h"
#include "wine/heap.h"
#include "wine/test.h"
static
HWND
hMainWnd
,
hEdit
;
...
...
@@ -317,7 +316,7 @@ static ULONG WINAPI string_enumerator_Release(IEnumString *iface)
ULONG
ref
=
InterlockedDecrement
(
&
this
->
ref
);
if
(
!
ref
)
heap_
free
(
this
);
free
(
this
);
return
ref
;
}
...
...
@@ -426,7 +425,7 @@ static HRESULT string_enumerator_create(void **ppv, WCHAR **suggestions, int cou
{
struct
string_enumerator
*
object
;
object
=
heap_alloc_zero
(
sizeof
(
*
object
));
object
=
calloc
(
1
,
sizeof
(
*
object
));
object
->
IEnumString_iface
.
lpVtbl
=
&
string_enumerator_vtbl
;
object
->
IACList_iface
.
lpVtbl
=
&
aclist_vtbl
;
object
->
ref
=
1
;
...
...
dlls/shell32/tests/ebrowser.c
View file @
9140c673
...
...
@@ -26,7 +26,6 @@
#include "shlobj.h"
#include "shlwapi.h"
#include "wine/heap.h"
#include "wine/test.h"
#include "initguid.h"
...
...
@@ -193,7 +192,7 @@ static ULONG WINAPI IExplorerPaneVisibility_fnRelease(IExplorerPaneVisibility *i
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
!
ref
)
heap_
free
(
This
);
free
(
This
);
return
ref
;
}
...
...
@@ -239,7 +238,7 @@ static IExplorerPaneVisibilityImpl *create_explorerpanevisibility(void)
{
IExplorerPaneVisibilityImpl
*
epv
;
epv
=
heap_alloc_zero
(
sizeof
(
*
epv
));
epv
=
calloc
(
1
,
sizeof
(
*
epv
));
epv
->
IExplorerPaneVisibility_iface
.
lpVtbl
=
&
epvvt
;
epv
->
ref
=
1
;
...
...
@@ -282,7 +281,7 @@ static ULONG WINAPI ICommDlgBrowser3_fnRelease(ICommDlgBrowser3 *iface)
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
!
ref
)
heap_
free
(
This
);
free
(
This
);
return
ref
;
}
...
...
@@ -393,7 +392,7 @@ static ICommDlgBrowser3Impl *create_commdlgbrowser3(void)
{
ICommDlgBrowser3Impl
*
cdb
;
cdb
=
heap_alloc_zero
(
sizeof
(
*
cdb
));
cdb
=
calloc
(
1
,
sizeof
(
*
cdb
));
cdb
->
ICommDlgBrowser3_iface
.
lpVtbl
=
&
cdbvtbl
;
cdb
->
ref
=
1
;
...
...
@@ -450,7 +449,7 @@ static ULONG WINAPI IServiceProvider_fnRelease(IServiceProvider *iface)
LONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
!
ref
)
heap_
free
(
This
);
free
(
This
);
return
ref
;
}
...
...
@@ -491,7 +490,7 @@ static const IServiceProviderVtbl spvtbl =
static
IServiceProviderImpl
*
create_serviceprovider
(
void
)
{
IServiceProviderImpl
*
sp
=
heap_
alloc
(
sizeof
(
*
sp
));
IServiceProviderImpl
*
sp
=
m
alloc
(
sizeof
(
*
sp
));
sp
->
IServiceProvider_iface
.
lpVtbl
=
&
spvtbl
;
sp
->
ref
=
1
;
return
sp
;
...
...
dlls/shell32/tests/msg.h
View file @
9140c673
...
...
@@ -21,7 +21,6 @@
#include <assert.h>
#include <windows.h>
#include "wine/heap.h"
#include "wine/test.h"
/* undocumented SWP flags - from SDK 3.1 */
...
...
@@ -68,13 +67,13 @@ static void add_message(struct msg_sequence **seq, int sequence_index,
if
(
!
msg_seq
->
sequence
)
{
msg_seq
->
size
=
10
;
msg_seq
->
sequence
=
heap_
alloc
(
msg_seq
->
size
*
sizeof
(
struct
message
));
msg_seq
->
sequence
=
m
alloc
(
msg_seq
->
size
*
sizeof
(
struct
message
));
}
if
(
msg_seq
->
count
==
msg_seq
->
size
)
{
msg_seq
->
size
*=
2
;
msg_seq
->
sequence
=
heap_
realloc
(
msg_seq
->
sequence
,
msg_seq
->
size
*
sizeof
(
struct
message
));
msg_seq
->
sequence
=
realloc
(
msg_seq
->
sequence
,
msg_seq
->
size
*
sizeof
(
struct
message
));
}
assert
(
msg_seq
->
sequence
);
...
...
@@ -91,7 +90,7 @@ static void add_message(struct msg_sequence **seq, int sequence_index,
static
void
flush_sequence
(
struct
msg_sequence
**
seg
,
int
sequence_index
)
{
struct
msg_sequence
*
msg_seq
=
seg
[
sequence_index
];
heap_
free
(
msg_seq
->
sequence
);
free
(
msg_seq
->
sequence
);
msg_seq
->
sequence
=
NULL
;
msg_seq
->
count
=
msg_seq
->
size
=
0
;
}
...
...
@@ -289,5 +288,5 @@ static void init_msg_sequences(struct msg_sequence **seq, int n)
int
i
;
for
(
i
=
0
;
i
<
n
;
i
++
)
seq
[
i
]
=
heap_alloc_zero
(
sizeof
(
struct
msg_sequence
));
seq
[
i
]
=
calloc
(
1
,
sizeof
(
struct
msg_sequence
));
}
dlls/shell32/tests/shelldispatch.c
View file @
9140c673
...
...
@@ -27,7 +27,6 @@
#include "shlwapi.h"
#include "winsvc.h"
#include "wine/heap.h"
#include "wine/test.h"
#include "initguid.h"
...
...
@@ -278,7 +277,7 @@ static void test_namespace(void)
GetFullPathNameW
(
winetestW
,
MAX_PATH
,
tempW
,
NULL
);
len
=
GetLongPathNameW
(
tempW
,
NULL
,
0
);
long_pathW
=
heap_
alloc
(
len
*
sizeof
(
WCHAR
));
long_pathW
=
m
alloc
(
len
*
sizeof
(
WCHAR
));
GetLongPathNameW
(
tempW
,
long_pathW
,
len
);
V_VT
(
&
var
)
=
VT_BSTR
;
...
...
@@ -350,7 +349,7 @@ static void test_namespace(void)
SysFreeString
(
V_BSTR
(
&
var
));
}
heap_
free
(
long_pathW
);
free
(
long_pathW
);
RemoveDirectoryW
(
winetestW
);
SetCurrentDirectoryW
(
curW
);
IShellDispatch_Release
(
sd
);
...
...
dlls/shell32/tests/shelllink.c
View file @
9140c673
...
...
@@ -29,7 +29,6 @@
#include "shellapi.h"
#include "commoncontrols.h"
#include "wine/heap.h"
#include "wine/test.h"
#include "shell32_test.h"
...
...
@@ -70,12 +69,12 @@ static LPITEMIDLIST path_to_pidl(const char* path)
int
len
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
path
,
-
1
,
NULL
,
0
);
pathW
=
heap_
alloc
(
len
*
sizeof
(
WCHAR
));
pathW
=
m
alloc
(
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
path
,
-
1
,
pathW
,
len
);
r
=
pSHILCreateFromPath
(
pathW
,
&
pidl
,
NULL
);
ok
(
r
==
S_OK
,
"SHILCreateFromPath failed (0x%08lx)
\n
"
,
r
);
heap_
free
(
pathW
);
free
(
pathW
);
}
return
pidl
;
}
...
...
dlls/shell32/tests/shlexec.c
View file @
9140c673
...
...
@@ -40,7 +40,6 @@
#include "shlwapi.h"
#include "ddeml.h"
#include "wine/heap.h"
#include "wine/test.h"
#include "shell32_test.h"
...
...
@@ -756,7 +755,7 @@ static LSTATUS myRegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey)
if
(
dwMaxLen
>
ARRAY_SIZE
(
szNameBuf
))
{
/* Name too big: alloc a buffer for it */
if
(
!
(
lpszName
=
heap_
alloc
(
dwMaxLen
*
sizeof
(
CHAR
))))
if
(
!
(
lpszName
=
m
alloc
(
dwMaxLen
*
sizeof
(
CHAR
))))
{
ret
=
ERROR_NOT_ENOUGH_MEMORY
;
goto
cleanup
;
...
...
@@ -791,7 +790,7 @@ static LSTATUS myRegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey)
cleanup:
/* Free buffer if allocated */
if
(
lpszName
!=
szNameBuf
)
heap_
free
(
lpszName
);
free
(
lpszName
);
if
(
lpszSubKey
)
RegCloseKey
(
hSubKey
);
return
ret
;
...
...
@@ -851,11 +850,11 @@ static void create_test_verb_dde(const char* classname, const char* verb,
}
else
{
cmd
=
heap_
alloc
(
strlen
(
argv0
)
+
10
+
strlen
(
child_file
)
+
2
+
strlen
(
cmdtail
)
+
1
);
cmd
=
m
alloc
(
strlen
(
argv0
)
+
10
+
strlen
(
child_file
)
+
2
+
strlen
(
cmdtail
)
+
1
);
sprintf
(
cmd
,
"%s shlexec
\"
%s
\"
%s"
,
argv0
,
child_file
,
cmdtail
);
rc
=
RegSetValueExA
(
hkey_cmd
,
NULL
,
0
,
REG_SZ
,
(
LPBYTE
)
cmd
,
strlen
(
cmd
)
+
1
);
ok
(
rc
==
ERROR_SUCCESS
,
"setting command failed with %ld
\n
"
,
rc
);
heap_
free
(
cmd
);
free
(
cmd
);
}
if
(
ddeexec
)
...
...
dlls/shell32/tests/shlfolder.c
View file @
9140c673
...
...
@@ -37,7 +37,6 @@
#include "ocidl.h"
#include "oleauto.h"
#include "wine/heap.h"
#include "wine/test.h"
#include <initguid.h>
...
...
@@ -75,7 +74,7 @@ static WCHAR *make_wstr(const char *str)
if
(
!
len
||
len
<
0
)
return
NULL
;
ret
=
heap_
alloc
(
len
*
sizeof
(
WCHAR
));
ret
=
m
alloc
(
len
*
sizeof
(
WCHAR
));
if
(
!
ret
)
return
NULL
;
...
...
@@ -3032,7 +3031,7 @@ static void test_SHGetIDListFromObject(void)
hres
=
pSHGetIDListFromObject
(
NULL
,
&
pidl
);
ok
(
hres
==
E_NOINTERFACE
,
"Got %lx
\n
"
,
hres
);
punkimpl
=
heap_
alloc
(
sizeof
(
*
punkimpl
));
punkimpl
=
m
alloc
(
sizeof
(
*
punkimpl
));
punkimpl
->
IUnknown_iface
.
lpVtbl
=
&
vt_IUnknown
;
punkimpl
->
ifaces
=
ifaces
;
punkimpl
->
unknown
=
0
;
...
...
@@ -3049,7 +3048,7 @@ static void test_SHGetIDListFromObject(void)
"interface not requested.
\n
"
);
ok
(
!
punkimpl
->
unknown
,
"Got %ld unknown.
\n
"
,
punkimpl
->
unknown
);
heap_
free
(
punkimpl
);
free
(
punkimpl
);
pidl_desktop
=
NULL
;
SHGetSpecialFolderLocation
(
NULL
,
CSIDL_DESKTOP
,
&
pidl_desktop
);
...
...
@@ -3203,7 +3202,7 @@ static void test_SHGetItemFromObject(void)
hres
=
pSHGetItemFromObject
(
NULL
,
&
IID_IUnknown
,
(
void
**
)
&
punk
);
ok
(
hres
==
E_NOINTERFACE
,
"Got 0x%08lx
\n
"
,
hres
);
punkimpl
=
heap_
alloc
(
sizeof
(
*
punkimpl
));
punkimpl
=
m
alloc
(
sizeof
(
*
punkimpl
));
punkimpl
->
IUnknown_iface
.
lpVtbl
=
&
vt_IUnknown
;
punkimpl
->
ifaces
=
ifaces
;
punkimpl
->
unknown
=
0
;
...
...
@@ -3221,7 +3220,7 @@ static void test_SHGetItemFromObject(void)
"interface not requested.
\n
"
);
ok
(
!
punkimpl
->
unknown
,
"Got %ld unknown.
\n
"
,
punkimpl
->
unknown
);
heap_
free
(
punkimpl
);
free
(
punkimpl
);
/* Test IShellItem */
hres
=
pSHGetItemFromObject
((
IUnknown
*
)
psfdesktop
,
&
IID_IShellItem
,
(
void
**
)
&
psi
);
...
...
@@ -4584,7 +4583,7 @@ static void r_verify_pidl(unsigned l, LPCITEMIDLIST pidl, const WCHAR *path)
WCHAR
*
strW
=
make_wstr
(
U
(
filename
).
cStr
);
ok_
(
__FILE__
,
l
)(
!
lstrcmpW
(
path
,
strW
),
"didn't get expected path (%s), instead: %s
\n
"
,
wine_dbgstr_w
(
path
),
U
(
filename
).
cStr
);
heap_
free
(
strW
);
free
(
strW
);
}
IShellFolder_Release
(
parent
);
...
...
@@ -4918,8 +4917,8 @@ static LRESULT CALLBACK testwindow_wndproc(HWND hwnd, UINT msg, WPARAM wparam, L
path2
=
make_wstr
(
exp_data
->
path_2
);
verify_pidl
(
pidls
[
0
],
path1
);
verify_pidl
(
pidls
[
1
],
path2
);
heap_
free
(
path1
);
heap_
free
(
path2
);
free
(
path1
);
free
(
path2
);
exp_data
->
missing_events
--
;
...
...
@@ -5027,8 +5026,8 @@ static void test_SHChangeNotify(BOOL test_new_delivery)
do_events
();
ok
(
exp_data
->
missing_events
==
0
,
"%s: Expected wndproc to be called
\n
"
,
exp_data
->
id
);
heap_
free
(
path1
);
heap_
free
(
path2
);
free
(
path1
);
free
(
path2
);
}
}
...
...
dlls/shell32/tests/shlview.c
View file @
9140c673
...
...
@@ -38,7 +38,6 @@
#include "initguid.h"
#include "wine/heap.h"
#include "wine/test.h"
#include "msg.h"
...
...
@@ -150,7 +149,7 @@ static IDataObject* IDataObjectImpl_Construct(void)
{
IDataObjectImpl
*
obj
;
obj
=
heap_
alloc
(
sizeof
(
*
obj
));
obj
=
m
alloc
(
sizeof
(
*
obj
));
obj
->
IDataObject_iface
.
lpVtbl
=
&
IDataObjectImpl_Vtbl
;
obj
->
ref
=
1
;
...
...
@@ -188,7 +187,7 @@ static ULONG WINAPI IDataObjectImpl_Release(IDataObject * iface)
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
!
ref
)
heap_
free
(
This
);
free
(
This
);
return
ref
;
}
...
...
@@ -275,7 +274,7 @@ static IShellBrowser* IShellBrowserImpl_Construct(void)
{
IShellBrowserImpl
*
browser
;
browser
=
heap_
alloc
(
sizeof
(
*
browser
));
browser
=
m
alloc
(
sizeof
(
*
browser
));
browser
->
IShellBrowser_iface
.
lpVtbl
=
&
IShellBrowserImpl_Vtbl
;
browser
->
ref
=
1
;
...
...
@@ -318,7 +317,7 @@ static ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface)
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
!
ref
)
heap_
free
(
This
);
free
(
This
);
return
ref
;
}
...
...
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