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
9a2e36b2
Commit
9a2e36b2
authored
Jan 07, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32/tests: Get rid of SHGetMalloc() in tests.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5b66af02
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
54 deletions
+25
-54
shelllink.c
dlls/shell32/tests/shelllink.c
+3
-9
shellpath.c
dlls/shell32/tests/shellpath.c
+3
-20
shlfolder.c
dlls/shell32/tests/shlfolder.c
+19
-25
No files found.
dlls/shell32/tests/shelllink.c
View file @
9a2e36b2
...
...
@@ -492,13 +492,10 @@ void create_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int save_fails)
lok
(
str
!=
NULL
||
broken
(
str
==
NULL
),
/* shell32 < 5.0 */
"Didn't expect NULL
\n
"
);
if
(
str
!=
NULL
)
if
(
str
)
{
IMalloc
*
pmalloc
;
lok
(
!
wcscmp
(
path
,
str
),
"Expected %s, got %s
\n
"
,
wine_dbgstr_w
(
path
),
wine_dbgstr_w
(
str
));
SHGetMalloc
(
&
pmalloc
);
IMalloc_Free
(
pmalloc
,
str
);
CoTaskMemFree
(
str
);
}
else
win_skip
(
"GetCurFile fails on shell32 < 5.0
\n
"
);
...
...
@@ -550,11 +547,8 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int todo)
"Didn't expect NULL
\n
"
);
if
(
str
!=
NULL
)
{
IMalloc
*
pmalloc
;
lok
(
!
wcscmp
(
path
,
str
),
"Expected %s, got %s
\n
"
,
wine_dbgstr_w
(
path
),
wine_dbgstr_w
(
str
));
SHGetMalloc
(
&
pmalloc
);
IMalloc_Free
(
pmalloc
,
str
);
CoTaskMemFree
(
str
);
}
else
win_skip
(
"GetCurFile fails on shell32 < 5.0
\n
"
);
...
...
dlls/shell32/tests/shellpath.c
View file @
9a2e36b2
...
...
@@ -90,7 +90,6 @@ static BOOL (WINAPI *pSHGetSpecialFolderPathA)(HWND, LPSTR, int, BOOL);
static
HRESULT
(
WINAPI
*
pSHGetSpecialFolderLocation
)(
HWND
,
int
,
LPITEMIDLIST
*
);
static
LPITEMIDLIST
(
WINAPI
*
pILFindLastID
)(
LPCITEMIDLIST
);
static
int
(
WINAPI
*
pSHFileOperationA
)(
LPSHFILEOPSTRUCTA
);
static
HRESULT
(
WINAPI
*
pSHGetMalloc
)(
LPMALLOC
*
);
static
UINT
(
WINAPI
*
pGetSystemWow64DirectoryA
)(
LPSTR
,
UINT
);
static
HRESULT
(
WINAPI
*
pSHGetKnownFolderPath
)(
REFKNOWNFOLDERID
,
DWORD
,
HANDLE
,
PWSTR
*
);
static
HRESULT
(
WINAPI
*
pSHSetKnownFolderPath
)(
REFKNOWNFOLDERID
,
DWORD
,
HANDLE
,
PWSTR
);
...
...
@@ -100,7 +99,6 @@ static HRESULT (WINAPI *pSHGetKnownFolderIDList)(REFKNOWNFOLDERID, DWORD, HANDLE
static
BOOL
(
WINAPI
*
pPathResolve
)(
PWSTR
,
PZPCWSTR
,
UINT
);
static
DLLVERSIONINFO
shellVersion
=
{
0
};
static
LPMALLOC
pMalloc
;
static
const
BYTE
guidType
[]
=
{
PT_GUID
};
static
const
BYTE
controlPanelType
[]
=
{
PT_SHELLEXT
,
PT_GUID
,
PT_CPL
};
static
const
BYTE
folderType
[]
=
{
PT_FOLDER
,
PT_FOLDERW
};
...
...
@@ -202,20 +200,10 @@ static void loadShell32(void)
if
(
!
pILFindLastID
)
pILFindLastID
=
(
void
*
)
GetProcAddress
(
hShell32
,
(
LPCSTR
)
16
);
GET_PROC
(
SHFileOperationA
)
GET_PROC
(
SHGetMalloc
)
GET_PROC
(
PathYetAnotherMakeUniqueName
)
GET_PROC
(
SHGetKnownFolderIDList
)
GET_PROC
(
PathResolve
);
ok
(
pSHGetMalloc
!=
NULL
,
"shell32 is missing SHGetMalloc
\n
"
);
if
(
pSHGetMalloc
)
{
HRESULT
hr
=
pSHGetMalloc
(
&
pMalloc
);
ok
(
hr
==
S_OK
,
"SHGetMalloc failed: 0x%08x
\n
"
,
hr
);
ok
(
pMalloc
!=
NULL
,
"SHGetMalloc returned a NULL IMalloc
\n
"
);
}
if
(
pDllGetVersion
)
{
shellVersion
.
cbSize
=
sizeof
(
shellVersion
);
...
...
@@ -1319,13 +1307,11 @@ static void test_parameters(void)
pidl
=
NULL
;
hr
=
SHGetFolderLocation
(
NULL
,
0xeeee
,
NULL
,
0
,
&
pidl
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x, expected E_INVALIDARG
\n
"
,
hr
);
if
(
hr
==
S_OK
)
IMalloc_Free
(
pMalloc
,
pidl
);
/* check a bogus user token: */
pidl
=
NULL
;
hr
=
SHGetFolderLocation
(
NULL
,
CSIDL_FAVORITES
,
(
HANDLE
)
2
,
0
,
&
pidl
);
ok
(
hr
==
E_FAIL
||
hr
==
E_HANDLE
,
"got 0x%08x, expected E_FAIL or E_HANDLE
\n
"
,
hr
);
if
(
hr
==
S_OK
)
IMalloc_Free
(
pMalloc
,
pidl
);
/* a NULL pidl pointer crashes, so don't test it */
...
...
@@ -1387,7 +1373,7 @@ static BYTE testSHGetFolderLocation(int folder)
getFolderName
(
folder
));
if
(
pidlLast
)
ret
=
pidlLast
->
mkid
.
abID
[
0
];
I
Malloc_Free
(
pMalloc
,
pidl
);
I
LFree
(
pidl
);
}
}
...
...
@@ -1416,7 +1402,7 @@ static BYTE testSHGetSpecialFolderLocation(int folder)
"%s: ILFindLastID failed
\n
"
,
getFolderName
(
folder
));
if
(
pidlLast
)
ret
=
pidlLast
->
mkid
.
abID
[
0
];
I
Malloc_Free
(
pMalloc
,
pidl
);
I
LFree
(
pidl
);
}
}
return
ret
;
...
...
@@ -1546,7 +1532,7 @@ static void matchGUID(int folder, const GUID *guid, const GUID *guid_alt)
"%s: got GUID %s, expected %s or %s
\n
"
,
getFolderName
(
folder
),
wine_dbgstr_guid
(
shellGuid
),
wine_dbgstr_guid
(
guid
),
wine_dbgstr_guid
(
guid_alt
));
}
I
Malloc_Free
(
pMalloc
,
pidl
);
I
LFree
(
pidl
);
}
}
...
...
@@ -1702,7 +1688,6 @@ static void doChild(const char *arg)
hr
=
SHGetFolderLocation
(
NULL
,
CSIDL_FAVORITES
,
NULL
,
0
,
&
pidl
);
ok
(
hr
==
E_FAIL
||
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
),
"SHGetFolderLocation returned 0x%08x
\n
"
,
hr
);
if
(
hr
==
S_OK
&&
pidl
)
IMalloc_Free
(
pMalloc
,
pidl
);
ok
(
!
pSHGetSpecialFolderPathA
(
NULL
,
path
,
CSIDL_FAVORITES
,
FALSE
),
"SHGetSpecialFolderPath succeeded, expected failure
\n
"
);
...
...
@@ -1712,8 +1697,6 @@ static void doChild(const char *arg)
ok
(
hr
==
E_FAIL
||
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
),
"SHGetFolderLocation returned 0x%08x
\n
"
,
hr
);
if
(
hr
==
S_OK
&&
pidl
)
IMalloc_Free
(
pMalloc
,
pidl
);
/* now test success: */
hr
=
pSHGetFolderPathA
(
NULL
,
CSIDL_FAVORITES
|
CSIDL_FLAG_CREATE
,
NULL
,
SHGFP_TYPE_CURRENT
,
path
);
...
...
dlls/shell32/tests/shlfolder.c
View file @
9a2e36b2
...
...
@@ -44,8 +44,6 @@
DEFINE_GUID
(
IID_IParentAndItem
,
0xB3A4B685
,
0xB685
,
0x4805
,
0x99
,
0xD9
,
0x5D
,
0xEA
,
0xD2
,
0x87
,
0x32
,
0x36
);
DEFINE_GUID
(
CLSID_ShellDocObjView
,
0xe7e4bc40
,
0xe76a
,
0x11ce
,
0xa9
,
0xbb
,
0x00
,
0xaa
,
0x00
,
0x4a
,
0xe8
,
0x37
);
static
IMalloc
*
ppM
;
static
HRESULT
(
WINAPI
*
pSHCreateItemFromIDList
)(
PCIDLIST_ABSOLUTE
pidl
,
REFIID
riid
,
void
**
ppv
);
static
HRESULT
(
WINAPI
*
pSHCreateItemFromParsingName
)(
PCWSTR
,
IBindCtx
*
,
REFIID
,
void
**
);
static
HRESULT
(
WINAPI
*
pSHCreateItemFromRelativeName
)(
IShellItem
*
,
PCWSTR
,
IBindCtx
*
,
REFIID
,
void
**
);
...
...
@@ -95,7 +93,6 @@ static int strcmp_wa(LPCWSTR strw, const char *stra)
static
void
init_function_pointers
(
void
)
{
HMODULE
hmod
;
HRESULT
hr
;
void
*
ptr
;
hmod
=
GetModuleHandleA
(
"shell32.dll"
);
...
...
@@ -149,9 +146,6 @@ static void init_function_pointers(void)
hmod
=
GetModuleHandleA
(
"kernel32.dll"
);
pIsWow64Process
=
(
void
*
)
GetProcAddress
(
hmod
,
"IsWow64Process"
);
hr
=
SHGetMalloc
(
&
ppM
);
ok
(
hr
==
S_OK
,
"SHGetMalloc failed %08x
\n
"
,
hr
);
}
/* Based on PathAddBackslashW from dlls/shlwapi/path.c */
...
...
@@ -405,7 +399,7 @@ static void test_EnumObjects(IShellFolder *iFolder)
}
for
(
i
=
0
;
i
<
5
;
i
++
)
I
Malloc_Free
(
ppM
,
idlArr
[
i
]);
I
LFree
(
idlArr
[
i
]);
}
static
void
test_BindToObject
(
void
)
...
...
@@ -451,7 +445,7 @@ static void test_BindToObject(void)
hr
=
IShellFolder_BindToObject
(
psfDesktop
,
pidlMyComputer
,
NULL
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
psfMyComputer
);
ok
(
hr
==
S_OK
,
"Desktop failed to bind to MyComputer object! hr = %08x
\n
"
,
hr
);
IShellFolder_Release
(
psfDesktop
);
I
Malloc_Free
(
ppM
,
pidlMyComputer
);
I
LFree
(
pidlMyComputer
);
if
(
hr
!=
S_OK
)
return
;
hr
=
IShellFolder_BindToObject
(
psfMyComputer
,
pidlEmpty
,
NULL
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
psfChild
);
...
...
@@ -478,7 +472,7 @@ static void test_BindToObject(void)
hr
=
IShellFolder_BindToObject
(
psfMyComputer
,
pidlSystemDir
,
NULL
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
psfSystemDir
);
ok
(
hr
==
S_OK
,
"MyComputer failed to bind to a FileSystem ShellFolder! hr = %08x
\n
"
,
hr
);
IShellFolder_Release
(
psfMyComputer
);
I
Malloc_Free
(
ppM
,
pidlSystemDir
);
I
LFree
(
pidlSystemDir
);
if
(
hr
!=
S_OK
)
return
;
hr
=
IShellFolder_BindToObject
(
psfSystemDir
,
pidlEmpty
,
NULL
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
psfChild
);
...
...
@@ -860,7 +854,7 @@ static void test_CallForAttributes(void)
if
(
lResult
!=
ERROR_SUCCESS
)
{
if
(
lResult
==
ERROR_ACCESS_DENIED
)
skip
(
"Not enough rights to open the registry key
\n
"
);
I
Malloc_Free
(
ppM
,
pidlMyDocuments
);
I
LFree
(
pidlMyDocuments
);
IShellFolder_Release
(
psfDesktop
);
return
;
}
...
...
@@ -871,7 +865,7 @@ static void test_CallForAttributes(void)
ok
(
lResult
==
ERROR_SUCCESS
,
"RegQueryValueEx failed! result: %08x
\n
"
,
lResult
);
if
(
lResult
!=
ERROR_SUCCESS
)
{
RegCloseKey
(
hKey
);
I
Malloc_Free
(
ppM
,
pidlMyDocuments
);
I
LFree
(
pidlMyDocuments
);
IShellFolder_Release
(
psfDesktop
);
return
;
}
...
...
@@ -883,7 +877,7 @@ static void test_CallForAttributes(void)
ok
(
lResult
==
ERROR_SUCCESS
,
"RegQueryValueEx failed! result: %08x
\n
"
,
lResult
);
if
(
lResult
!=
ERROR_SUCCESS
)
{
RegCloseKey
(
hKey
);
I
Malloc_Free
(
ppM
,
pidlMyDocuments
);
I
LFree
(
pidlMyDocuments
);
IShellFolder_Release
(
psfDesktop
);
return
;
}
...
...
@@ -916,7 +910,7 @@ static void test_CallForAttributes(void)
RegSetValueExW
(
hKey
,
wszCallForAttributes
,
0
,
REG_DWORD
,
(
LPBYTE
)
&
dwOrigCallForAttributes
,
sizeof
(
DWORD
));
RegCloseKey
(
hKey
);
I
Malloc_Free
(
ppM
,
pidlMyDocuments
);
I
LFree
(
pidlMyDocuments
);
IShellFolder_Release
(
psfDesktop
);
}
...
...
@@ -978,7 +972,7 @@ static void test_GetAttributesOf(void)
hr
=
IShellFolder_BindToObject
(
psfDesktop
,
pidlMyComputer
,
NULL
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
psfMyComputer
);
ok
(
hr
==
S_OK
,
"Desktop failed to bind to MyComputer object! hr = %08x
\n
"
,
hr
);
IShellFolder_Release
(
psfDesktop
);
I
Malloc_Free
(
ppM
,
pidlMyComputer
);
I
LFree
(
pidlMyComputer
);
if
(
hr
!=
S_OK
)
return
;
hr
=
IShellFolder_GetAttributesOf
(
psfMyComputer
,
1
,
&
pidlEmpty
,
&
dwFlags
);
...
...
@@ -1017,7 +1011,7 @@ static void test_GetAttributesOf(void)
hr
=
IShellFolder_BindToObject
(
IDesktopFolder
,
newPIDL
,
NULL
,
(
REFIID
)
&
IID_IShellFolder
,
(
LPVOID
*
)
&
testIShellFolder
);
ok
(
hr
==
S_OK
,
"BindToObject failed %08x
\n
"
,
hr
);
I
Malloc_Free
(
ppM
,
newPIDL
);
I
LFree
(
newPIDL
);
/* get relative PIDL */
hr
=
IShellFolder_ParseDisplayName
(
testIShellFolder
,
NULL
,
NULL
,
cTestDirW
,
NULL
,
&
newPIDL
,
0
);
...
...
@@ -1030,7 +1024,7 @@ static void test_GetAttributesOf(void)
ok
((
dwFlags
&
SFGAO_FOLDER
),
"Wrong directory attribute for relative PIDL: %08x
\n
"
,
dwFlags
);
/* free memory */
I
Malloc_Free
(
ppM
,
newPIDL
);
I
LFree
(
newPIDL
);
/* append testdirectory name to path */
if
(
cCurrDirA
[
len
-
1
]
==
'\\'
)
...
...
@@ -1048,7 +1042,7 @@ static void test_GetAttributesOf(void)
ok
((
dwFlags
&
SFGAO_FOLDER
),
"Wrong directory attribute for absolute PIDL: %08x
\n
"
,
dwFlags
);
/* free memory */
I
Malloc_Free
(
ppM
,
newPIDL
);
I
LFree
(
newPIDL
);
IShellFolder_Release
(
testIShellFolder
);
...
...
@@ -1120,7 +1114,7 @@ static void test_SHGetPathFromIDList(void)
return
;
}
I
Malloc_Free
(
ppM
,
pidlMyComputer
);
I
LFree
(
pidlMyComputer
);
result
=
SHGetSpecialFolderPathW
(
NULL
,
wszFileName
,
CSIDL_DESKTOPDIRECTORY
,
FALSE
);
ok
(
result
,
"SHGetSpecialFolderPathW failed! Last error: %u
\n
"
,
GetLastError
());
...
...
@@ -1143,7 +1137,7 @@ static void test_SHGetPathFromIDList(void)
if
(
hr
!=
S_OK
)
{
IShellFolder_Release
(
psfDesktop
);
DeleteFileW
(
wszFileName
);
I
Malloc_Free
(
ppM
,
pidlTestFile
);
I
LFree
(
pidlTestFile
);
return
;
}
...
...
@@ -1154,7 +1148,7 @@ static void test_SHGetPathFromIDList(void)
IShellFolder_Release
(
psfDesktop
);
DeleteFileW
(
wszFileName
);
if
(
hr
!=
S_OK
)
{
I
Malloc_Free
(
ppM
,
pidlTestFile
);
I
LFree
(
pidlTestFile
);
return
;
}
StrRetToBufW
(
&
strret
,
pidlTestFile
,
wszPath
,
MAX_PATH
);
...
...
@@ -1191,7 +1185,7 @@ static void test_SHGetPathFromIDList(void)
else
win_skip
(
"SHGetPathFromIDListEx not available
\n
"
);
I
Malloc_Free
(
ppM
,
pidlTestFile
);
I
LFree
(
pidlTestFile
);
/* Test if we can get the path from the start menu "program files" PIDL. */
hr
=
SHGetSpecialFolderLocation
(
NULL
,
CSIDL_PROGRAM_FILES
,
&
pidlPrograms
);
...
...
@@ -1199,7 +1193,7 @@ static void test_SHGetPathFromIDList(void)
SetLastError
(
0xdeadbeef
);
result
=
SHGetPathFromIDListW
(
pidlPrograms
,
wszPath
);
I
Malloc_Free
(
ppM
,
pidlPrograms
);
I
LFree
(
pidlPrograms
);
ok
(
result
,
"SHGetPathFromIDListW failed
\n
"
);
}
...
...
@@ -1243,7 +1237,7 @@ static void test_EnumObjects_and_CompareIDs(void)
Cleanup
();
I
Malloc_Free
(
ppM
,
newPIDL
);
I
LFree
(
newPIDL
);
IShellFolder_Release
(
IDesktopFolder
);
}
...
...
@@ -1948,7 +1942,7 @@ static void test_LocalizedNames(void)
hr
=
IShellFolder_BindToObject
(
IDesktopFolder
,
newPIDL
,
NULL
,
(
REFIID
)
&
IID_IShellFolder
,
(
LPVOID
*
)
&
testIShellFolder
);
ok
(
hr
==
S_OK
,
"BindToObject failed %08x
\n
"
,
hr
);
I
Malloc_Free
(
ppM
,
newPIDL
);
I
LFree
(
newPIDL
);
/* windows reads the display name from the resource */
hr
=
IShellFolder_ParseDisplayName
(
testIShellFolder
,
NULL
,
NULL
,
foldernameW
,
NULL
,
&
newPIDL
,
0
);
...
...
@@ -1982,7 +1976,7 @@ static void test_LocalizedNames(void)
IShellFolder_Release
(
IDesktopFolder
);
IShellFolder_Release
(
testIShellFolder
);
I
Malloc_Free
(
ppM
,
newPIDL
);
I
LFree
(
newPIDL
);
cleanup:
DeleteFileA
(
".
\\
testfolder
\\
desktop.ini"
);
...
...
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