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
a6ad34f8
Commit
a6ad34f8
authored
Feb 20, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32/tests: Use the global memory allocation helpers.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
50ca65d1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
54 additions
and
47 deletions
+54
-47
assoc.c
dlls/shell32/tests/assoc.c
+3
-2
autocomplete.c
dlls/shell32/tests/autocomplete.c
+5
-3
ebrowser.c
dlls/shell32/tests/ebrowser.c
+7
-6
msg.h
dlls/shell32/tests/msg.h
+6
-7
shelldispatch.c
dlls/shell32/tests/shelldispatch.c
+4
-2
shelllink.c
dlls/shell32/tests/shelllink.c
+4
-2
shlexec.c
dlls/shell32/tests/shlexec.c
+6
-4
shlfolder.c
dlls/shell32/tests/shlfolder.c
+10
-9
shlview.c
dlls/shell32/tests/shlview.c
+9
-12
No files found.
dlls/shell32/tests/assoc.c
View file @
a6ad34f8
...
...
@@ -25,6 +25,7 @@
#include "shlguid.h"
#include "shobjidl.h"
#include "wine/heap.h"
#include "wine/test.h"
...
...
@@ -121,7 +122,7 @@ static void getstring_test(LPCWSTR assocName, HKEY progIdKey, ASSOCSTR str, LPCW
return
;
}
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
buffer
=
heap_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%x, expected S_OK
\n
"
,
hr
);
...
...
@@ -133,7 +134,7 @@ static void getstring_test(LPCWSTR assocName, HKEY progIdKey, ASSOCSTR str, LPCW
}
IQueryAssociations_Release
(
assoc
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
heap_free
(
buffer
);
}
static
void
test_IQueryAssociations_GetString
(
void
)
...
...
dlls/shell32/tests/autocomplete.c
View file @
a6ad34f8
...
...
@@ -20,7 +20,6 @@
#define COBJMACROS
#include <wine/test.h>
#include <stdarg.h>
#include "windows.h"
...
...
@@ -29,6 +28,9 @@
#include "initguid.h"
#include "shldisp.h"
#include "wine/heap.h"
#include "wine/test.h"
static
HWND
hMainWnd
,
hEdit
;
static
HINSTANCE
hinst
;
static
int
killfocus_count
;
...
...
@@ -268,7 +270,7 @@ static ULONG WINAPI string_enumerator_Release(IEnumString *iface)
ULONG
ref
=
InterlockedDecrement
(
&
this
->
ref
);
if
(
!
ref
)
HeapFree
(
GetProcessHeap
(),
0
,
this
);
heap_free
(
this
);
return
ref
;
}
...
...
@@ -335,7 +337,7 @@ static HRESULT string_enumerator_create(void **ppv, WCHAR **suggestions, int cou
{
struct
string_enumerator
*
object
;
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
object
=
heap_alloc_zero
(
sizeof
(
*
object
));
object
->
IEnumString_iface
.
lpVtbl
=
&
string_enumerator_vtlb
;
object
->
ref
=
1
;
object
->
data
=
suggestions
;
...
...
dlls/shell32/tests/ebrowser.c
View file @
a6ad34f8
...
...
@@ -26,6 +26,7 @@
#include "shlobj.h"
#include "shlwapi.h"
#include "wine/heap.h"
#include "wine/test.h"
#include "initguid.h"
...
...
@@ -239,7 +240,7 @@ static ULONG WINAPI IExplorerPaneVisibility_fnRelease(IExplorerPaneVisibility *i
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
!
ref
)
HeapFree
(
GetProcessHeap
(),
0
,
This
);
heap_free
(
This
);
return
ref
;
}
...
...
@@ -285,7 +286,7 @@ static IExplorerPaneVisibilityImpl *create_explorerpanevisibility(void)
{
IExplorerPaneVisibilityImpl
*
epv
;
epv
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IExplorerPaneVisibilityImpl
));
epv
=
heap_alloc_zero
(
sizeof
(
*
epv
));
epv
->
IExplorerPaneVisibility_iface
.
lpVtbl
=
&
epvvt
;
epv
->
ref
=
1
;
...
...
@@ -328,7 +329,7 @@ static ULONG WINAPI ICommDlgBrowser3_fnRelease(ICommDlgBrowser3 *iface)
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
!
ref
)
HeapFree
(
GetProcessHeap
(),
0
,
This
);
heap_free
(
This
);
return
ref
;
}
...
...
@@ -439,7 +440,7 @@ static ICommDlgBrowser3Impl *create_commdlgbrowser3(void)
{
ICommDlgBrowser3Impl
*
cdb
;
cdb
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
ICommDlgBrowser3Impl
));
cdb
=
heap_alloc_zero
(
sizeof
(
*
cdb
));
cdb
->
ICommDlgBrowser3_iface
.
lpVtbl
=
&
cdbvtbl
;
cdb
->
ref
=
1
;
...
...
@@ -497,7 +498,7 @@ static ULONG WINAPI IServiceProvider_fnRelease(IServiceProvider *iface)
LONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
!
ref
)
HeapFree
(
GetProcessHeap
(),
0
,
This
);
heap_free
(
This
);
return
ref
;
}
...
...
@@ -548,7 +549,7 @@ static const IServiceProviderVtbl spvtbl =
static
IServiceProviderImpl
*
create_serviceprovider
(
void
)
{
IServiceProviderImpl
*
sp
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
IServiceProviderImpl
));
IServiceProviderImpl
*
sp
=
heap_alloc
(
sizeof
(
*
sp
));
sp
->
IServiceProvider_iface
.
lpVtbl
=
&
spvtbl
;
sp
->
ref
=
1
;
return
sp
;
...
...
dlls/shell32/tests/msg.h
View file @
a6ad34f8
...
...
@@ -20,6 +20,8 @@
#include <assert.h>
#include <windows.h>
#include "wine/heap.h"
#include "wine/test.h"
/* undocumented SWP flags - from SDK 3.1 */
...
...
@@ -66,16 +68,13 @@ static void add_message(struct msg_sequence **seq, int sequence_index,
if
(
!
msg_seq
->
sequence
)
{
msg_seq
->
size
=
10
;
msg_seq
->
sequence
=
HeapAlloc
(
GetProcessHeap
(),
0
,
msg_seq
->
size
*
sizeof
(
struct
message
));
msg_seq
->
sequence
=
heap_alloc
(
msg_seq
->
size
*
sizeof
(
struct
message
));
}
if
(
msg_seq
->
count
==
msg_seq
->
size
)
{
msg_seq
->
size
*=
2
;
msg_seq
->
sequence
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
msg_seq
->
sequence
,
msg_seq
->
size
*
sizeof
(
struct
message
));
msg_seq
->
sequence
=
heap_realloc
(
msg_seq
->
sequence
,
msg_seq
->
size
*
sizeof
(
struct
message
));
}
assert
(
msg_seq
->
sequence
);
...
...
@@ -92,7 +91,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
];
HeapFree
(
GetProcessHeap
(),
0
,
msg_seq
->
sequence
);
heap_free
(
msg_seq
->
sequence
);
msg_seq
->
sequence
=
NULL
;
msg_seq
->
count
=
msg_seq
->
size
=
0
;
}
...
...
@@ -290,5 +289,5 @@ static void init_msg_sequences(struct msg_sequence **seq, int n)
int
i
;
for
(
i
=
0
;
i
<
n
;
i
++
)
seq
[
i
]
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
msg_sequence
));
seq
[
i
]
=
heap_alloc_zero
(
sizeof
(
struct
msg_sequence
));
}
dlls/shell32/tests/shelldispatch.c
View file @
a6ad34f8
...
...
@@ -26,6 +26,8 @@
#include "shlobj.h"
#include "shlwapi.h"
#include "winsvc.h"
#include "wine/heap.h"
#include "wine/test.h"
#include "initguid.h"
...
...
@@ -276,7 +278,7 @@ static void test_namespace(void)
GetFullPathNameW
(
winetestW
,
MAX_PATH
,
tempW
,
NULL
);
len
=
GetLongPathNameW
(
tempW
,
NULL
,
0
);
long_pathW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
long_pathW
=
heap_alloc
(
len
*
sizeof
(
WCHAR
));
GetLongPathNameW
(
tempW
,
long_pathW
,
len
);
V_VT
(
&
var
)
=
VT_BSTR
;
...
...
@@ -348,7 +350,7 @@ static void test_namespace(void)
SysFreeString
(
V_BSTR
(
&
var
));
}
HeapFree
(
GetProcessHeap
(),
0
,
long_pathW
);
heap_free
(
long_pathW
);
RemoveDirectoryW
(
winetestW
);
SetCurrentDirectoryW
(
curW
);
IShellDispatch_Release
(
sd
);
...
...
dlls/shell32/tests/shelllink.c
View file @
a6ad34f8
...
...
@@ -28,6 +28,8 @@
#include "shlobj.h"
#include "shellapi.h"
#include "commoncontrols.h"
#include "wine/heap.h"
#include "wine/test.h"
#include "shell32_test.h"
...
...
@@ -83,12 +85,12 @@ static LPITEMIDLIST path_to_pidl(const char* path)
int
len
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
path
,
-
1
,
NULL
,
0
);
pathW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
pathW
=
heap_alloc
(
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
path
,
-
1
,
pathW
,
len
);
r
=
pSHILCreateFromPath
(
pathW
,
&
pidl
,
NULL
);
ok
(
r
==
S_OK
,
"SHILCreateFromPath failed (0x%08x)
\n
"
,
r
);
HeapFree
(
GetProcessHeap
(),
0
,
pathW
);
heap_free
(
pathW
);
}
return
pidl
;
}
...
...
dlls/shell32/tests/shlexec.c
View file @
a6ad34f8
...
...
@@ -44,6 +44,8 @@
#include "shellapi.h"
#include "shlwapi.h"
#include "ddeml.h"
#include "wine/heap.h"
#include "wine/test.h"
#include "shell32_test.h"
...
...
@@ -759,7 +761,7 @@ static LSTATUS myRegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey)
if
(
dwMaxLen
>
sizeof
(
szNameBuf
)
/
sizeof
(
CHAR
))
{
/* Name too big: alloc a buffer for it */
if
(
!
(
lpszName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwMaxLen
*
sizeof
(
CHAR
))))
if
(
!
(
lpszName
=
heap_alloc
(
dwMaxLen
*
sizeof
(
CHAR
))))
{
ret
=
ERROR_NOT_ENOUGH_MEMORY
;
goto
cleanup
;
...
...
@@ -794,7 +796,7 @@ static LSTATUS myRegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey)
cleanup:
/* Free buffer if allocated */
if
(
lpszName
!=
szNameBuf
)
HeapFree
(
GetProcessHeap
(),
0
,
lpszName
);
heap_free
(
lpszName
);
if
(
lpszSubKey
)
RegCloseKey
(
hSubKey
);
return
ret
;
...
...
@@ -854,11 +856,11 @@ static void create_test_verb_dde(const char* classname, const char* verb,
}
else
{
cmd
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
argv0
)
+
10
+
strlen
(
child_file
)
+
2
+
strlen
(
cmdtail
)
+
1
);
cmd
=
heap_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 %d
\n
"
,
rc
);
HeapFree
(
GetProcessHeap
(),
0
,
cmd
);
heap_free
(
cmd
);
}
if
(
ddeexec
)
...
...
dlls/shell32/tests/shlfolder.c
View file @
a6ad34f8
...
...
@@ -37,6 +37,7 @@
#include "ocidl.h"
#include "oleauto.h"
#include "wine/heap.h"
#include "wine/test.h"
#include <initguid.h>
...
...
@@ -75,7 +76,7 @@ static WCHAR *make_wstr(const char *str)
if
(
!
len
||
len
<
0
)
return
NULL
;
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
ret
=
heap_alloc
(
len
*
sizeof
(
WCHAR
));
if
(
!
ret
)
return
NULL
;
...
...
@@ -3049,7 +3050,7 @@ static void test_SHGetIDListFromObject(void)
hres
=
pSHGetIDListFromObject
(
NULL
,
&
pidl
);
ok
(
hres
==
E_NOINTERFACE
,
"Got %x
\n
"
,
hres
);
punkimpl
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
IUnknownI
mpl
));
punkimpl
=
heap_alloc
(
sizeof
(
*
punki
mpl
));
punkimpl
->
IUnknown_iface
.
lpVtbl
=
&
vt_IUnknown
;
punkimpl
->
ifaces
=
ifaces
;
punkimpl
->
unknown
=
0
;
...
...
@@ -3066,7 +3067,7 @@ static void test_SHGetIDListFromObject(void)
"interface not requested.
\n
"
);
ok
(
!
punkimpl
->
unknown
,
"Got %d unknown.
\n
"
,
punkimpl
->
unknown
);
HeapFree
(
GetProcessHeap
(),
0
,
punkimpl
);
heap_free
(
punkimpl
);
pidl_desktop
=
NULL
;
SHGetSpecialFolderLocation
(
NULL
,
CSIDL_DESKTOP
,
&
pidl_desktop
);
...
...
@@ -3220,7 +3221,7 @@ static void test_SHGetItemFromObject(void)
hres
=
pSHGetItemFromObject
(
NULL
,
&
IID_IUnknown
,
(
void
**
)
&
punk
);
ok
(
hres
==
E_NOINTERFACE
,
"Got 0x%08x
\n
"
,
hres
);
punkimpl
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
IUnknownI
mpl
));
punkimpl
=
heap_alloc
(
sizeof
(
*
punki
mpl
));
punkimpl
->
IUnknown_iface
.
lpVtbl
=
&
vt_IUnknown
;
punkimpl
->
ifaces
=
ifaces
;
punkimpl
->
unknown
=
0
;
...
...
@@ -3238,7 +3239,7 @@ static void test_SHGetItemFromObject(void)
"interface not requested.
\n
"
);
ok
(
!
punkimpl
->
unknown
,
"Got %d unknown.
\n
"
,
punkimpl
->
unknown
);
HeapFree
(
GetProcessHeap
(),
0
,
punkimpl
);
heap_free
(
punkimpl
);
/* Test IShellItem */
hres
=
pSHGetItemFromObject
((
IUnknown
*
)
psfdesktop
,
&
IID_IShellItem
,
(
void
**
)
&
psi
);
...
...
@@ -4858,8 +4859,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
);
HeapFree
(
GetProcessHeap
(),
0
,
path1
);
HeapFree
(
GetProcessHeap
(),
0
,
path2
);
heap_free
(
path1
);
heap_free
(
path2
);
exp_data
->
missing_events
--
;
...
...
@@ -4966,8 +4967,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
);
HeapFree
(
GetProcessHeap
(),
0
,
path1
);
HeapFree
(
GetProcessHeap
(),
0
,
path2
);
heap_free
(
path1
);
heap_free
(
path2
);
}
}
...
...
dlls/shell32/tests/shlview.c
View file @
a6ad34f8
...
...
@@ -38,6 +38,7 @@
#include "initguid.h"
#include "wine/heap.h"
#include "wine/test.h"
#include "msg.h"
...
...
@@ -149,7 +150,7 @@ static IDataObject* IDataObjectImpl_Construct(void)
{
IDataObjectImpl
*
obj
;
obj
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
obj
));
obj
=
heap_alloc
(
sizeof
(
*
obj
));
obj
->
IDataObject_iface
.
lpVtbl
=
&
IDataObjectImpl_Vtbl
;
obj
->
ref
=
1
;
...
...
@@ -163,7 +164,7 @@ static HRESULT WINAPI IDataObjectImpl_QueryInterface(IDataObject *iface, REFIID
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
)
||
IsEqualIID
(
riid
,
&
IID_IDataObject
))
{
*
ppvObj
=
This
;
*
ppvObj
=
&
This
->
IDataObject_iface
;
}
if
(
*
ppvObj
)
...
...
@@ -187,10 +188,8 @@ static ULONG WINAPI IDataObjectImpl_Release(IDataObject * iface)
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
!
ref
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
0
;
}
heap_free
(
This
);
return
ref
;
}
...
...
@@ -276,7 +275,7 @@ static IShellBrowser* IShellBrowserImpl_Construct(void)
{
IShellBrowserImpl
*
browser
;
browser
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
browser
));
browser
=
heap_alloc
(
sizeof
(
*
browser
));
browser
->
IShellBrowser_iface
.
lpVtbl
=
&
IShellBrowserImpl_Vtbl
;
browser
->
ref
=
1
;
...
...
@@ -295,7 +294,7 @@ static HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
IsEqualIID
(
riid
,
&
IID_IOleWindow
)
||
IsEqualIID
(
riid
,
&
IID_IShellBrowser
))
{
*
ppvObj
=
This
;
*
ppvObj
=
&
This
->
IShellBrowser_iface
;
}
if
(
*
ppvObj
)
...
...
@@ -319,10 +318,8 @@ static ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface)
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
!
ref
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
0
;
}
heap_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