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
dca38ea8
Commit
dca38ea8
authored
Jan 12, 2018
by
Alex Henrie
Committed by
Alexandre Julliard
Jan 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32/tests: Drop shell folder test dynamic imports for Windows <= 2000.
Signed-off-by:
Alex Henrie
<
alexhenrie24@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
258dc94c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
238 additions
and
434 deletions
+238
-434
shlfolder.c
dlls/shell32/tests/shlfolder.c
+238
-434
No files found.
dlls/shell32/tests/shlfolder.c
View file @
dca38ea8
...
...
@@ -45,17 +45,6 @@ DEFINE_GUID(CLSID_ShellDocObjView, 0xe7e4bc40, 0xe76a, 0x11ce, 0xa9,0xbb, 0x00,0
static
IMalloc
*
ppM
;
static
HRESULT
(
WINAPI
*
pSHBindToParent
)(
LPCITEMIDLIST
,
REFIID
,
LPVOID
*
,
LPCITEMIDLIST
*
);
static
HRESULT
(
WINAPI
*
pSHGetFolderPathA
)(
HWND
,
int
,
HANDLE
,
DWORD
,
LPSTR
);
static
HRESULT
(
WINAPI
*
pSHGetFolderPathAndSubDirA
)(
HWND
,
int
,
HANDLE
,
DWORD
,
LPCSTR
,
LPSTR
);
static
BOOL
(
WINAPI
*
pSHGetPathFromIDListW
)(
LPCITEMIDLIST
,
LPWSTR
);
static
HRESULT
(
WINAPI
*
pSHGetSpecialFolderLocation
)(
HWND
,
int
,
LPITEMIDLIST
*
);
static
BOOL
(
WINAPI
*
pSHGetSpecialFolderPathA
)(
HWND
,
LPSTR
,
int
,
BOOL
);
static
BOOL
(
WINAPI
*
pSHGetSpecialFolderPathW
)(
HWND
,
LPWSTR
,
int
,
BOOL
);
static
HRESULT
(
WINAPI
*
pStrRetToBufW
)(
STRRET
*
,
LPCITEMIDLIST
,
LPWSTR
,
UINT
);
static
LPITEMIDLIST
(
WINAPI
*
pILFindLastID
)(
LPCITEMIDLIST
);
static
void
(
WINAPI
*
pILFree
)(
LPITEMIDLIST
);
static
BOOL
(
WINAPI
*
pILIsEqual
)(
LPCITEMIDLIST
,
LPCITEMIDLIST
);
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
**
);
...
...
@@ -65,18 +54,13 @@ static HRESULT (WINAPI *pSHCreateShellItemArray)(LPCITEMIDLIST,IShellFolder*,UIN
static
HRESULT
(
WINAPI
*
pSHCreateShellItemArrayFromIDLists
)(
UINT
,
PCIDLIST_ABSOLUTE
*
,
IShellItemArray
**
);
static
HRESULT
(
WINAPI
*
pSHCreateShellItemArrayFromDataObject
)(
IDataObject
*
,
REFIID
,
void
**
);
static
HRESULT
(
WINAPI
*
pSHCreateShellItemArrayFromShellItem
)(
IShellItem
*
,
REFIID
,
void
**
);
static
LPITEMIDLIST
(
WINAPI
*
pILCombine
)(
LPCITEMIDLIST
,
LPCITEMIDLIST
);
static
HRESULT
(
WINAPI
*
pSHParseDisplayName
)(
LPCWSTR
,
IBindCtx
*
,
LPITEMIDLIST
*
,
SFGAOF
,
SFGAOF
*
);
static
LPITEMIDLIST
(
WINAPI
*
pSHSimpleIDListFromPathAW
)(
LPCVOID
);
static
HRESULT
(
WINAPI
*
pSHGetKnownFolderPath
)(
REFKNOWNFOLDERID
,
DWORD
,
HANDLE
,
PWSTR
*
);
static
HRESULT
(
WINAPI
*
pSHGetNameFromIDList
)(
PCIDLIST_ABSOLUTE
,
SIGDN
,
PWSTR
*
);
static
HRESULT
(
WINAPI
*
pSHGetItemFromDataObject
)(
IDataObject
*
,
DATAOBJ_GET_ITEM_FLAGS
,
REFIID
,
void
**
);
static
HRESULT
(
WINAPI
*
pSHGetIDListFromObject
)(
IUnknown
*
,
PIDLIST_ABSOLUTE
*
);
static
HRESULT
(
WINAPI
*
pSHGetItemFromObject
)(
IUnknown
*
,
REFIID
,
void
**
);
static
BOOL
(
WINAPI
*
pIsWow64Process
)(
HANDLE
,
PBOOL
);
static
UINT
(
WINAPI
*
pGetSystemWow64DirectoryW
)(
LPWSTR
,
UINT
);
static
HRESULT
(
WINAPI
*
pSHCreateDefaultContextMenu
)(
const
DEFCONTEXTMENU
*
,
REFIID
,
void
**
);
static
HRESULT
(
WINAPI
*
pSHILCreateFromPath
)(
LPCWSTR
,
LPITEMIDLIST
*
,
DWORD
*
);
static
BOOL
(
WINAPI
*
pSHGetPathFromIDListEx
)(
PCIDLIST_ABSOLUTE
,
WCHAR
*
,
DWORD
,
GPFIDL_FLAGS
);
static
WCHAR
*
make_wstr
(
const
char
*
str
)
...
...
@@ -115,7 +99,6 @@ static void init_function_pointers(void)
hmod
=
GetModuleHandleA
(
"shell32.dll"
);
#define MAKEFUNC(f) (p##f = (void*)GetProcAddress(hmod, #f))
MAKEFUNC
(
SHBindToParent
);
MAKEFUNC
(
SHCreateItemFromIDList
);
MAKEFUNC
(
SHCreateItemFromParsingName
);
MAKEFUNC
(
SHCreateItemFromRelativeName
);
...
...
@@ -125,13 +108,6 @@ static void init_function_pointers(void)
MAKEFUNC
(
SHCreateShellItemArrayFromIDLists
);
MAKEFUNC
(
SHCreateShellItemArrayFromDataObject
);
MAKEFUNC
(
SHCreateShellItemArrayFromShellItem
);
MAKEFUNC
(
SHGetFolderPathA
);
MAKEFUNC
(
SHGetFolderPathAndSubDirA
);
MAKEFUNC
(
SHGetPathFromIDListW
);
MAKEFUNC
(
SHGetSpecialFolderPathA
);
MAKEFUNC
(
SHGetSpecialFolderPathW
);
MAKEFUNC
(
SHGetSpecialFolderLocation
);
MAKEFUNC
(
SHParseDisplayName
);
MAKEFUNC
(
SHGetKnownFolderPath
);
MAKEFUNC
(
SHGetNameFromIDList
);
MAKEFUNC
(
SHGetItemFromDataObject
);
...
...
@@ -141,15 +117,6 @@ static void init_function_pointers(void)
MAKEFUNC
(
SHGetPathFromIDListEx
);
#undef MAKEFUNC
#define MAKEFUNC_ORD(f, ord) (p##f = (void*)GetProcAddress(hmod, (LPSTR)(ord)))
MAKEFUNC_ORD
(
ILFindLastID
,
16
);
MAKEFUNC_ORD
(
ILIsEqual
,
21
);
MAKEFUNC_ORD
(
ILCombine
,
25
);
MAKEFUNC_ORD
(
SHILCreateFromPath
,
28
);
MAKEFUNC_ORD
(
ILFree
,
155
);
MAKEFUNC_ORD
(
SHSimpleIDListFromPathAW
,
162
);
#undef MAKEFUNC_ORD
/* test named exports */
ptr
=
GetProcAddress
(
hmod
,
"ILFree"
);
ok
(
broken
(
ptr
==
0
)
||
ptr
!=
0
,
"expected named export for ILFree
\n
"
);
...
...
@@ -177,12 +144,8 @@ static void init_function_pointers(void)
#undef TESTNAMED
}
hmod
=
GetModuleHandleA
(
"shlwapi.dll"
);
pStrRetToBufW
=
(
void
*
)
GetProcAddress
(
hmod
,
"StrRetToBufW"
);
hmod
=
GetModuleHandleA
(
"kernel32.dll"
);
pIsWow64Process
=
(
void
*
)
GetProcAddress
(
hmod
,
"IsWow64Process"
);
pGetSystemWow64DirectoryW
=
(
void
*
)
GetProcAddress
(
hmod
,
"GetSystemWow64DirectoryW"
);
hr
=
SHGetMalloc
(
&
ppM
);
ok
(
hr
==
S_OK
,
"SHGetMalloc failed %08x
\n
"
,
hr
);
...
...
@@ -225,12 +188,11 @@ static void test_ParseDisplayName(void)
ok
(
hr
==
S_OK
,
"Expected SHGetDesktopFolder to return S_OK, got 0x%08x
\n
"
,
hr
);
if
(
hr
!=
S_OK
)
return
;
/* Tests crash on W2K and below (SHCreateShellItem available as of XP) */
if
(
pSHCreateShellItem
)
{
if
(
0
)
{
/* null name and pidl,
also
crashes on Windows 8 */
/* null name and pidl, crashes on Windows 8 */
hr
=
IShellFolder_ParseDisplayName
(
IDesktopFolder
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
0
);
ok
(
hr
==
E_INVALIDARG
,
"returned %08x, expected E_INVALIDARG
\n
"
,
hr
);
...
...
@@ -244,7 +206,7 @@ static void test_ParseDisplayName(void)
ok
(
hr
==
E_INVALIDARG
,
"returned %08x, expected E_INVALIDARG
\n
"
,
hr
);
}
else
win_skip
(
"
Tests would crash on W2K and below
\n
"
);
win_skip
(
"
SHCreateShellItem requires XP SP1 or later
\n
"
);
MultiByteToWideChar
(
CP_ACP
,
0
,
cInetTestA
,
-
1
,
cTestDirW
,
MAX_PATH
);
hr
=
IShellFolder_ParseDisplayName
(
IDesktopFolder
,
...
...
@@ -253,8 +215,8 @@ static void test_ParseDisplayName(void)
"ParseDisplayName returned %08x, expected SUCCESS or E_FAIL
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
ok
(
p
ILFindLastID
(
newPIDL
)
->
mkid
.
abID
[
0
]
==
0x61
,
"Last pidl should be of type "
"PT_IESPECIAL1, but is: %02x
\n
"
,
p
ILFindLastID
(
newPIDL
)
->
mkid
.
abID
[
0
]);
ok
(
ILFindLastID
(
newPIDL
)
->
mkid
.
abID
[
0
]
==
0x61
,
"Last pidl should be of type "
"PT_IESPECIAL1, but is: %02x
\n
"
,
ILFindLastID
(
newPIDL
)
->
mkid
.
abID
[
0
]);
IMalloc_Free
(
ppM
,
newPIDL
);
}
...
...
@@ -265,8 +227,8 @@ static void test_ParseDisplayName(void)
"ParseDisplayName returned %08x, expected SUCCESS or E_FAIL
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
ok
(
p
ILFindLastID
(
newPIDL
)
->
mkid
.
abID
[
0
]
==
0x61
,
"Last pidl should be of type "
"PT_IESPECIAL1, but is: %02x
\n
"
,
p
ILFindLastID
(
newPIDL
)
->
mkid
.
abID
[
0
]);
ok
(
ILFindLastID
(
newPIDL
)
->
mkid
.
abID
[
0
]
==
0x61
,
"Last pidl should be of type "
"PT_IESPECIAL1, but is: %02x
\n
"
,
ILFindLastID
(
newPIDL
)
->
mkid
.
abID
[
0
]);
IMalloc_Free
(
ppM
,
newPIDL
);
}
...
...
@@ -299,13 +261,8 @@ static void test_ParseDisplayName(void)
/* I thought that perhaps the DesktopFolder's ParseDisplayName would recognize the
* path corresponding to CSIDL_PERSONAL and return a CLSID_MyDocuments PIDL. Turns
* out it doesn't. The magic seems to happen in the file dialogs, then. */
if
(
!
pSHGetSpecialFolderPathW
||
!
pILFindLastID
)
{
win_skip
(
"SHGetSpecialFolderPathW and/or ILFindLastID are not available
\n
"
);
goto
finished
;
}
bRes
=
p
SHGetSpecialFolderPathW
(
NULL
,
cTestDirW
,
CSIDL_PERSONAL
,
FALSE
);
bRes
=
SHGetSpecialFolderPathW
(
NULL
,
cTestDirW
,
CSIDL_PERSONAL
,
FALSE
);
ok
(
bRes
,
"SHGetSpecialFolderPath(CSIDL_PERSONAL) failed! %u
\n
"
,
GetLastError
());
if
(
!
bRes
)
goto
finished
;
...
...
@@ -313,12 +270,11 @@ static void test_ParseDisplayName(void)
ok
(
hr
==
S_OK
,
"DesktopFolder->ParseDisplayName failed. hr = %08x.
\n
"
,
hr
);
if
(
hr
!=
S_OK
)
goto
finished
;
ok
(
pILFindLastID
(
newPIDL
)
->
mkid
.
abID
[
0
]
==
0x31
||
pILFindLastID
(
newPIDL
)
->
mkid
.
abID
[
0
]
==
0xb1
,
/* Win98 */
"Last pidl should be of type PT_FOLDER or PT_IESPECIAL2, but is: %02x
\n
"
,
pILFindLastID
(
newPIDL
)
->
mkid
.
abID
[
0
]);
ok
(
ILFindLastID
(
newPIDL
)
->
mkid
.
abID
[
0
]
==
0x31
,
"Last pidl should be of type PT_FOLDER, but is: %02x
\n
"
,
ILFindLastID
(
newPIDL
)
->
mkid
.
abID
[
0
]);
IMalloc_Free
(
ppM
,
newPIDL
);
finished:
IShellFolder_Release
(
IDesktopFolder
);
}
...
...
@@ -602,7 +558,7 @@ if (0)
IShellFolder_Release
(
psfChild
);
}
p
ILFree
(
pidl
);
ILFree
(
pidl
);
}
DeleteFileA
(
pathA
);
}
...
...
@@ -628,7 +584,7 @@ if (0)
broken
(
hr
==
S_OK
),
/* Win9x, NT4, W2K */
"Got 0x%08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
IShellFolder_Release
(
psfChild
);
p
ILFree
(
pidl
);
ILFree
(
pidl
);
}
DeleteFileA
(
pathA
);
}
...
...
@@ -654,7 +610,7 @@ if (0)
broken
(
hr
==
S_OK
),
/* Win9x, NT4, W2K */
"Got 0x%08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
IShellFolder_Release
(
psfChild
);
p
ILFree
(
pidl
);
ILFree
(
pidl
);
}
DeleteFileA
(
pathA
);
}
...
...
@@ -662,59 +618,42 @@ if (0)
win_skip
(
"Failed to create .foo testfile.
\n
"
);
/* And on the desktop */
if
(
pSHGetSpecialFolderPathA
)
{
pSHGetSpecialFolderPathA
(
NULL
,
pathA
,
CSIDL_DESKTOP
,
FALSE
);
lstrcatA
(
pathA
,
"
\\
"
);
lstrcatA
(
pathA
,
filename_html
);
hfile
=
CreateFileA
(
pathA
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
NULL
);
if
(
hfile
!=
INVALID_HANDLE_VALUE
)
{
CloseHandle
(
hfile
);
MultiByteToWideChar
(
CP_ACP
,
0
,
pathA
,
-
1
,
path
,
MAX_PATH
);
hr
=
IShellFolder_ParseDisplayName
(
psfDesktop
,
NULL
,
NULL
,
path
,
NULL
,
&
pidl
,
NULL
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IShellFolder_BindToObject
(
psfDesktop
,
pidl
,
NULL
,
&
IID_IShellFolder
,
(
void
**
)
&
psfChild
);
ok
(
hr
==
S_OK
||
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
),
/* XP, W2K3 */
"Got 0x%08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
IShellFolder_Release
(
psfChild
);
pILFree
(
pidl
);
}
if
(
!
DeleteFileA
(
pathA
))
trace
(
"Failed to delete: %d
\n
"
,
GetLastError
());
SHGetSpecialFolderPathA
(
NULL
,
pathA
,
CSIDL_DESKTOP
,
FALSE
);
lstrcatA
(
pathA
,
"
\\
"
);
lstrcatA
(
pathA
,
filename_html
);
hfile
=
CreateFileA
(
pathA
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
NULL
);
}
else
win_skip
(
"Failed to create .html testfile.
\n
"
);
CloseHandle
(
hfile
);
MultiByteToWideChar
(
CP_ACP
,
0
,
pathA
,
-
1
,
path
,
MAX_PATH
);
hr
=
IShellFolder_ParseDisplayName
(
psfDesktop
,
NULL
,
NULL
,
path
,
NULL
,
&
pidl
,
NULL
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
pSHGetSpecialFolderPathA
(
NULL
,
pathA
,
CSIDL_DESKTOP
,
FALSE
);
lstrcatA
(
pathA
,
"
\\
"
);
lstrcatA
(
pathA
,
filename_foo
);
hfile
=
CreateFileA
(
pathA
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
NULL
);
if
(
hfile
!=
INVALID_HANDLE_VALUE
)
{
CloseHandle
(
hfile
);
MultiByteToWideChar
(
CP_ACP
,
0
,
pathA
,
-
1
,
path
,
MAX_PATH
);
hr
=
IShellFolder_ParseDisplayName
(
psfDesktop
,
NULL
,
NULL
,
path
,
NULL
,
&
pidl
,
NULL
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IShellFolder_BindToObject
(
psfDesktop
,
pidl
,
NULL
,
&
IID_IShellFolder
,
(
void
**
)
&
psfChild
);
ok
(
hr
==
E_FAIL
||
/* Vista+ */
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
)
||
/* XP, W2K3 */
broken
(
hr
==
S_OK
),
/* Win9x, NT4, W2K */
"Got 0x%08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
IShellFolder_Release
(
psfChild
);
pILFree
(
pidl
);
}
DeleteFileA
(
pathA
);
}
else
win_skip
(
"Failed to create .foo testfile.
\n
"
);
}
hr
=
IShellFolder_BindToObject
(
psfDesktop
,
pidl
,
NULL
,
&
IID_IShellFolder
,
(
void
**
)
&
psfChild
);
ok
(
hr
==
S_OK
||
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
),
/* XP, W2K3 */
"Got 0x%08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
IShellFolder_Release
(
psfChild
);
ILFree
(
pidl
);
if
(
!
DeleteFileA
(
pathA
))
trace
(
"Failed to delete: %d
\n
"
,
GetLastError
());
SHGetSpecialFolderPathA
(
NULL
,
pathA
,
CSIDL_DESKTOP
,
FALSE
);
lstrcatA
(
pathA
,
"
\\
"
);
lstrcatA
(
pathA
,
filename_foo
);
hfile
=
CreateFileA
(
pathA
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
NULL
);
CloseHandle
(
hfile
);
MultiByteToWideChar
(
CP_ACP
,
0
,
pathA
,
-
1
,
path
,
MAX_PATH
);
hr
=
IShellFolder_ParseDisplayName
(
psfDesktop
,
NULL
,
NULL
,
path
,
NULL
,
&
pidl
,
NULL
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
hr
=
IShellFolder_BindToObject
(
psfDesktop
,
pidl
,
NULL
,
&
IID_IShellFolder
,
(
void
**
)
&
psfChild
);
ok
(
hr
==
E_FAIL
||
/* Vista+ */
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
),
/* XP, W2K3 */
"Got 0x%08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
IShellFolder_Release
(
psfChild
);
ILFree
(
pidl
);
DeleteFileA
(
pathA
);
IShellFolder_Release
(
psfDesktop
);
}
...
...
@@ -737,6 +676,10 @@ static void test_GetDisplayName(void)
static
const
WCHAR
wszFileName
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
't'
,
'e'
,
's'
,
't'
,
'.'
,
'f'
,
'o'
,
'o'
,
0
};
static
const
WCHAR
wszDirName
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
't'
,
'e'
,
's'
,
't'
,
0
};
/* It's ok to use this fixed path. Call will fail anyway. */
WCHAR
wszAbsoluteFilename
[]
=
{
'C'
,
':'
,
'\\'
,
'w'
,
'i'
,
'n'
,
'e'
,
't'
,
'e'
,
's'
,
't'
,
0
};
LPITEMIDLIST
pidlNew
;
/* I'm trying to figure if there is a functional difference between calling
* SHGetPathFromIDListW and calling GetDisplayNameOf(SHGDN_FORPARSING) after
* binding to the shellfolder. One thing I thought of was that perhaps
...
...
@@ -745,13 +688,8 @@ static void test_GetDisplayName(void)
* no functional difference in this respect.
*/
if
(
!
pSHGetSpecialFolderPathA
)
{
win_skip
(
"SHGetSpecialFolderPathA is not available
\n
"
);
return
;
}
/* First creating a directory in MyDocuments and a file in this directory. */
result
=
p
SHGetSpecialFolderPathA
(
NULL
,
szTestDir
,
CSIDL_PERSONAL
,
FALSE
);
result
=
SHGetSpecialFolderPathA
(
NULL
,
szTestDir
,
CSIDL_PERSONAL
,
FALSE
);
ok
(
result
,
"SHGetSpecialFolderPathA failed! Last error: %u
\n
"
,
GetLastError
());
if
(
!
result
)
return
;
...
...
@@ -787,7 +725,7 @@ static void test_GetDisplayName(void)
return
;
}
pidlLast
=
p
ILFindLastID
(
pidlTestFile
);
pidlLast
=
ILFindLastID
(
pidlTestFile
);
ok
(
pidlLast
->
mkid
.
cb
>=
76
||
broken
(
pidlLast
->
mkid
.
cb
==
28
)
||
/* W2K */
broken
(
pidlLast
->
mkid
.
cb
==
40
),
/* Win9x, WinME */
...
...
@@ -816,77 +754,52 @@ static void test_GetDisplayName(void)
IUnknown_Release
(
psfFile
);
}
if
(
!
pSHBindToParent
)
{
win_skip
(
"SHBindToParent is missing
\n
"
);
DeleteFileA
(
szTestFile
);
RemoveDirectoryA
(
szTestDir
);
return
;
}
/* Some tests for IShellFolder::SetNameOf */
if
(
pSHGetFolderPathAndSubDirA
)
{
hr
=
pSHBindToParent
(
pidlTestFile
,
&
IID_IShellFolder
,
(
VOID
**
)
&
psfPersonal
,
&
pidlLast
);
ok
(
hr
==
S_OK
,
"SHBindToParent failed! hr = %08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
/* It's ok to use this fixed path. Call will fail anyway. */
WCHAR
wszAbsoluteFilename
[]
=
{
'C'
,
':'
,
'\\'
,
'w'
,
'i'
,
'n'
,
'e'
,
't'
,
'e'
,
's'
,
't'
,
0
};
LPITEMIDLIST
pidlNew
;
/* The pidl returned through the last parameter of SetNameOf is a simple one. */
hr
=
IShellFolder_SetNameOf
(
psfPersonal
,
NULL
,
pidlLast
,
wszDirName
,
SHGDN_NORMAL
,
&
pidlNew
);
ok
(
hr
==
S_OK
,
"SetNameOf failed! hr = %08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
ok
(((
LPITEMIDLIST
)((
LPBYTE
)
pidlNew
+
pidlNew
->
mkid
.
cb
))
->
mkid
.
cb
==
0
,
"pidl returned from SetNameOf should be simple!
\n
"
);
hr
=
SHBindToParent
(
pidlTestFile
,
&
IID_IShellFolder
,
(
void
**
)
&
psfPersonal
,
&
pidlLast
);
ok
(
hr
==
S_OK
,
"SHBindToParent failed! hr = %08x
\n
"
,
hr
);
/* Passing an absolute path to SetNameOf fails. The HRESULT code indicates that SetNameOf
* is implemented on top of SHFileOperation in WinXP. */
hr
=
IShellFolder_SetNameOf
(
psfPersonal
,
NULL
,
pidlNew
,
wszAbsoluteFilename
,
SHGDN_FORPARSING
,
NULL
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_CANCELLED
),
"SetNameOf succeeded! hr = %08x
\n
"
,
hr
);
/* The pidl returned through the last parameter of SetNameOf is a simple one. */
hr
=
IShellFolder_SetNameOf
(
psfPersonal
,
NULL
,
pidlLast
,
wszDirName
,
SHGDN_NORMAL
,
&
pidlNew
);
ok
(
hr
==
S_OK
,
"SetNameOf failed! hr = %08x
\n
"
,
hr
);
/* Rename the file back to its original name. SetNameOf ignores the fact, that the
* SHGDN flags specify an absolute path. */
hr
=
IShellFolder_SetNameOf
(
psfPersonal
,
NULL
,
pidlNew
,
wszFileName
,
SHGDN_FORPARSING
,
NULL
);
ok
(
hr
==
S_OK
,
"SetNameOf failed! hr = %08x
\n
"
,
hr
);
ok
(((
ITEMIDLIST
*
)((
BYTE
*
)
pidlNew
+
pidlNew
->
mkid
.
cb
))
->
mkid
.
cb
==
0
,
"pidl returned from SetNameOf should be simple!
\n
"
);
pILFree
(
pidlNew
);
}
/* Passing an absolute path to SetNameOf fails. The HRESULT code indicates that SetNameOf
* is implemented on top of SHFileOperation in WinXP. */
hr
=
IShellFolder_SetNameOf
(
psfPersonal
,
NULL
,
pidlNew
,
wszAbsoluteFilename
,
SHGDN_FORPARSING
,
NULL
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_CANCELLED
),
"SetNameOf succeeded! hr = %08x
\n
"
,
hr
);
IShellFolder_Release
(
psfPersonal
);
}
}
else
win_skip
(
"Avoid needs of interaction on Win2k
\n
"
);
/* Rename the file back to its original name. SetNameOf ignores the fact, that the
* SHGDN flags specify an absolute path. */
hr
=
IShellFolder_SetNameOf
(
psfPersonal
,
NULL
,
pidlNew
,
wszFileName
,
SHGDN_FORPARSING
,
NULL
);
ok
(
hr
==
S_OK
,
"SetNameOf failed! hr = %08x
\n
"
,
hr
);
ILFree
(
pidlNew
);
IShellFolder_Release
(
psfPersonal
);
/* Deleting the file and the directory */
DeleteFileA
(
szTestFile
);
RemoveDirectoryA
(
szTestDir
);
/* SHGetPathFromIDListW still works, although the file is not present anymore. */
if
(
pSHGetPathFromIDListW
)
{
result
=
pSHGetPathFromIDListW
(
pidlTestFile
,
wszTestFile2
);
ok
(
result
,
"SHGetPathFromIDListW failed! Last error: %u
\n
"
,
GetLastError
());
ok
(
!
lstrcmpiW
(
wszTestFile
,
wszTestFile2
),
"SHGetPathFromIDListW returns incorrect path!
\n
"
);
}
result
=
SHGetPathFromIDListW
(
pidlTestFile
,
wszTestFile2
);
ok
(
result
,
"SHGetPathFromIDListW failed! Last error: %u
\n
"
,
GetLastError
());
ok
(
!
lstrcmpiW
(
wszTestFile
,
wszTestFile2
),
"SHGetPathFromIDListW returns incorrect path!
\n
"
);
/* SHBindToParent fails, if called with a NULL PIDL. */
hr
=
pSHBindToParent
(
NULL
,
&
IID_IShellFolder
,
(
VOID
**
)
&
psfPersonal
,
&
pidlLast
);
hr
=
SHBindToParent
(
NULL
,
&
IID_IShellFolder
,
(
void
**
)
&
psfPersonal
,
&
pidlLast
);
ok
(
hr
!=
S_OK
,
"SHBindToParent(NULL) should fail!
\n
"
);
/* But it succeeds with an empty PIDL. */
hr
=
pSHBindToParent
(
pidlEmpty
,
&
IID_IShellFolder
,
(
VOID
**
)
&
psfPersonal
,
&
pidlLast
);
hr
=
SHBindToParent
(
pidlEmpty
,
&
IID_IShellFolder
,
(
void
**
)
&
psfPersonal
,
&
pidlLast
);
ok
(
hr
==
S_OK
,
"SHBindToParent(empty PIDL) should succeed! hr = %08x
\n
"
,
hr
);
ok
(
pidlLast
==
pidlEmpty
,
"The last element of an empty PIDL should be the PIDL itself!
\n
"
);
if
(
hr
==
S_OK
)
IShellFolder_Release
(
psfPersonal
);
/* Binding to the folder and querying the display name of the file also works. */
hr
=
pSHBindToParent
(
pidlTestFile
,
&
IID_IShellFolder
,
(
VOID
**
)
&
psfPersonal
,
&
pidlLast
);
hr
=
SHBindToParent
(
pidlTestFile
,
&
IID_IShellFolder
,
(
void
**
)
&
psfPersonal
,
&
pidlLast
);
ok
(
hr
==
S_OK
,
"SHBindToParent failed! hr = %08x
\n
"
,
hr
);
if
(
hr
!=
S_OK
)
{
IShellFolder_Release
(
psfDesktop
);
...
...
@@ -895,9 +808,9 @@ static void test_GetDisplayName(void)
/* This test shows that Windows doesn't allocate a new pidlLast, but returns a pointer into
* pidlTestFile (In accordance with MSDN). */
ok
(
pILFindLastID
(
pidlTestFile
)
==
pidlLast
,
ok
(
ILFindLastID
(
pidlTestFile
)
==
pidlLast
,
"SHBindToParent doesn't return the last id of the pidl param!
\n
"
);
hr
=
IShellFolder_GetDisplayNameOf
(
psfPersonal
,
pidlLast
,
SHGDN_FORPARSING
,
&
strret
);
ok
(
hr
==
S_OK
,
"Personal->GetDisplayNameOf failed! hr = %08x
\n
"
,
hr
);
if
(
hr
!=
S_OK
)
{
...
...
@@ -906,13 +819,10 @@ static void test_GetDisplayName(void)
return
;
}
if
(
pStrRetToBufW
)
{
hr
=
pStrRetToBufW
(
&
strret
,
pidlLast
,
wszTestFile2
,
MAX_PATH
);
ok
(
hr
==
S_OK
,
"StrRetToBufW failed! hr = %08x
\n
"
,
hr
);
ok
(
!
lstrcmpiW
(
wszTestFile
,
wszTestFile2
),
"GetDisplayNameOf returns incorrect path!
\n
"
);
}
hr
=
StrRetToBufW
(
&
strret
,
pidlLast
,
wszTestFile2
,
MAX_PATH
);
ok
(
hr
==
S_OK
,
"StrRetToBufW failed! hr = %08x
\n
"
,
hr
);
ok
(
!
lstrcmpiW
(
wszTestFile
,
wszTestFile2
),
"GetDisplayNameOf returns incorrect path!
\n
"
);
ILFree
(
pidlTestFile
);
IShellFolder_Release
(
psfDesktop
);
IShellFolder_Release
(
psfPersonal
);
...
...
@@ -1246,21 +1156,15 @@ static void test_SHGetPathFromIDList(void)
'w'
,
'i'
,
'n'
,
'e'
,
't'
,
'e'
,
's'
,
't'
,
'.'
,
'f'
,
'o'
,
'o'
,
0
};
LPITEMIDLIST
pidlPrograms
;
if
(
!
pSHGetPathFromIDListW
||
!
pSHGetSpecialFolderPathW
)
{
win_skip
(
"SHGetPathFromIDListW() or SHGetSpecialFolderPathW() is missing
\n
"
);
return
;
}
/* Calling SHGetPathFromIDListW with no pidl should return the empty string */
wszPath
[
0
]
=
'a'
;
wszPath
[
1
]
=
'\0'
;
result
=
p
SHGetPathFromIDListW
(
NULL
,
wszPath
);
result
=
SHGetPathFromIDListW
(
NULL
,
wszPath
);
ok
(
!
result
,
"Expected failure
\n
"
);
ok
(
!
wszPath
[
0
],
"Expected empty string
\n
"
);
/* Calling SHGetPathFromIDListW with an empty pidl should return the desktop folder's path. */
result
=
p
SHGetSpecialFolderPathW
(
NULL
,
wszDesktop
,
CSIDL_DESKTOP
,
FALSE
);
result
=
SHGetSpecialFolderPathW
(
NULL
,
wszDesktop
,
CSIDL_DESKTOP
,
FALSE
);
ok
(
result
,
"SHGetSpecialFolderPathW(CSIDL_DESKTOP) failed! Last error: %u
\n
"
,
GetLastError
());
if
(
!
result
)
return
;
...
...
@@ -1273,7 +1177,7 @@ static void test_SHGetPathFromIDList(void)
return
;
}
result
=
p
SHGetPathFromIDListW
(
pidlEmpty
,
wszPath
);
result
=
SHGetPathFromIDListW
(
pidlEmpty
,
wszPath
);
ok
(
result
,
"SHGetPathFromIDListW failed! Last error: %u
\n
"
,
GetLastError
());
if
(
!
result
)
return
;
ok
(
!
lstrcmpiW
(
wszDesktop
,
wszPath
),
"SHGetPathFromIDListW didn't return desktop path for empty pidl!
\n
"
);
...
...
@@ -1293,7 +1197,7 @@ static void test_SHGetPathFromIDList(void)
SetLastError
(
0xdeadbeef
);
wszPath
[
0
]
=
'a'
;
wszPath
[
1
]
=
'\0'
;
result
=
p
SHGetPathFromIDListW
(
pidlMyComputer
,
wszPath
);
result
=
SHGetPathFromIDListW
(
pidlMyComputer
,
wszPath
);
ok
(
!
result
,
"SHGetPathFromIDListW succeeded where it shouldn't!
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
||
GetLastError
()
==
ERROR_SUCCESS
,
/* Vista and higher */
...
...
@@ -1306,7 +1210,7 @@ static void test_SHGetPathFromIDList(void)
IMalloc_Free
(
ppM
,
pidlMyComputer
);
result
=
p
SHGetSpecialFolderPathW
(
NULL
,
wszFileName
,
CSIDL_DESKTOPDIRECTORY
,
FALSE
);
result
=
SHGetSpecialFolderPathW
(
NULL
,
wszFileName
,
CSIDL_DESKTOPDIRECTORY
,
FALSE
);
ok
(
result
,
"SHGetSpecialFolderPathW failed! Last error: %u
\n
"
,
GetLastError
());
if
(
!
result
)
{
IShellFolder_Release
(
psfDesktop
);
...
...
@@ -1341,15 +1245,12 @@ static void test_SHGetPathFromIDList(void)
IMalloc_Free
(
ppM
,
pidlTestFile
);
return
;
}
if
(
pStrRetToBufW
)
{
pStrRetToBufW
(
&
strret
,
pidlTestFile
,
wszPath
,
MAX_PATH
);
ok
(
0
==
lstrcmpW
(
wszFileName
,
wszPath
),
"Desktop->GetDisplayNameOf(pidlTestFile, SHGDN_FORPARSING) "
"returned incorrect path for file placed on desktop
\n
"
);
}
StrRetToBufW
(
&
strret
,
pidlTestFile
,
wszPath
,
MAX_PATH
);
ok
(
0
==
lstrcmpW
(
wszFileName
,
wszPath
),
"Desktop->GetDisplayNameOf(pidlTestFile, SHGDN_FORPARSING) "
"returned incorrect path for file placed on desktop
\n
"
);
result
=
p
SHGetPathFromIDListW
(
pidlTestFile
,
wszPath
);
result
=
SHGetPathFromIDListW
(
pidlTestFile
,
wszPath
);
ok
(
result
,
"SHGetPathFromIDListW failed! Last error: %u
\n
"
,
GetLastError
());
ok
(
0
==
lstrcmpW
(
wszFileName
,
wszPath
),
"SHGetPathFromIDListW returned incorrect path for file placed on desktop
\n
"
);
...
...
@@ -1381,11 +1282,11 @@ static void test_SHGetPathFromIDList(void)
IMalloc_Free
(
ppM
,
pidlTestFile
);
/* Test if we can get the path from the start menu "program files" PIDL. */
hr
=
p
SHGetSpecialFolderLocation
(
NULL
,
CSIDL_PROGRAM_FILES
,
&
pidlPrograms
);
hr
=
SHGetSpecialFolderLocation
(
NULL
,
CSIDL_PROGRAM_FILES
,
&
pidlPrograms
);
ok
(
hr
==
S_OK
,
"SHGetFolderLocation failed: 0x%08x
\n
"
,
hr
);
SetLastError
(
0xdeadbeef
);
result
=
p
SHGetPathFromIDListW
(
pidlPrograms
,
wszPath
);
result
=
SHGetPathFromIDListW
(
pidlPrograms
,
wszPath
);
IMalloc_Free
(
ppM
,
pidlPrograms
);
ok
(
result
,
"SHGetPathFromIDListW failed
\n
"
);
}
...
...
@@ -1501,7 +1402,7 @@ static HRESULT WINAPI InitPropertyBag_IPropertyBag_Read(IPropertyBag *iface, LPC
"Wrong variant type for 'Target' property!
\n
"
);
if
(
V_VT
(
pVar
)
!=
VT_BSTR
)
return
E_INVALIDARG
;
result
=
p
SHGetSpecialFolderPathW
(
NULL
,
wszPath
,
CSIDL_DESKTOPDIRECTORY
,
FALSE
);
result
=
SHGetSpecialFolderPathW
(
NULL
,
wszPath
,
CSIDL_DESKTOPDIRECTORY
,
FALSE
);
ok
(
result
,
"SHGetSpecialFolderPathW(DESKTOPDIRECTORY) failed! %u
\n
"
,
GetLastError
());
if
(
!
result
)
return
E_INVALIDARG
;
...
...
@@ -1578,17 +1479,6 @@ static void test_FolderShortcut(void) {
static
const
GUID
CLSID_UnixDosFolder
=
{
0x9d20aae8
,
0x0625
,
0x44b0
,
{
0x9c
,
0xa7
,
0x71
,
0x88
,
0x9c
,
0x22
,
0x54
,
0xd9
}};
if
(
!
pSHGetSpecialFolderPathW
||
!
pStrRetToBufW
)
{
win_skip
(
"SHGetSpecialFolderPathW and/or StrRetToBufW are not available
\n
"
);
return
;
}
if
(
!
pSHGetFolderPathAndSubDirA
)
{
win_skip
(
"FolderShortcut test doesn't work on Win2k
\n
"
);
return
;
}
/* These tests basically show, that CLSID_FolderShortcuts are initialized
* via their IPersistPropertyBag interface. And that the target folder
* is taken from the IPropertyBag's 'Target' property.
...
...
@@ -1623,11 +1513,11 @@ static void test_FolderShortcut(void) {
return
;
}
result
=
p
SHGetSpecialFolderPathW
(
NULL
,
wszDesktopPath
,
CSIDL_DESKTOPDIRECTORY
,
FALSE
);
result
=
SHGetSpecialFolderPathW
(
NULL
,
wszDesktopPath
,
CSIDL_DESKTOPDIRECTORY
,
FALSE
);
ok
(
result
,
"SHGetSpecialFolderPathW(CSIDL_DESKTOPDIRECTORY) failed! %u
\n
"
,
GetLastError
());
if
(
!
result
)
return
;
p
StrRetToBufW
(
&
strret
,
NULL
,
wszBuffer
,
MAX_PATH
);
StrRetToBufW
(
&
strret
,
NULL
,
wszBuffer
,
MAX_PATH
);
ok
(
!
lstrcmpiW
(
wszDesktopPath
,
wszBuffer
),
"FolderShortcut returned incorrect folder!
\n
"
);
hr
=
IShellFolder_QueryInterface
(
pShellFolder
,
&
IID_IPersistFolder3
,
(
LPVOID
*
)
&
pPersistFolder3
);
...
...
@@ -1668,16 +1558,16 @@ static void test_FolderShortcut(void) {
ok
(
hr
==
S_OK
,
"IPersistFolder3::Initialize failed! hr = %08x
\n
"
,
hr
);
if
(
hr
!=
S_OK
)
{
IPersistFolder3_Release
(
pPersistFolder3
);
p
ILFree
(
pidlWineTestFolder
);
ILFree
(
pidlWineTestFolder
);
return
;
}
hr
=
IPersistFolder3_GetCurFolder
(
pPersistFolder3
,
&
pidlCurrentFolder
);
ok
(
hr
==
S_OK
,
"IPersistFolder3_GetCurFolder failed! hr=0x%08x
\n
"
,
hr
);
ok
(
p
ILIsEqual
(
pidlCurrentFolder
,
pidlWineTestFolder
),
ok
(
ILIsEqual
(
pidlCurrentFolder
,
pidlWineTestFolder
),
"IPersistFolder3_GetCurFolder should return pidlWineTestFolder!
\n
"
);
p
ILFree
(
pidlCurrentFolder
);
p
ILFree
(
pidlWineTestFolder
);
ILFree
(
pidlCurrentFolder
);
ILFree
(
pidlWineTestFolder
);
hr
=
IPersistFolder3_QueryInterface
(
pPersistFolder3
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
pShellFolder
);
IPersistFolder3_Release
(
pPersistFolder3
);
...
...
@@ -1691,7 +1581,7 @@ static void test_FolderShortcut(void) {
return
;
}
p
StrRetToBufW
(
&
strret
,
NULL
,
wszBuffer
,
MAX_PATH
);
StrRetToBufW
(
&
strret
,
NULL
,
wszBuffer
,
MAX_PATH
);
ok
(
!
lstrcmpiW
(
wszDesktopPath
,
wszBuffer
),
"FolderShortcut returned incorrect folder!
\n
"
);
/* Next few lines are meant to show that children of FolderShortcuts are not FolderShortcuts,
...
...
@@ -1715,7 +1605,7 @@ static void test_FolderShortcut(void) {
hr
=
IShellFolder_BindToObject
(
pShellFolder
,
pidlSubFolder
,
NULL
,
&
IID_IPersistFolder3
,
(
LPVOID
*
)
&
pPersistFolder3
);
IShellFolder_Release
(
pShellFolder
);
p
ILFree
(
pidlSubFolder
);
ILFree
(
pidlSubFolder
);
ok
(
hr
==
S_OK
,
"IShellFolder::BindToObject failed! hr = %08x
\n
"
,
hr
);
if
(
hr
!=
S_OK
)
return
;
...
...
@@ -1767,9 +1657,7 @@ static void test_ITEMIDLIST_format(void) {
{
'l'
,
'o'
,
'n'
,
'g'
,
'e'
,
'r'
,
'_'
,
't'
,
'h'
,
'a'
,
'n'
,
'.'
,
'8'
,
'_'
,
'3'
,
0
}
};
int
i
;
if
(
!
pSHGetSpecialFolderPathW
)
return
;
bResult
=
pSHGetSpecialFolderPathW
(
NULL
,
wszPersonal
,
CSIDL_PERSONAL
,
FALSE
);
bResult
=
SHGetSpecialFolderPathW
(
NULL
,
wszPersonal
,
CSIDL_PERSONAL
,
FALSE
);
ok
(
bResult
,
"SHGetSpecialFolderPathW failed! Last error: %u
\n
"
,
GetLastError
());
if
(
!
bResult
)
return
;
...
...
@@ -1796,7 +1684,7 @@ static void test_ITEMIDLIST_format(void) {
hr
=
IShellFolder_BindToObject
(
psfDesktop
,
pidlPersonal
,
NULL
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
psfPersonal
);
IShellFolder_Release
(
psfDesktop
);
p
ILFree
(
pidlPersonal
);
ILFree
(
pidlPersonal
);
ok
(
hr
==
S_OK
,
"psfDesktop->BindToObject failed! hr = %08x
\n
"
,
hr
);
if
(
hr
!=
S_OK
)
return
;
...
...
@@ -1907,7 +1795,7 @@ static void test_ITEMIDLIST_format(void) {
}
}
p
ILFree
(
pidlFile
);
ILFree
(
pidlFile
);
}
IShellFolder_Release
(
psfPersonal
);
...
...
@@ -1923,16 +1811,11 @@ static void test_SHGetFolderPathA(void)
HRESULT
hr
;
HKEY
key
;
if
(
!
pSHGetFolderPathA
)
{
win_skip
(
"SHGetFolderPathA not present
\n
"
);
return
;
}
if
(
!
pIsWow64Process
||
!
pIsWow64Process
(
GetCurrentProcess
(),
&
is_wow64
))
is_wow64
=
FALSE
;
hr
=
p
SHGetFolderPathA
(
0
,
CSIDL_PROGRAM_FILES
,
0
,
SHGFP_TYPE_CURRENT
,
path
);
hr
=
SHGetFolderPathA
(
0
,
CSIDL_PROGRAM_FILES
,
0
,
SHGFP_TYPE_CURRENT
,
path
);
ok
(
hr
==
S_OK
,
"SHGetFolderPathA failed %x
\n
"
,
hr
);
hr
=
p
SHGetFolderPathA
(
0
,
CSIDL_PROGRAM_FILESX86
,
0
,
SHGFP_TYPE_CURRENT
,
path_x86
);
hr
=
SHGetFolderPathA
(
0
,
CSIDL_PROGRAM_FILESX86
,
0
,
SHGFP_TYPE_CURRENT
,
path_x86
);
if
(
hr
==
E_FAIL
)
{
win_skip
(
"Program Files (x86) not supported
\n
"
);
...
...
@@ -1965,9 +1848,9 @@ static void test_SHGetFolderPathA(void)
RegCloseKey
(
key
);
}
hr
=
p
SHGetFolderPathA
(
0
,
CSIDL_PROGRAM_FILES_COMMON
,
0
,
SHGFP_TYPE_CURRENT
,
path
);
hr
=
SHGetFolderPathA
(
0
,
CSIDL_PROGRAM_FILES_COMMON
,
0
,
SHGFP_TYPE_CURRENT
,
path
);
ok
(
hr
==
S_OK
,
"SHGetFolderPathA failed %x
\n
"
,
hr
);
hr
=
p
SHGetFolderPathA
(
0
,
CSIDL_PROGRAM_FILES_COMMONX86
,
0
,
SHGFP_TYPE_CURRENT
,
path_x86
);
hr
=
SHGetFolderPathA
(
0
,
CSIDL_PROGRAM_FILES_COMMONX86
,
0
,
SHGFP_TYPE_CURRENT
,
path_x86
);
if
(
hr
==
E_FAIL
)
{
win_skip
(
"Common Files (x86) not supported
\n
"
);
...
...
@@ -2012,17 +1895,7 @@ static void test_SHGetFolderPathAndSubDirA(void)
static
char
testpath
[
MAX_PATH
];
static
char
toolongpath
[
MAX_PATH
+
1
];
if
(
!
pSHGetFolderPathAndSubDirA
)
{
win_skip
(
"SHGetFolderPathAndSubDirA not present!
\n
"
);
return
;
}
if
(
!
pSHGetFolderPathA
)
{
win_skip
(
"SHGetFolderPathA not present!
\n
"
);
return
;
}
if
(
FAILED
(
pSHGetFolderPathA
(
NULL
,
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
appdata
)))
if
(
FAILED
(
SHGetFolderPathA
(
NULL
,
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
appdata
)))
{
win_skip
(
"SHGetFolderPathA failed for CSIDL_LOCAL_APPDATA!
\n
"
);
return
;
...
...
@@ -2043,11 +1916,11 @@ static void test_SHGetFolderPathAndSubDirA(void)
}
/* test invalid second parameter */
ret
=
p
SHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_DONT_VERIFY
|
0xff
,
NULL
,
SHGFP_TYPE_CURRENT
,
wine
,
testpath
);
ret
=
SHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_DONT_VERIFY
|
0xff
,
NULL
,
SHGFP_TYPE_CURRENT
,
wine
,
testpath
);
ok
(
E_INVALIDARG
==
ret
,
"expected E_INVALIDARG, got %x
\n
"
,
ret
);
/* test fourth parameter */
ret
=
p
SHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_DONT_VERIFY
|
CSIDL_LOCAL_APPDATA
,
NULL
,
2
,
winetemp
,
testpath
);
ret
=
SHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_DONT_VERIFY
|
CSIDL_LOCAL_APPDATA
,
NULL
,
2
,
winetemp
,
testpath
);
switch
(
ret
)
{
case
S_OK
:
/* winvista */
ok
(
!
strncmp
(
appdata
,
testpath
,
strlen
(
appdata
)),
...
...
@@ -2063,40 +1936,40 @@ static void test_SHGetFolderPathAndSubDirA(void)
/* test fifth parameter */
testpath
[
0
]
=
'\0'
;
ret
=
p
SHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_DONT_VERIFY
|
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
NULL
,
testpath
);
ret
=
SHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_DONT_VERIFY
|
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
NULL
,
testpath
);
ok
(
S_OK
==
ret
,
"expected S_OK, got %x
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
appdata
,
testpath
),
"expected %s, got %s
\n
"
,
appdata
,
testpath
);
testpath
[
0
]
=
'\0'
;
ret
=
p
SHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_DONT_VERIFY
|
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
""
,
testpath
);
ret
=
SHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_DONT_VERIFY
|
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
""
,
testpath
);
ok
(
S_OK
==
ret
,
"expected S_OK, got %x
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
appdata
,
testpath
),
"expected %s, got %s
\n
"
,
appdata
,
testpath
);
testpath
[
0
]
=
'\0'
;
ret
=
p
SHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_DONT_VERIFY
|
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
"
\\
"
,
testpath
);
ret
=
SHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_DONT_VERIFY
|
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
"
\\
"
,
testpath
);
ok
(
S_OK
==
ret
,
"expected S_OK, got %x
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
appdata
,
testpath
),
"expected %s, got %s
\n
"
,
appdata
,
testpath
);
for
(
i
=
0
;
i
<
MAX_PATH
;
i
++
)
toolongpath
[
i
]
=
'0'
+
i
%
10
;
toolongpath
[
MAX_PATH
]
=
'\0'
;
ret
=
p
SHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_DONT_VERIFY
|
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
toolongpath
,
testpath
);
ret
=
SHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_DONT_VERIFY
|
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
toolongpath
,
testpath
);
ok
(
HRESULT_FROM_WIN32
(
ERROR_FILENAME_EXCED_RANGE
)
==
ret
,
"expected %x, got %x
\n
"
,
HRESULT_FROM_WIN32
(
ERROR_FILENAME_EXCED_RANGE
),
ret
);
testpath
[
0
]
=
'\0'
;
ret
=
p
SHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_DONT_VERIFY
|
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
wine
,
NULL
);
ret
=
SHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_DONT_VERIFY
|
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
wine
,
NULL
);
ok
((
S_OK
==
ret
)
||
(
E_INVALIDARG
==
ret
),
"expected S_OK or E_INVALIDARG, got %x
\n
"
,
ret
);
/* test a not existing path */
testpath
[
0
]
=
'\0'
;
ret
=
p
SHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
winetemp
,
testpath
);
ret
=
SHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
winetemp
,
testpath
);
ok
(
HRESULT_FROM_WIN32
(
ERROR_PATH_NOT_FOUND
)
==
ret
,
"expected %x, got %x
\n
"
,
HRESULT_FROM_WIN32
(
ERROR_PATH_NOT_FOUND
),
ret
);
/* create a directory inside a not existing directory */
testpath
[
0
]
=
'\0'
;
ret
=
p
SHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_CREATE
|
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
winetemp
,
testpath
);
ret
=
SHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_CREATE
|
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
winetemp
,
testpath
);
ok
(
S_OK
==
ret
,
"expected S_OK, got %x
\n
"
,
ret
);
ok
(
!
strncmp
(
appdata
,
testpath
,
strlen
(
appdata
)),
"expected %s to start with %s
\n
"
,
testpath
,
appdata
);
...
...
@@ -2181,40 +2054,27 @@ static void test_LocalizedNames(void)
hr
=
IShellFolder_GetDisplayNameOf
(
testIShellFolder
,
newPIDL
,
SHGDN_INFOLDER
,
&
strret
);
ok
(
hr
==
S_OK
,
"GetDisplayNameOf failed %08x
\n
"
,
hr
);
if
(
hr
==
S_OK
&&
pStrRetToBufW
)
{
hr
=
pStrRetToBufW
(
&
strret
,
newPIDL
,
tempbufW
,
sizeof
(
tempbufW
)
/
sizeof
(
WCHAR
));
ok
(
hr
==
S_OK
,
"StrRetToBufW failed! hr = %08x
\n
"
,
hr
);
todo_wine
ok
(
!
lstrcmpiW
(
tempbufW
,
folderdisplayW
)
||
broken
(
!
lstrcmpiW
(
tempbufW
,
foldernameW
)),
/* W2K */
"GetDisplayNameOf returned %s
\n
"
,
wine_dbgstr_w
(
tempbufW
));
}
hr
=
StrRetToBufW
(
&
strret
,
newPIDL
,
tempbufW
,
sizeof
(
tempbufW
)
/
sizeof
(
WCHAR
));
ok
(
hr
==
S_OK
,
"StrRetToBufW failed! hr = %08x
\n
"
,
hr
);
todo_wine
ok
(
!
lstrcmpiW
(
tempbufW
,
folderdisplayW
),
"GetDisplayNameOf returned %s
\n
"
,
wine_dbgstr_w
(
tempbufW
));
/* editing name is also read from the resource */
hr
=
IShellFolder_GetDisplayNameOf
(
testIShellFolder
,
newPIDL
,
SHGDN_INFOLDER
|
SHGDN_FOREDITING
,
&
strret
);
ok
(
hr
==
S_OK
,
"GetDisplayNameOf failed %08x
\n
"
,
hr
);
if
(
hr
==
S_OK
&&
pStrRetToBufW
)
{
hr
=
pStrRetToBufW
(
&
strret
,
newPIDL
,
tempbufW
,
sizeof
(
tempbufW
)
/
sizeof
(
WCHAR
));
ok
(
hr
==
S_OK
,
"StrRetToBufW failed! hr = %08x
\n
"
,
hr
);
todo_wine
ok
(
!
lstrcmpiW
(
tempbufW
,
folderdisplayW
)
||
broken
(
!
lstrcmpiW
(
tempbufW
,
foldernameW
)),
/* W2K */
"GetDisplayNameOf returned %s
\n
"
,
wine_dbgstr_w
(
tempbufW
));
}
hr
=
StrRetToBufW
(
&
strret
,
newPIDL
,
tempbufW
,
sizeof
(
tempbufW
)
/
sizeof
(
WCHAR
));
ok
(
hr
==
S_OK
,
"StrRetToBufW failed! hr = %08x
\n
"
,
hr
);
todo_wine
ok
(
!
lstrcmpiW
(
tempbufW
,
folderdisplayW
),
"GetDisplayNameOf returned %s
\n
"
,
wine_dbgstr_w
(
tempbufW
));
/* parsing name is unchanged */
hr
=
IShellFolder_GetDisplayNameOf
(
testIShellFolder
,
newPIDL
,
SHGDN_INFOLDER
|
SHGDN_FORPARSING
,
&
strret
);
ok
(
hr
==
S_OK
,
"GetDisplayNameOf failed %08x
\n
"
,
hr
);
if
(
hr
==
S_OK
&&
pStrRetToBufW
)
{
hr
=
pStrRetToBufW
(
&
strret
,
newPIDL
,
tempbufW
,
sizeof
(
tempbufW
)
/
sizeof
(
WCHAR
));
ok
(
hr
==
S_OK
,
"StrRetToBufW failed! hr = %08x
\n
"
,
hr
);
ok
(
!
lstrcmpiW
(
tempbufW
,
foldernameW
),
"GetDisplayNameOf returned %s
\n
"
,
wine_dbgstr_w
(
tempbufW
));
}
hr
=
StrRetToBufW
(
&
strret
,
newPIDL
,
tempbufW
,
sizeof
(
tempbufW
)
/
sizeof
(
WCHAR
));
ok
(
hr
==
S_OK
,
"StrRetToBufW failed! hr = %08x
\n
"
,
hr
);
ok
(
!
lstrcmpiW
(
tempbufW
,
foldernameW
),
"GetDisplayNameOf returned %s
\n
"
,
wine_dbgstr_w
(
tempbufW
));
IShellFolder_Release
(
IDesktopFolder
);
IShellFolder_Release
(
testIShellFolder
);
...
...
@@ -2253,16 +2113,8 @@ static void test_SHCreateShellItem(void)
return
;
}
if
(
pSHGetSpecialFolderLocation
)
{
ret
=
pSHGetSpecialFolderLocation
(
NULL
,
CSIDL_DESKTOP
,
&
pidl_desktop
);
ok
(
ret
==
S_OK
,
"Got 0x%08x
\n
"
,
ret
);
}
else
{
win_skip
(
"pSHGetSpecialFolderLocation missing.
\n
"
);
pidl_desktop
=
NULL
;
}
ret
=
SHGetSpecialFolderLocation
(
NULL
,
CSIDL_DESKTOP
,
&
pidl_desktop
);
ok
(
ret
==
S_OK
,
"Got 0x%08x
\n
"
,
ret
);
MultiByteToWideChar
(
CP_ACP
,
0
,
curdirA
,
-
1
,
curdirW
,
MAX_PATH
);
...
...
@@ -2280,7 +2132,7 @@ static void test_SHCreateShellItem(void)
ret
=
IShellFolder_ParseDisplayName
(
currentfolder
,
NULL
,
NULL
,
testfileW
,
NULL
,
&
pidl_testfile
,
NULL
);
ok
(
SUCCEEDED
(
ret
),
"ParseDisplayName returned %x
\n
"
,
ret
);
pidl_abstestfile
=
p
ILCombine
(
pidl_cwd
,
pidl_testfile
);
pidl_abstestfile
=
ILCombine
(
pidl_cwd
,
pidl_testfile
);
shellitem
=
(
void
*
)
0xdeadbeef
;
ret
=
pSHCreateShellItem
(
NULL
,
NULL
,
NULL
,
&
shellitem
);
...
...
@@ -2308,7 +2160,7 @@ static void test_SHCreateShellItem(void)
if
(
SUCCEEDED
(
ret
))
{
ok
(
ILIsEqual
(
pidl_cwd
,
pidl_test
),
"id lists are not equal
\n
"
);
p
ILFree
(
pidl_test
);
ILFree
(
pidl_test
);
}
IPersistIDList_Release
(
persistidl
);
}
...
...
@@ -2328,7 +2180,7 @@ static void test_SHCreateShellItem(void)
if
(
SUCCEEDED
(
ret
))
{
ok
(
ILIsEqual
(
pidl_abstestfile
,
pidl_test
),
"id lists are not equal
\n
"
);
p
ILFree
(
pidl_test
);
ILFree
(
pidl_test
);
}
IPersistIDList_Release
(
persistidl
);
}
...
...
@@ -2346,7 +2198,7 @@ static void test_SHCreateShellItem(void)
if
(
SUCCEEDED
(
ret
))
{
ok
(
ILIsEqual
(
pidl_cwd
,
pidl_test
),
"id lists are not equal
\n
"
);
p
ILFree
(
pidl_test
);
ILFree
(
pidl_test
);
}
IPersistIDList_Release
(
persistidl
);
}
...
...
@@ -2369,7 +2221,7 @@ static void test_SHCreateShellItem(void)
if
(
SUCCEEDED
(
ret
))
{
ok
(
ILIsEqual
(
pidl_abstestfile
,
pidl_test
),
"id lists are not equal
\n
"
);
p
ILFree
(
pidl_test
);
ILFree
(
pidl_test
);
}
IPersistIDList_Release
(
persistidl
);
}
...
...
@@ -2390,7 +2242,7 @@ static void test_SHCreateShellItem(void)
if
(
SUCCEEDED
(
ret
))
{
ok
(
ILIsEqual
(
pidl_abstestfile
,
pidl_test
),
"id lists are not equal
\n
"
);
p
ILFree
(
pidl_test
);
ILFree
(
pidl_test
);
}
IPersistIDList_Release
(
persistidl
);
}
...
...
@@ -2410,7 +2262,7 @@ static void test_SHCreateShellItem(void)
if
(
SUCCEEDED
(
ret
))
{
ok
(
ILIsEqual
(
pidl_testfile
,
pidl_test
),
"id lists are not equal
\n
"
);
p
ILFree
(
pidl_test
);
ILFree
(
pidl_test
);
}
IPersistIDList_Release
(
persistidl
);
}
...
...
@@ -2495,7 +2347,7 @@ static void test_SHCreateShellItem(void)
if
(
SUCCEEDED
(
ret
))
{
ok
(
ILIsEqual
(
pidl_cwd
,
pidl_test
),
"id lists are not equal
\n
"
);
p
ILFree
(
pidl_test
);
ILFree
(
pidl_test
);
}
IPersistIDList_Release
(
persistidl
);
}
...
...
@@ -2515,7 +2367,7 @@ static void test_SHCreateShellItem(void)
if
(
SUCCEEDED
(
ret
))
{
ok
(
ILIsEqual
(
pidl_testfile
,
pidl_test
),
"id lists are not equal
\n
"
);
p
ILFree
(
pidl_test
);
ILFree
(
pidl_test
);
}
IPersistIDList_Release
(
persistidl
);
}
...
...
@@ -2592,7 +2444,7 @@ static void test_SHCreateShellItem(void)
ret
=
IShellItem_Compare
(
shellitem
,
shellitem2
,
0
,
&
order
);
ok
(
ret
==
S_OK
,
"IShellItem_Compare fail: 0x%08x.
\n
"
,
ret
);
ok
(
!
order
,
"order got wrong value: %d.
\n
"
,
order
);
p
ILFree
(
pidl_desktop_testfile
);
ILFree
(
pidl_desktop_testfile
);
IShellItem_Release
(
shellitem2
);
IShellItem_Release
(
shellitem
);
...
...
@@ -2683,7 +2535,7 @@ static void test_SHCreateShellItem(void)
ret
=
IShellItem_Compare
(
shellitem
,
shellitem2
,
0
,
&
order
);
ok
(
ret
==
S_OK
,
"IShellItem_Compare failed: 0x%08x.
\n
"
,
ret
);
ok
(
!
order
,
"order got wrong value: %d.
\n
"
,
order
);
p
ILFree
(
pidl_desktop_testfile
);
ILFree
(
pidl_desktop_testfile
);
IShellItem_Release
(
shellitem2
);
IShellItem_Release
(
shellitem
);
...
...
@@ -2715,10 +2567,10 @@ static void test_SHCreateShellItem(void)
win_skip
(
"No SHCreateItemInKnownFolder or SHGetKnownFolderPath
\n
"
);
DeleteFileA
(
".
\\
testfile"
);
p
ILFree
(
pidl_abstestfile
);
p
ILFree
(
pidl_testfile
);
p
ILFree
(
pidl_desktop
);
p
ILFree
(
pidl_cwd
);
ILFree
(
pidl_abstestfile
);
ILFree
(
pidl_testfile
);
ILFree
(
pidl_desktop
);
ILFree
(
pidl_cwd
);
IShellFolder_Release
(
currentfolder
);
IShellFolder_Release
(
desktopfolder
);
}
...
...
@@ -2742,11 +2594,8 @@ static void test_SHGetNameFromIDList(void)
return
;
}
/* Th
ese
should be available on any platform that passed the above test. */
/* Th
is
should be available on any platform that passed the above test. */
ok
(
pSHCreateShellItem
!=
NULL
,
"SHCreateShellItem missing.
\n
"
);
ok
(
pSHBindToParent
!=
NULL
,
"SHBindToParent missing.
\n
"
);
ok
(
pSHGetSpecialFolderLocation
!=
NULL
,
"SHGetSpecialFolderLocation missing.
\n
"
);
ok
(
pStrRetToBufW
!=
NULL
,
"StrRetToBufW missing.
\n
"
);
if
(
0
)
{
...
...
@@ -2758,7 +2607,7 @@ static void test_SHGetNameFromIDList(void)
ok
(
hres
==
E_INVALIDARG
,
"Got 0x%08x
\n
"
,
hres
);
/* Test the desktop */
hres
=
p
SHGetSpecialFolderLocation
(
NULL
,
CSIDL_DESKTOP
,
&
pidl
);
hres
=
SHGetSpecialFolderLocation
(
NULL
,
CSIDL_DESKTOP
,
&
pidl
);
ok
(
hres
==
S_OK
,
"Got 0x%08x
\n
"
,
hres
);
hres
=
pSHCreateShellItem
(
NULL
,
NULL
,
pidl
,
&
shellitem
);
ok
(
hres
==
S_OK
,
"Got 0x%08x
\n
"
,
hres
);
...
...
@@ -2786,7 +2635,7 @@ static void test_SHGetNameFromIDList(void)
if
(
SUCCEEDED
(
hrSF
))
{
p
StrRetToBufW
(
&
strret
,
NULL
,
buf
,
MAX_PATH
);
StrRetToBufW
(
&
strret
,
NULL
,
buf
,
MAX_PATH
);
if
(
SUCCEEDED
(
hrSI
))
ok
(
!
lstrcmpW
(
nameSI
,
buf
),
"Strings differ.
\n
"
);
if
(
SUCCEEDED
(
hrSF
))
...
...
@@ -2797,16 +2646,13 @@ static void test_SHGetNameFromIDList(void)
}
IShellFolder_Release
(
psf
);
if
(
pSHGetPathFromIDListW
){
hrSI
=
pSHGetNameFromIDList
(
pidl
,
SIGDN_FILESYSPATH
,
&
nameSI
);
ok
(
hrSI
==
S_OK
,
"Got 0x%08x
\n
"
,
hrSI
);
res
=
pSHGetPathFromIDListW
(
pidl
,
buf
);
ok
(
res
==
TRUE
,
"Got %d
\n
"
,
res
);
if
(
SUCCEEDED
(
hrSI
)
&&
res
)
ok
(
!
lstrcmpW
(
nameSI
,
buf
),
"Strings differ.
\n
"
);
if
(
SUCCEEDED
(
hrSI
))
CoTaskMemFree
(
nameSI
);
}
else
win_skip
(
"pSHGetPathFromIDListW not available
\n
"
);
hrSI
=
pSHGetNameFromIDList
(
pidl
,
SIGDN_FILESYSPATH
,
&
nameSI
);
ok
(
hrSI
==
S_OK
,
"Got 0x%08x
\n
"
,
hrSI
);
res
=
SHGetPathFromIDListW
(
pidl
,
buf
);
ok
(
res
==
TRUE
,
"Got %d
\n
"
,
res
);
if
(
SUCCEEDED
(
hrSI
)
&&
res
)
ok
(
!
lstrcmpW
(
nameSI
,
buf
),
"Strings differ.
\n
"
);
if
(
SUCCEEDED
(
hrSI
))
CoTaskMemFree
(
nameSI
);
hres
=
pSHGetNameFromIDList
(
pidl
,
SIGDN_URL
,
&
name_string
);
todo_wine
ok
(
hres
==
S_OK
,
"Got 0x%08x
\n
"
,
hres
);
...
...
@@ -2814,10 +2660,10 @@ static void test_SHGetNameFromIDList(void)
IShellItem_Release
(
shellitem
);
}
p
ILFree
(
pidl
);
ILFree
(
pidl
);
/* Test the control panel */
hres
=
p
SHGetSpecialFolderLocation
(
NULL
,
CSIDL_CONTROLS
,
&
pidl
);
hres
=
SHGetSpecialFolderLocation
(
NULL
,
CSIDL_CONTROLS
,
&
pidl
);
ok
(
hres
==
S_OK
,
"Got 0x%08x
\n
"
,
hres
);
hres
=
pSHCreateShellItem
(
NULL
,
NULL
,
pidl
,
&
shellitem
);
ok
(
hres
==
S_OK
,
"Got 0x%08x
\n
"
,
hres
);
...
...
@@ -2845,7 +2691,7 @@ static void test_SHGetNameFromIDList(void)
if
(
SUCCEEDED
(
hrSF
))
{
p
StrRetToBufW
(
&
strret
,
NULL
,
buf
,
MAX_PATH
);
StrRetToBufW
(
&
strret
,
NULL
,
buf
,
MAX_PATH
);
if
(
SUCCEEDED
(
hrSI
))
ok
(
!
lstrcmpW
(
nameSI
,
buf
),
"Strings differ.
\n
"
);
if
(
SUCCEEDED
(
hrSF
))
...
...
@@ -2856,16 +2702,13 @@ static void test_SHGetNameFromIDList(void)
}
IShellFolder_Release
(
psf
);
if
(
pSHGetPathFromIDListW
){
hrSI
=
pSHGetNameFromIDList
(
pidl
,
SIGDN_FILESYSPATH
,
&
nameSI
);
ok
(
hrSI
==
E_INVALIDARG
,
"Got 0x%08x
\n
"
,
hrSI
);
res
=
pSHGetPathFromIDListW
(
pidl
,
buf
);
ok
(
res
==
FALSE
,
"Got %d
\n
"
,
res
);
if
(
SUCCEEDED
(
hrSI
)
&&
res
)
ok
(
!
lstrcmpW
(
nameSI
,
buf
),
"Strings differ.
\n
"
);
if
(
SUCCEEDED
(
hrSI
))
CoTaskMemFree
(
nameSI
);
}
else
win_skip
(
"pSHGetPathFromIDListW not available
\n
"
);
hrSI
=
pSHGetNameFromIDList
(
pidl
,
SIGDN_FILESYSPATH
,
&
nameSI
);
ok
(
hrSI
==
E_INVALIDARG
,
"Got 0x%08x
\n
"
,
hrSI
);
res
=
SHGetPathFromIDListW
(
pidl
,
buf
);
ok
(
res
==
FALSE
,
"Got %d
\n
"
,
res
);
if
(
SUCCEEDED
(
hrSI
)
&&
res
)
ok
(
!
lstrcmpW
(
nameSI
,
buf
),
"Strings differ.
\n
"
);
if
(
SUCCEEDED
(
hrSI
))
CoTaskMemFree
(
nameSI
);
hres
=
pSHGetNameFromIDList
(
pidl
,
SIGDN_URL
,
&
name_string
);
todo_wine
ok
(
hres
==
E_NOTIMPL
/* Win7 */
||
hres
==
S_OK
/* Vista */
,
...
...
@@ -2874,7 +2717,7 @@ static void test_SHGetNameFromIDList(void)
IShellItem_Release
(
shellitem
);
}
p
ILFree
(
pidl
);
ILFree
(
pidl
);
}
static
void
test_SHGetItemFromDataObject
(
void
)
...
...
@@ -2979,7 +2822,7 @@ static void test_SHGetItemFromDataObject(void)
skip
(
"zero or one file found - skipping multi-file test.
\n
"
);
for
(
i
=
0
;
i
<
count
;
i
++
)
p
ILFree
(
apidl
[
i
]);
ILFree
(
apidl
[
i
]);
IEnumIDList_Release
(
peidl
);
}
...
...
@@ -3054,7 +2897,7 @@ static void test_ShellItemCompare(void)
{
hr
=
pSHCreateShellItem
(
NULL
,
NULL
,
pidl_testfile
,
&
psi
[
i
]);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
p
ILFree
(
pidl_testfile
);
ILFree
(
pidl_testfile
);
}
if
(
FAILED
(
hr
))
failed
=
TRUE
;
}
...
...
@@ -3289,8 +3132,6 @@ static void test_SHGetIDListFromObject(void)
return
;
}
ok
(
pSHGetSpecialFolderLocation
!=
NULL
,
"SHGetSpecialFolderLocation missing.
\n
"
);
if
(
0
)
{
/* Crashes native */
...
...
@@ -3321,7 +3162,7 @@ static void test_SHGetIDListFromObject(void)
HeapFree
(
GetProcessHeap
(),
0
,
punkimpl
);
pidl_desktop
=
NULL
;
p
SHGetSpecialFolderLocation
(
NULL
,
CSIDL_DESKTOP
,
&
pidl_desktop
);
SHGetSpecialFolderLocation
(
NULL
,
CSIDL_DESKTOP
,
&
pidl_desktop
);
ok
(
pidl_desktop
!=
NULL
,
"Failed to get desktop pidl.
\n
"
);
SHGetDesktopFolder
(
&
psfdesktop
);
...
...
@@ -3339,7 +3180,7 @@ static void test_SHGetIDListFromObject(void)
if
(
SUCCEEDED
(
hres
))
{
ok
(
ILIsEqual
(
pidl_desktop
,
pidl
),
"pidl not equal.
\n
"
);
p
ILFree
(
pidl
);
ILFree
(
pidl
);
}
IShellItem_Release
(
shellitem
);
}
...
...
@@ -3353,7 +3194,7 @@ static void test_SHGetIDListFromObject(void)
if
(
SUCCEEDED
(
hres
))
{
ok
(
ILIsEqual
(
pidl_desktop
,
pidl
),
"pidl not equal.
\n
"
);
p
ILFree
(
pidl
);
ILFree
(
pidl
);
}
hres
=
IShellFolder_CreateViewObject
(
psfdesktop
,
NULL
,
&
IID_IShellView
,
(
void
**
)
&
psv
);
...
...
@@ -3370,7 +3211,7 @@ static void test_SHGetIDListFromObject(void)
if
(
SUCCEEDED
(
hres
))
{
ok
(
ILIsEqual
(
pidl_desktop
,
pidl
),
"pidl not equal.
\n
"
);
p
ILFree
(
pidl
);
ILFree
(
pidl
);
}
/* Test IDataObject */
...
...
@@ -3397,7 +3238,7 @@ static void test_SHGetIDListFromObject(void)
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
ok
(
pidl
!=
NULL
,
"pidl is NULL.
\n
"
);
ok
(
ILIsEqual
(
pidl
,
apidl
[
0
]),
"pidl not equal.
\n
"
);
p
ILFree
(
pidl
);
ILFree
(
pidl
);
IDataObject_Release
(
pdo
);
}
...
...
@@ -3425,7 +3266,7 @@ static void test_SHGetIDListFromObject(void)
skip
(
"zero or one file found - skipping multi-file test.
\n
"
);
for
(
i
=
0
;
i
<
count
;
i
++
)
p
ILFree
(
apidl
[
i
]);
ILFree
(
apidl
[
i
]);
IEnumIDList_Release
(
peidl
);
}
...
...
@@ -3434,7 +3275,7 @@ static void test_SHGetIDListFromObject(void)
}
IShellFolder_Release
(
psfdesktop
);
p
ILFree
(
pidl_desktop
);
ILFree
(
pidl_desktop
);
}
static
void
test_SHGetItemFromObject
(
void
)
...
...
@@ -3527,8 +3368,6 @@ static void test_SHCreateShellItemArray(void)
return
;
}
ok
(
pSHGetSpecialFolderLocation
!=
NULL
,
"SHGetSpecialFolderLocation missing.
\n
"
);
if
(
0
)
{
/* Crashes under native */
...
...
@@ -3548,10 +3387,10 @@ static void test_SHCreateShellItemArray(void)
hr
=
pSHCreateShellItemArray
(
NULL
,
pdesktopsf
,
1
,
NULL
,
&
psia
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
p
SHGetSpecialFolderLocation
(
NULL
,
CSIDL_DESKTOP
,
&
pidl
);
SHGetSpecialFolderLocation
(
NULL
,
CSIDL_DESKTOP
,
&
pidl
);
hr
=
pSHCreateShellItemArray
(
pidl
,
NULL
,
0
,
NULL
,
&
psia
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
p
ILFree
(
pidl
);
ILFree
(
pidl
);
GetCurrentDirectoryW
(
MAX_PATH
,
cTestDirW
);
myPathAddBackslashW
(
cTestDirW
);
...
...
@@ -3572,7 +3411,7 @@ static void test_SHCreateShellItemArray(void)
if
(
FAILED
(
hr
))
{
skip
(
"Failed to set up environment for SHCreateShellItemArray tests.
\n
"
);
p
ILFree
(
pidl_testdir
);
ILFree
(
pidl_testdir
);
Cleanup
();
return
;
}
...
...
@@ -3624,14 +3463,14 @@ static void test_SHCreateShellItemArray(void)
if
(
SUCCEEDED
(
hr
))
{
ok
(
ILIsEqual
(
pidl_abs
,
pidl
),
"Pidl not equal.
\n
"
);
p
ILFree
(
pidl
);
ILFree
(
pidl
);
}
IShellItem_Release
(
psi
);
}
p
ILFree
(
pidl_abs
);
ILFree
(
pidl_abs
);
}
for
(
i
=
0
;
i
<
done
;
i
++
)
p
ILFree
(
apidl
[
i
]);
ILFree
(
apidl
[
i
]);
IShellItemArray_Release
(
psia
);
}
}
...
...
@@ -3676,8 +3515,8 @@ static void test_SHCreateShellItemArray(void)
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
ok
(
pidl2
!=
NULL
,
"pidl2 was null.
\n
"
);
ok
(
ILIsEqual
(
pidl1
,
pidl2
),
"pidls not equal.
\n
"
);
p
ILFree
(
pidl1
);
p
ILFree
(
pidl2
);
ILFree
(
pidl1
);
ILFree
(
pidl2
);
IShellItem_Release
(
psi2
);
}
hr
=
IShellItemArray_GetItemAt
(
psia
,
1
,
&
psi2
);
...
...
@@ -3752,10 +3591,10 @@ static void test_SHCreateShellItemArray(void)
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
ok
(
pidl
!=
NULL
,
"pidl as NULL.
\n
"
);
ok
(
ILIsEqual
(
pidl
,
pidl_abs
),
"pidls differ.
\n
"
);
p
ILFree
(
pidl
);
ILFree
(
pidl
);
IShellItem_Release
(
psi
);
}
p
ILFree
(
pidl_abs
);
ILFree
(
pidl_abs
);
}
IShellItemArray_Release
(
psia
);
...
...
@@ -3764,7 +3603,7 @@ static void test_SHCreateShellItemArray(void)
IDataObject_Release
(
pdo
);
}
for
(
i
=
0
;
i
<
count
;
i
++
)
p
ILFree
(
apidl
[
i
]);
ILFree
(
apidl
[
i
]);
}
else
skip
(
"No files found - skipping test.
\n
"
);
...
...
@@ -3843,7 +3682,7 @@ static void test_SHCreateShellItemArray(void)
WCHAR
desktoppath
[
MAX_PATH
];
BOOL
result
;
result
=
p
SHGetSpecialFolderPathW
(
NULL
,
desktoppath
,
CSIDL_DESKTOPDIRECTORY
,
FALSE
);
result
=
SHGetSpecialFolderPathW
(
NULL
,
desktoppath
,
CSIDL_DESKTOPDIRECTORY
,
FALSE
);
ok
(
result
,
"SHGetSpecialFolderPathW(CSIDL_DESKTOPDIRECTORY) failed! %u
\n
"
,
GetLastError
());
hr
=
IShellItem_GetDisplayName
(
psi
,
SIGDN_DESKTOPABSOLUTEPARSING
,
&
path
);
...
...
@@ -3948,7 +3787,7 @@ static void test_SHCreateShellItemArray(void)
IShellItemArray_Release
(
psia
);
}
p
ILFree
(
pidltest1
);
ILFree
(
pidltest1
);
}
IShellFolder_Release
(
pdesktopsf
);
...
...
@@ -3957,7 +3796,7 @@ static void test_SHCreateShellItemArray(void)
skip
(
"No SHCreateShellItemArrayFromIDLists.
\n
"
);
IShellFolder_Release
(
psf
);
p
ILFree
(
pidl_testdir
);
ILFree
(
pidl_testdir
);
Cleanup
();
}
...
...
@@ -3991,7 +3830,7 @@ static void test_ShellItemArrayEnumItems(void)
hr
=
IShellFolder_BindToObject
(
pdesktopsf
,
pidl_testdir
,
NULL
,
(
REFIID
)
&
IID_IShellFolder
,
(
void
**
)
&
psf
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
p
ILFree
(
pidl_testdir
);
ILFree
(
pidl_testdir
);
}
IShellFolder_Release
(
pdesktopsf
);
if
(
FAILED
(
hr
))
return
;
...
...
@@ -4110,7 +3949,7 @@ static void test_ShellItemArrayEnumItems(void)
}
for
(
i
=
0
;
i
<
done
;
i
++
)
p
ILFree
(
apidl
[
i
]);
ILFree
(
apidl
[
i
]);
}
}
...
...
@@ -4127,7 +3966,7 @@ static void test_ShellItemBindToHandler(void)
return
;
}
hr
=
p
SHGetSpecialFolderLocation
(
NULL
,
CSIDL_DESKTOP
,
&
pidl_desktop
);
hr
=
SHGetSpecialFolderLocation
(
NULL
,
CSIDL_DESKTOP
,
&
pidl_desktop
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
...
...
@@ -4162,7 +4001,7 @@ static void test_ShellItemBindToHandler(void)
if
(
SUCCEEDED
(
hr
))
{
ok
(
ILIsEqual
(
pidl_desktop
,
pidl_tmp
),
"Pidl not equal (%p, %p)
\n
"
,
pidl_desktop
,
pidl_tmp
);
p
ILFree
(
pidl_tmp
);
ILFree
(
pidl_tmp
);
}
IPersistFolder2_Release
(
ppf2
);
}
...
...
@@ -4276,7 +4115,7 @@ static void test_ShellItemBindToHandler(void)
else
skip
(
"Failed to create ShellItem.
\n
"
);
p
ILFree
(
pidl_desktop
);
ILFree
(
pidl_desktop
);
}
static
void
test_ShellItemGetAttributes
(
void
)
...
...
@@ -4297,13 +4136,13 @@ static void test_ShellItemGetAttributes(void)
return
;
}
hr
=
p
SHGetSpecialFolderLocation
(
NULL
,
CSIDL_DESKTOP
,
&
pidl_desktop
);
hr
=
SHGetSpecialFolderLocation
(
NULL
,
CSIDL_DESKTOP
,
&
pidl_desktop
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
pSHCreateShellItem
(
NULL
,
NULL
,
pidl_desktop
,
&
psi
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
p
ILFree
(
pidl_desktop
);
ILFree
(
pidl_desktop
);
}
if
(
FAILED
(
hr
))
{
...
...
@@ -4338,7 +4177,7 @@ static void test_ShellItemGetAttributes(void)
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
pSHCreateShellItem
(
NULL
,
NULL
,
pidl
,
&
psi_folder1
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
sfgao
);
p
ILFree
(
pidl
);
ILFree
(
pidl
);
lstrcpyW
(
buf
,
curdirW
);
lstrcatW
(
buf
,
testfile1W
);
...
...
@@ -4346,7 +4185,7 @@ static void test_ShellItemGetAttributes(void)
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
pSHCreateShellItem
(
NULL
,
NULL
,
pidl
,
&
psi_file1
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
sfgao
);
p
ILFree
(
pidl
);
ILFree
(
pidl
);
IShellFolder_Release
(
pdesktopsf
);
...
...
@@ -4421,7 +4260,7 @@ static void test_ShellItemArrayGetAttributes(void)
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
for
(
i
=
0
;
i
<
5
;
i
++
)
p
ILFree
((
LPITEMIDLIST
)
pidl_array
[
i
]);
ILFree
((
LPITEMIDLIST
)
pidl_array
[
i
]);
/* [testfolder/, testfolder/testfolder2] seems to break in Vista */
attr
=
0xdeadbeef
;
...
...
@@ -4477,71 +4316,65 @@ static void test_SHParseDisplayName(void)
HRESULT
hr
;
BOOL
ret
,
is_wow64
;
if
(
!
pSHParseDisplayName
)
{
win_skip
(
"SHParseDisplayName isn't available
\n
"
);
return
;
}
if
(
0
)
{
/* crashes on native */
p
SHParseDisplayName
(
NULL
,
NULL
,
NULL
,
0
,
NULL
);
SHParseDisplayName
(
NULL
,
NULL
,
NULL
,
0
,
NULL
);
nameW
[
0
]
=
0
;
p
SHParseDisplayName
(
nameW
,
NULL
,
NULL
,
0
,
NULL
);
SHParseDisplayName
(
nameW
,
NULL
,
NULL
,
0
,
NULL
);
}
pidl1
=
(
LPITEMIDLIST
)
0xdeadbeef
;
hr
=
p
SHParseDisplayName
(
NULL
,
NULL
,
&
pidl1
,
0
,
NULL
);
hr
=
SHParseDisplayName
(
NULL
,
NULL
,
&
pidl1
,
0
,
NULL
);
ok
(
broken
(
hr
==
E_OUTOFMEMORY
)
/* < Vista */
||
hr
==
E_INVALIDARG
,
"failed %08x
\n
"
,
hr
);
ok
(
pidl1
==
0
,
"expected null ptr, got %p
\n
"
,
pidl1
);
/* dummy name */
nameW
[
0
]
=
0
;
hr
=
p
SHParseDisplayName
(
nameW
,
NULL
,
&
pidl1
,
0
,
NULL
);
hr
=
SHParseDisplayName
(
nameW
,
NULL
,
&
pidl1
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"failed %08x
\n
"
,
hr
);
hr
=
SHGetDesktopFolder
(
&
desktop
);
ok
(
hr
==
S_OK
,
"failed %08x
\n
"
,
hr
);
hr
=
IShellFolder_ParseDisplayName
(
desktop
,
NULL
,
NULL
,
nameW
,
NULL
,
&
pidl2
,
NULL
);
ok
(
hr
==
S_OK
,
"failed %08x
\n
"
,
hr
);
ret
=
p
ILIsEqual
(
pidl1
,
pidl2
);
ret
=
ILIsEqual
(
pidl1
,
pidl2
);
ok
(
ret
==
TRUE
,
"expected equal idls
\n
"
);
p
ILFree
(
pidl1
);
p
ILFree
(
pidl2
);
ILFree
(
pidl1
);
ILFree
(
pidl2
);
/* with path */
GetWindowsDirectoryW
(
dirW
,
MAX_PATH
);
hr
=
p
SHParseDisplayName
(
dirW
,
NULL
,
&
pidl1
,
0
,
NULL
);
hr
=
SHParseDisplayName
(
dirW
,
NULL
,
&
pidl1
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"failed %08x
\n
"
,
hr
);
hr
=
IShellFolder_ParseDisplayName
(
desktop
,
NULL
,
NULL
,
dirW
,
NULL
,
&
pidl2
,
NULL
);
ok
(
hr
==
S_OK
,
"failed %08x
\n
"
,
hr
);
ret
=
p
ILIsEqual
(
pidl1
,
pidl2
);
ret
=
ILIsEqual
(
pidl1
,
pidl2
);
ok
(
ret
==
TRUE
,
"expected equal idls
\n
"
);
p
ILFree
(
pidl1
);
p
ILFree
(
pidl2
);
ILFree
(
pidl1
);
ILFree
(
pidl2
);
/* system32 is not redirected to syswow64 on WOW64 */
if
(
!
pIsWow64Process
||
!
pIsWow64Process
(
GetCurrentProcess
(),
&
is_wow64
))
is_wow64
=
FALSE
;
if
(
is_wow64
&&
pGetSystemWow64DirectoryW
)
if
(
is_wow64
)
{
UINT
len
;
*
dirW
=
0
;
len
=
GetSystemDirectoryW
(
dirW
,
MAX_PATH
);
ok
(
len
>
0
,
"GetSystemDirectoryW failed: %u
\n
"
,
GetLastError
());
hr
=
p
SHParseDisplayName
(
dirW
,
NULL
,
&
pidl1
,
0
,
NULL
);
hr
=
SHParseDisplayName
(
dirW
,
NULL
,
&
pidl1
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"failed %08x
\n
"
,
hr
);
*
dirW
=
0
;
len
=
p
GetSystemWow64DirectoryW
(
dirW
,
MAX_PATH
);
len
=
GetSystemWow64DirectoryW
(
dirW
,
MAX_PATH
);
ok
(
len
>
0
,
"GetSystemWow64DirectoryW failed: %u
\n
"
,
GetLastError
());
hr
=
p
SHParseDisplayName
(
dirW
,
NULL
,
&
pidl2
,
0
,
NULL
);
hr
=
SHParseDisplayName
(
dirW
,
NULL
,
&
pidl2
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"failed %08x
\n
"
,
hr
);
ret
=
p
ILIsEqual
(
pidl1
,
pidl2
);
ret
=
ILIsEqual
(
pidl1
,
pidl2
);
ok
(
ret
==
FALSE
,
"expected different idls
\n
"
);
p
ILFree
(
pidl1
);
p
ILFree
(
pidl2
);
ILFree
(
pidl1
);
ILFree
(
pidl2
);
}
IShellFolder_Release
(
desktop
);
...
...
@@ -4595,7 +4428,7 @@ static void test_desktop_IPersist(void)
hr
=
IPersistFolder2_GetCurFolder
(
ppf2
,
&
pidl
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
pidl
!=
NULL
,
"pidl was NULL.
\n
"
);
if
(
SUCCEEDED
(
hr
))
p
ILFree
(
pidl
);
if
(
SUCCEEDED
(
hr
))
ILFree
(
pidl
);
IPersistFolder2_Release
(
ppf2
);
}
...
...
@@ -4613,12 +4446,6 @@ static void test_GetUIObject(void)
const
WCHAR
filename
[]
=
{
'\\'
,
't'
,
'e'
,
's'
,
't'
,
'd'
,
'i'
,
'r'
,
'\\'
,
't'
,
'e'
,
's'
,
't'
,
'1'
,
'.'
,
't'
,
'x'
,
't'
,
0
};
if
(
!
pSHBindToParent
)
{
win_skip
(
"SHBindToParent missing.
\n
"
);
return
;
}
GetCurrentDirectoryW
(
MAX_PATH
,
path
);
if
(
!
path
[
0
])
{
...
...
@@ -4636,7 +4463,7 @@ static void test_GetUIObject(void)
{
IShellFolder
*
psf
;
LPCITEMIDLIST
pidl_child
;
hr
=
p
SHBindToParent
(
pidl
,
&
IID_IShellFolder
,
(
void
**
)
&
psf
,
&
pidl_child
);
hr
=
SHBindToParent
(
pidl
,
&
IID_IShellFolder
,
(
void
**
)
&
psf
,
&
pidl_child
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
...
...
@@ -4692,9 +4519,7 @@ static void test_GetUIObject(void)
(
max_id_check
==
max_id
-
2
),
/* Win 8 */
"Not equal (or near equal), got %d and %d
\n
"
,
max_id_check
,
max_id
);
#define is_win2k() (pSHGetFolderPathA && !pSHGetFolderPathAndSubDirA)
if
(
count
&&
!
is_win2k
())
/* Test is interactive on w2k, so skip */
if
(
count
)
{
CMINVOKECOMMANDINFO
cmi
;
ZeroMemory
(
&
cmi
,
sizeof
(
CMINVOKECOMMANDINFO
));
...
...
@@ -4711,14 +4536,13 @@ static void test_GetUIObject(void)
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_NO_ASSOCIATION
)
/* Vista */
),
"Got 0x%08x
\n
"
,
hr
);
}
#undef is_win2k
DestroyMenu
(
hmenu
);
IContextMenu_Release
(
pcm
);
}
IShellFolder_Release
(
psf
);
}
if
(
pILFree
)
p
ILFree
(
pidl
);
ILFree
(
pidl
);
}
IShellFolder_Release
(
psf_desktop
);
...
...
@@ -4733,22 +4557,13 @@ static void r_verify_pidl(unsigned l, LPCITEMIDLIST pidl, const WCHAR *path)
STRRET
filename
;
HRESULT
hr
;
if
(
!
pSHBindToParent
){
win_skip
(
"SHBindToParent is not available, not performing full PIDL verification
\n
"
);
if
(
path
)
ok_
(
__FILE__
,
l
)(
pidl
!=
NULL
,
"Expected PIDL to be non-NULL
\n
"
);
else
ok_
(
__FILE__
,
l
)(
pidl
==
NULL
,
"Expected PIDL to be NULL
\n
"
);
return
;
}
if
(
path
){
if
(
!
pidl
){
ok_
(
__FILE__
,
l
)(
0
,
"didn't get expected path (%s), instead: NULL
\n
"
,
wine_dbgstr_w
(
path
));
return
;
}
hr
=
pSHBindToParent
(
pidl
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
parent
,
&
child
);
hr
=
SHBindToParent
(
pidl
,
&
IID_IShellFolder
,
(
void
*
*
)
&
parent
,
&
child
);
ok_
(
__FILE__
,
l
)(
hr
==
S_OK
,
"SHBindToParent failed: 0x%08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
...
...
@@ -4786,30 +4601,25 @@ static void test_SHSimpleIDListFromPath(void)
LPITEMIDLIST
pidl
=
NULL
;
if
(
!
pSHSimpleIDListFromPathAW
){
win_skip
(
"SHSimpleIDListFromPathAW not available
\n
"
);
return
;
}
br
=
CreateDirectoryA
(
adirA
,
NULL
);
ok
(
br
==
TRUE
,
"CreateDirectory failed: %d
\n
"
,
GetLastError
());
if
(
is_unicode
)
pidl
=
pSHSimpleIDListFromPathAW
(
adirW
);
pidl
=
SHSimpleIDListFromPath
(
adirW
);
else
pidl
=
pSHSimpleIDListFromPathAW
(
adirA
);
pidl
=
SHSimpleIDListFromPath
((
const
WCHAR
*
)
adirA
);
verify_pidl
(
pidl
,
adirW
);
p
ILFree
(
pidl
);
ILFree
(
pidl
);
br
=
RemoveDirectoryA
(
adirA
);
ok
(
br
==
TRUE
,
"RemoveDirectory failed: %d
\n
"
,
GetLastError
());
if
(
is_unicode
)
pidl
=
pSHSimpleIDListFromPathAW
(
adirW
);
pidl
=
SHSimpleIDListFromPath
(
adirW
);
else
pidl
=
pSHSimpleIDListFromPathAW
(
adirA
);
pidl
=
SHSimpleIDListFromPath
((
const
WCHAR
*
)
adirA
);
verify_pidl
(
pidl
,
adirW
);
p
ILFree
(
pidl
);
ILFree
(
pidl
);
}
/* IFileSystemBindData impl */
...
...
@@ -5207,9 +5017,9 @@ static void test_SHChangeNotify(BOOL test_new_delivery)
entries
[
0
].
pidl
=
NULL
;
if
(
has_unicode
)
hr
=
p
SHILCreateFromPath
(
root_dirW
,
(
LPITEMIDLIST
*
)
&
entries
[
0
].
pidl
,
0
);
hr
=
SHILCreateFromPath
(
root_dirW
,
(
LPITEMIDLIST
*
)
&
entries
[
0
].
pidl
,
0
);
else
hr
=
pSHILCreateFromPath
((
LPCVOID
)
root_dirA
,
(
LPITEMIDLIST
*
)
&
entries
[
0
].
pidl
,
0
);
hr
=
SHILCreateFromPath
((
const
void
*
)
root_dirA
,
(
LPITEMIDLIST
*
)
&
entries
[
0
].
pidl
,
0
);
ok
(
hr
==
S_OK
,
"SHILCreateFromPath failed: 0x%08x
\n
"
,
hr
);
entries
[
0
].
fRecursive
=
TRUE
;
...
...
@@ -5271,12 +5081,6 @@ static void test_SHCreateDefaultContextMenu(void)
return
;
}
if
(
!
pSHBindToParent
)
{
skip
(
"SHBindToParent missing.
\n
"
);
return
;
}
GetCurrentDirectoryW
(
MAX_PATH
,
path
);
if
(
!
path
[
0
])
{
...
...
@@ -5293,7 +5097,7 @@ static void test_SHCreateDefaultContextMenu(void)
if
(
SUCCEEDED
(
hr
))
{
hr
=
pSHBindToParent
(
pidl
,
&
IID_IShellFolder
,
(
void
**
)
&
folder
,
(
LPCITEMIDLIST
*
)
&
pidl_child
);
hr
=
SHBindToParent
(
pidl
,
&
IID_IShellFolder
,
(
void
**
)
&
folder
,
(
const
ITEMIDLIST
*
*
)
&
pidl_child
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
IShellFolder_QueryInterface
(
folder
,
&
IID_IPersistFolder2
,(
void
**
)
&
persist
);
...
...
@@ -5366,7 +5170,7 @@ static void test_DataObject(void)
hres
=
IShellFolder_GetUIObjectOf
(
desktop
,
NULL
,
1
,
(
LPCITEMIDLIST
*
)
&
apidl
,
&
IID_IDataObject
,
NULL
,
(
void
**
)
&
data_obj
);
ok
(
hres
==
S_OK
,
"got %x
\n
"
,
hres
);
p
ILFree
(
apidl
);
ILFree
(
apidl
);
IShellFolder_Release
(
desktop
);
cf_shellidlist
=
RegisterClipboardFormatW
(
CFSTR_SHELLIDLISTW
);
...
...
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