Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
e5c1a014
Commit
e5c1a014
authored
Oct 07, 2006
by
Hans Leidekker
Committed by
Alexandre Julliard
Oct 09, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32/tests: Win64 printf format warning fixes.
parent
89e1d294
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
249 additions
and
250 deletions
+249
-250
Makefile.in
dlls/shell32/tests/Makefile.in
+0
-1
shelllink.c
dlls/shell32/tests/shelllink.c
+62
-62
shellpath.c
dlls/shell32/tests/shellpath.c
+18
-18
shlexec.c
dlls/shell32/tests/shlexec.c
+13
-13
shlfileop.c
dlls/shell32/tests/shlfileop.c
+49
-49
shlfolder.c
dlls/shell32/tests/shlfolder.c
+107
-107
No files found.
dlls/shell32/tests/Makefile.in
View file @
e5c1a014
...
...
@@ -5,7 +5,6 @@ VPATH = @srcdir@
TESTDLL
=
shell32.dll
IMPORTS
=
shell32 ole32 oleaut32 shlwapi advapi32 kernel32
EXTRALIBS
=
-luuid
EXTRADEFS
=
-DWINE_NO_LONG_AS_INT
CTESTS
=
\
generated.c
\
...
...
dlls/shell32/tests/shelllink.c
View file @
e5c1a014
...
...
@@ -85,7 +85,7 @@ static LPITEMIDLIST path_to_pidl(const char* path)
r
=
pSHILCreateFromPath
(
pathW
,
&
pidl
,
NULL
);
todo_wine
{
ok
(
SUCCEEDED
(
r
),
"SHILCreateFromPath failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"SHILCreateFromPath failed (0x%08x)
\n
"
,
r
);
}
HeapFree
(
GetProcessHeap
(),
0
,
pathW
);
}
...
...
@@ -110,71 +110,71 @@ static void test_get_set(void)
r
=
CoCreateInstance
(
&
CLSID_ShellLink
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IShellLinkA
,
(
LPVOID
*
)
&
sl
);
ok
(
SUCCEEDED
(
r
),
"no IID_IShellLinkA (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"no IID_IShellLinkA (0x%08x)
\n
"
,
r
);
if
(
!
SUCCEEDED
(
r
))
return
;
/* Test Getting / Setting the description */
strcpy
(
buffer
,
"garbage"
);
r
=
IShellLinkA_GetDescription
(
sl
,
buffer
,
sizeof
(
buffer
));
ok
(
SUCCEEDED
(
r
),
"GetDescription failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"GetDescription failed (0x%08x)
\n
"
,
r
);
ok
(
*
buffer
==
'\0'
,
"GetDescription returned '%s'
\n
"
,
buffer
);
str
=
"Some description"
;
r
=
IShellLinkA_SetDescription
(
sl
,
str
);
ok
(
SUCCEEDED
(
r
),
"SetDescription failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"SetDescription failed (0x%08x)
\n
"
,
r
);
strcpy
(
buffer
,
"garbage"
);
r
=
IShellLinkA_GetDescription
(
sl
,
buffer
,
sizeof
(
buffer
));
ok
(
SUCCEEDED
(
r
),
"GetDescription failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"GetDescription failed (0x%08x)
\n
"
,
r
);
ok
(
lstrcmp
(
buffer
,
str
)
==
0
,
"GetDescription returned '%s'
\n
"
,
buffer
);
/* Test Getting / Setting the work directory */
strcpy
(
buffer
,
"garbage"
);
r
=
IShellLinkA_GetWorkingDirectory
(
sl
,
buffer
,
sizeof
(
buffer
));
ok
(
SUCCEEDED
(
r
),
"GetWorkingDirectory failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"GetWorkingDirectory failed (0x%08x)
\n
"
,
r
);
ok
(
*
buffer
==
'\0'
,
"GetWorkingDirectory returned '%s'
\n
"
,
buffer
);
str
=
"c:
\\
nonexistent
\\
directory"
;
r
=
IShellLinkA_SetWorkingDirectory
(
sl
,
str
);
ok
(
SUCCEEDED
(
r
),
"SetWorkingDirectory failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"SetWorkingDirectory failed (0x%08x)
\n
"
,
r
);
strcpy
(
buffer
,
"garbage"
);
r
=
IShellLinkA_GetWorkingDirectory
(
sl
,
buffer
,
sizeof
(
buffer
));
ok
(
SUCCEEDED
(
r
),
"GetWorkingDirectory failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"GetWorkingDirectory failed (0x%08x)
\n
"
,
r
);
ok
(
lstrcmpi
(
buffer
,
str
)
==
0
,
"GetWorkingDirectory returned '%s'
\n
"
,
buffer
);
/* Test Getting / Setting the work directory */
strcpy
(
buffer
,
"garbage"
);
r
=
IShellLinkA_GetPath
(
sl
,
buffer
,
sizeof
(
buffer
),
NULL
,
SLGP_RAWPATH
);
ok
(
SUCCEEDED
(
r
),
"GetPath failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"GetPath failed (0x%08x)
\n
"
,
r
);
ok
(
*
buffer
==
'\0'
,
"GetPath returned '%s'
\n
"
,
buffer
);
r
=
IShellLinkA_SetPath
(
sl
,
""
);
ok
(
r
==
S_OK
,
"SetPath failed (0x%08
l
x)
\n
"
,
r
);
ok
(
r
==
S_OK
,
"SetPath failed (0x%08x)
\n
"
,
r
);
strcpy
(
buffer
,
"garbage"
);
r
=
IShellLinkA_GetPath
(
sl
,
buffer
,
sizeof
(
buffer
),
NULL
,
SLGP_RAWPATH
);
ok
(
SUCCEEDED
(
r
),
"GetPath failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"GetPath failed (0x%08x)
\n
"
,
r
);
ok
(
*
buffer
==
'\0'
,
"GetPath returned '%s'
\n
"
,
buffer
);
str
=
"c:
\\
nonexistent
\\
file"
;
r
=
IShellLinkA_SetPath
(
sl
,
str
);
ok
(
r
==
S_FALSE
,
"SetPath failed (0x%08
l
x)
\n
"
,
r
);
ok
(
r
==
S_FALSE
,
"SetPath failed (0x%08x)
\n
"
,
r
);
strcpy
(
buffer
,
"garbage"
);
r
=
IShellLinkA_GetPath
(
sl
,
buffer
,
sizeof
(
buffer
),
NULL
,
SLGP_RAWPATH
);
ok
(
SUCCEEDED
(
r
),
"GetPath failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"GetPath failed (0x%08x)
\n
"
,
r
);
ok
(
lstrcmpi
(
buffer
,
str
)
==
0
,
"GetPath returned '%s'
\n
"
,
buffer
);
/* Get some a real path to play with */
r
=
GetModuleFileName
(
NULL
,
mypath
,
sizeof
(
mypath
));
ok
(
r
>=
0
&&
r
<
sizeof
(
mypath
),
"GetModuleFileName failed (%
l
d)
\n
"
,
r
);
ok
(
r
>=
0
&&
r
<
sizeof
(
mypath
),
"GetModuleFileName failed (%d)
\n
"
,
r
);
/* Test the interaction of SetPath and SetIDList */
tmp_pidl
=
NULL
;
r
=
IShellLinkA_GetIDList
(
sl
,
&
tmp_pidl
);
ok
(
SUCCEEDED
(
r
),
"GetIDList failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"GetIDList failed (0x%08x)
\n
"
,
r
);
if
(
SUCCEEDED
(
r
))
{
strcpy
(
buffer
,
"garbage"
);
...
...
@@ -194,11 +194,11 @@ static void test_get_set(void)
if
(
pidl
)
{
r
=
IShellLinkA_SetIDList
(
sl
,
pidl
);
ok
(
SUCCEEDED
(
r
),
"SetIDList failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"SetIDList failed (0x%08x)
\n
"
,
r
);
tmp_pidl
=
NULL
;
r
=
IShellLinkA_GetIDList
(
sl
,
&
tmp_pidl
);
ok
(
SUCCEEDED
(
r
),
"GetIDList failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"GetIDList failed (0x%08x)
\n
"
,
r
);
ok
(
tmp_pidl
&&
pILIsEqual
(
pidl
,
tmp_pidl
),
"GetIDList returned an incorrect pidl
\n
"
);
...
...
@@ -207,60 +207,60 @@ static void test_get_set(void)
strcpy
(
buffer
,
"garbage"
);
r
=
IShellLinkA_GetPath
(
sl
,
buffer
,
sizeof
(
buffer
),
NULL
,
SLGP_RAWPATH
);
ok
(
SUCCEEDED
(
r
),
"GetPath failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"GetPath failed (0x%08x)
\n
"
,
r
);
ok
(
lstrcmpi
(
buffer
,
mypath
)
==
0
,
"GetPath returned '%s'
\n
"
,
buffer
);
}
/* test path with quotes */
r
=
IShellLinkA_SetPath
(
sl
,
"
\"
c:
\\
nonexistent
\\
file
\"
"
);
ok
(
r
==
S_FALSE
,
"SetPath failed (0x%08
l
x)
\n
"
,
r
);
ok
(
r
==
S_FALSE
,
"SetPath failed (0x%08x)
\n
"
,
r
);
r
=
IShellLinkA_GetPath
(
sl
,
buffer
,
sizeof
(
buffer
),
NULL
,
SLGP_RAWPATH
);
ok
(
r
==
S_OK
,
"GetPath failed (0x%08
l
x)
\n
"
,
r
);
ok
(
r
==
S_OK
,
"GetPath failed (0x%08x)
\n
"
,
r
);
ok
(
!
lstrcmp
(
buffer
,
"C:
\\
nonexistent
\\
file"
),
"case doesn't match
\n
"
);
r
=
IShellLinkA_SetPath
(
sl
,
"
\"
c:
\\
foo"
);
ok
(
r
==
S_FALSE
,
"SetPath failed (0x%08
l
x)
\n
"
,
r
);
ok
(
r
==
S_FALSE
,
"SetPath failed (0x%08x)
\n
"
,
r
);
r
=
IShellLinkA_SetPath
(
sl
,
"
\"\"
c:
\\
foo"
);
ok
(
r
==
S_FALSE
,
"SetPath failed (0x%08
l
x)
\n
"
,
r
);
ok
(
r
==
S_FALSE
,
"SetPath failed (0x%08x)
\n
"
,
r
);
r
=
IShellLinkA_SetPath
(
sl
,
"c:
\\
foo
\"
"
);
ok
(
r
==
S_FALSE
,
"SetPath failed (0x%08
l
x)
\n
"
,
r
);
ok
(
r
==
S_FALSE
,
"SetPath failed (0x%08x)
\n
"
,
r
);
r
=
IShellLinkA_SetPath
(
sl
,
"
\"\"
c:
\\
foo
\"
"
);
ok
(
r
==
S_FALSE
,
"SetPath failed (0x%08
l
x)
\n
"
,
r
);
ok
(
r
==
S_FALSE
,
"SetPath failed (0x%08x)
\n
"
,
r
);
r
=
IShellLinkA_SetPath
(
sl
,
"
\"\"
c:
\\
foo
\"\"
"
);
ok
(
r
==
S_FALSE
,
"SetPath failed (0x%08
l
x)
\n
"
,
r
);
ok
(
r
==
S_FALSE
,
"SetPath failed (0x%08x)
\n
"
,
r
);
/* Test Getting / Setting the arguments */
strcpy
(
buffer
,
"garbage"
);
r
=
IShellLinkA_GetArguments
(
sl
,
buffer
,
sizeof
(
buffer
));
ok
(
SUCCEEDED
(
r
),
"GetArguments failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"GetArguments failed (0x%08x)
\n
"
,
r
);
ok
(
*
buffer
==
'\0'
,
"GetArguments returned '%s'
\n
"
,
buffer
);
str
=
"param1
\"
spaced param2
\"
"
;
r
=
IShellLinkA_SetArguments
(
sl
,
str
);
ok
(
SUCCEEDED
(
r
),
"SetArguments failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"SetArguments failed (0x%08x)
\n
"
,
r
);
strcpy
(
buffer
,
"garbage"
);
r
=
IShellLinkA_GetArguments
(
sl
,
buffer
,
sizeof
(
buffer
));
ok
(
SUCCEEDED
(
r
),
"GetArguments failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"GetArguments failed (0x%08x)
\n
"
,
r
);
ok
(
lstrcmp
(
buffer
,
str
)
==
0
,
"GetArguments returned '%s'
\n
"
,
buffer
);
/* Test Getting / Setting showcmd */
i
=
0xdeadbeef
;
r
=
IShellLinkA_GetShowCmd
(
sl
,
&
i
);
ok
(
SUCCEEDED
(
r
),
"GetShowCmd failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"GetShowCmd failed (0x%08x)
\n
"
,
r
);
ok
(
i
==
SW_SHOWNORMAL
,
"GetShowCmd returned %d
\n
"
,
i
);
r
=
IShellLinkA_SetShowCmd
(
sl
,
SW_SHOWMAXIMIZED
);
ok
(
SUCCEEDED
(
r
),
"SetShowCmd failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"SetShowCmd failed (0x%08x)
\n
"
,
r
);
i
=
0xdeadbeef
;
r
=
IShellLinkA_GetShowCmd
(
sl
,
&
i
);
ok
(
SUCCEEDED
(
r
),
"GetShowCmd failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"GetShowCmd failed (0x%08x)
\n
"
,
r
);
ok
(
i
==
SW_SHOWMAXIMIZED
,
"GetShowCmd returned %d'
\n
"
,
i
);
/* Test Getting / Setting the icon */
...
...
@@ -268,33 +268,33 @@ static void test_get_set(void)
strcpy
(
buffer
,
"garbage"
);
r
=
IShellLinkA_GetIconLocation
(
sl
,
buffer
,
sizeof
(
buffer
),
&
i
);
todo_wine
{
ok
(
SUCCEEDED
(
r
),
"GetIconLocation failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"GetIconLocation failed (0x%08x)
\n
"
,
r
);
}
ok
(
*
buffer
==
'\0'
,
"GetIconLocation returned '%s'
\n
"
,
buffer
);
ok
(
i
==
0
,
"GetIconLocation returned %d
\n
"
,
i
);
str
=
"c:
\\
nonexistent
\\
file"
;
r
=
IShellLinkA_SetIconLocation
(
sl
,
str
,
0xbabecafe
);
ok
(
SUCCEEDED
(
r
),
"SetIconLocation failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"SetIconLocation failed (0x%08x)
\n
"
,
r
);
i
=
0xdeadbeef
;
r
=
IShellLinkA_GetIconLocation
(
sl
,
buffer
,
sizeof
(
buffer
),
&
i
);
ok
(
SUCCEEDED
(
r
),
"GetIconLocation failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"GetIconLocation failed (0x%08x)
\n
"
,
r
);
ok
(
lstrcmpi
(
buffer
,
str
)
==
0
,
"GetArguments returned '%s'
\n
"
,
buffer
);
ok
(
i
==
0xbabecafe
,
"GetIconLocation returned %d'
\n
"
,
i
);
/* Test Getting / Setting the hot key */
w
=
0xbeef
;
r
=
IShellLinkA_GetHotkey
(
sl
,
&
w
);
ok
(
SUCCEEDED
(
r
),
"GetHotkey failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"GetHotkey failed (0x%08x)
\n
"
,
r
);
ok
(
w
==
0
,
"GetHotkey returned %d
\n
"
,
w
);
r
=
IShellLinkA_SetHotkey
(
sl
,
0x5678
);
ok
(
SUCCEEDED
(
r
),
"SetHotkey failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"SetHotkey failed (0x%08x)
\n
"
,
r
);
w
=
0xbeef
;
r
=
IShellLinkA_GetHotkey
(
sl
,
&
w
);
ok
(
SUCCEEDED
(
r
),
"GetHotkey failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"GetHotkey failed (0x%08x)
\n
"
,
r
);
ok
(
w
==
0x5678
,
"GetHotkey returned %d'
\n
"
,
w
);
IShellLinkA_Release
(
sl
);
...
...
@@ -316,65 +316,65 @@ void create_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int save_fails)
r
=
CoCreateInstance
(
&
CLSID_ShellLink
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IShellLinkA
,
(
LPVOID
*
)
&
sl
);
lok
(
SUCCEEDED
(
r
),
"no IID_IShellLinkA (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"no IID_IShellLinkA (0x%08x)
\n
"
,
r
);
if
(
!
SUCCEEDED
(
r
))
return
;
if
(
desc
->
description
)
{
r
=
IShellLinkA_SetDescription
(
sl
,
desc
->
description
);
lok
(
SUCCEEDED
(
r
),
"SetDescription failed (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"SetDescription failed (0x%08x)
\n
"
,
r
);
}
if
(
desc
->
workdir
)
{
r
=
IShellLinkA_SetWorkingDirectory
(
sl
,
desc
->
workdir
);
lok
(
SUCCEEDED
(
r
),
"SetWorkingDirectory failed (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"SetWorkingDirectory failed (0x%08x)
\n
"
,
r
);
}
if
(
desc
->
path
)
{
r
=
IShellLinkA_SetPath
(
sl
,
desc
->
path
);
lok
(
SUCCEEDED
(
r
),
"SetPath failed (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"SetPath failed (0x%08x)
\n
"
,
r
);
}
if
(
desc
->
pidl
)
{
r
=
IShellLinkA_SetIDList
(
sl
,
desc
->
pidl
);
lok
(
SUCCEEDED
(
r
),
"SetIDList failed (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"SetIDList failed (0x%08x)
\n
"
,
r
);
}
if
(
desc
->
arguments
)
{
r
=
IShellLinkA_SetArguments
(
sl
,
desc
->
arguments
);
lok
(
SUCCEEDED
(
r
),
"SetArguments failed (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"SetArguments failed (0x%08x)
\n
"
,
r
);
}
if
(
desc
->
showcmd
)
{
r
=
IShellLinkA_SetShowCmd
(
sl
,
desc
->
showcmd
);
lok
(
SUCCEEDED
(
r
),
"SetShowCmd failed (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"SetShowCmd failed (0x%08x)
\n
"
,
r
);
}
if
(
desc
->
icon
)
{
r
=
IShellLinkA_SetIconLocation
(
sl
,
desc
->
icon
,
desc
->
icon_id
);
lok
(
SUCCEEDED
(
r
),
"SetIconLocation failed (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"SetIconLocation failed (0x%08x)
\n
"
,
r
);
}
if
(
desc
->
hotkey
)
{
r
=
IShellLinkA_SetHotkey
(
sl
,
desc
->
hotkey
);
lok
(
SUCCEEDED
(
r
),
"SetHotkey failed (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"SetHotkey failed (0x%08x)
\n
"
,
r
);
}
r
=
IShellLinkW_QueryInterface
(
sl
,
&
IID_IPersistFile
,
(
LPVOID
*
)
&
pf
);
lok
(
SUCCEEDED
(
r
),
"no IID_IPersistFile (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"no IID_IPersistFile (0x%08x)
\n
"
,
r
);
if
(
SUCCEEDED
(
r
))
{
r
=
IPersistFile_Save
(
pf
,
path
,
TRUE
);
if
(
save_fails
)
{
todo_wine
{
lok
(
SUCCEEDED
(
r
),
"save failed (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"save failed (0x%08x)
\n
"
,
r
);
}
}
else
{
lok
(
SUCCEEDED
(
r
),
"save failed (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"save failed (0x%08x)
\n
"
,
r
);
}
IPersistFile_Release
(
pf
);
}
...
...
@@ -391,12 +391,12 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc)
r
=
CoCreateInstance
(
&
CLSID_ShellLink
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IShellLinkA
,
(
LPVOID
*
)
&
sl
);
lok
(
SUCCEEDED
(
r
),
"no IID_IShellLinkA (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"no IID_IShellLinkA (0x%08x)
\n
"
,
r
);
if
(
!
SUCCEEDED
(
r
))
return
;
r
=
IShellLinkA_QueryInterface
(
sl
,
&
IID_IPersistFile
,
(
LPVOID
*
)
&
pf
);
lok
(
SUCCEEDED
(
r
),
"no IID_IPersistFile (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"no IID_IPersistFile (0x%08x)
\n
"
,
r
);
if
(
!
SUCCEEDED
(
r
))
{
IShellLinkA_Release
(
sl
);
...
...
@@ -404,7 +404,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc)
}
r
=
IPersistFile_Load
(
pf
,
path
,
STGM_READ
);
lok
(
SUCCEEDED
(
r
),
"load failed (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"load failed (0x%08x)
\n
"
,
r
);
IPersistFile_Release
(
pf
);
if
(
!
SUCCEEDED
(
r
))
{
...
...
@@ -416,7 +416,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc)
{
strcpy
(
buffer
,
"garbage"
);
r
=
IShellLinkA_GetDescription
(
sl
,
buffer
,
sizeof
(
buffer
));
lok
(
SUCCEEDED
(
r
),
"GetDescription failed (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"GetDescription failed (0x%08x)
\n
"
,
r
);
lok
(
lstrcmp
(
buffer
,
desc
->
description
)
==
0
,
"GetDescription returned '%s' instead of '%s'
\n
"
,
buffer
,
desc
->
description
);
...
...
@@ -425,7 +425,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc)
{
strcpy
(
buffer
,
"garbage"
);
r
=
IShellLinkA_GetWorkingDirectory
(
sl
,
buffer
,
sizeof
(
buffer
));
lok
(
SUCCEEDED
(
r
),
"GetWorkingDirectory failed (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"GetWorkingDirectory failed (0x%08x)
\n
"
,
r
);
lok
(
lstrcmpi
(
buffer
,
desc
->
workdir
)
==
0
,
"GetWorkingDirectory returned '%s' instead of '%s'
\n
"
,
buffer
,
desc
->
workdir
);
...
...
@@ -434,7 +434,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc)
{
strcpy
(
buffer
,
"garbage"
);
r
=
IShellLinkA_GetPath
(
sl
,
buffer
,
sizeof
(
buffer
),
NULL
,
SLGP_RAWPATH
);
lok
(
SUCCEEDED
(
r
),
"GetPath failed (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"GetPath failed (0x%08x)
\n
"
,
r
);
lok
(
lstrcmpi
(
buffer
,
desc
->
path
)
==
0
,
"GetPath returned '%s' instead of '%s'
\n
"
,
buffer
,
desc
->
path
);
...
...
@@ -443,7 +443,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc)
{
LPITEMIDLIST
pidl
=
NULL
;
r
=
IShellLinkA_GetIDList
(
sl
,
&
pidl
);
lok
(
SUCCEEDED
(
r
),
"GetIDList failed (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"GetIDList failed (0x%08x)
\n
"
,
r
);
lok
(
pILIsEqual
(
pidl
,
desc
->
pidl
),
"GetIDList returned an incorrect pidl
\n
"
);
}
...
...
@@ -451,7 +451,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc)
{
int
i
=
0xdeadbeef
;
r
=
IShellLinkA_GetShowCmd
(
sl
,
&
i
);
lok
(
SUCCEEDED
(
r
),
"GetShowCmd failed (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"GetShowCmd failed (0x%08x)
\n
"
,
r
);
lok
(
i
==
desc
->
showcmd
,
"GetShowCmd returned 0x%0x instead of 0x%0x
\n
"
,
i
,
desc
->
showcmd
);
...
...
@@ -461,7 +461,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc)
int
i
=
0xdeadbeef
;
strcpy
(
buffer
,
"garbage"
);
r
=
IShellLinkA_GetIconLocation
(
sl
,
buffer
,
sizeof
(
buffer
),
&
i
);
lok
(
SUCCEEDED
(
r
),
"GetIconLocation failed (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"GetIconLocation failed (0x%08x)
\n
"
,
r
);
lok
(
lstrcmpi
(
buffer
,
desc
->
icon
)
==
0
,
"GetIconLocation returned '%s' instead of '%s'
\n
"
,
buffer
,
desc
->
icon
);
...
...
@@ -473,7 +473,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc)
{
WORD
i
=
0xbeef
;
r
=
IShellLinkA_GetHotkey
(
sl
,
&
i
);
lok
(
SUCCEEDED
(
r
),
"GetHotkey failed (0x%08
l
x)
\n
"
,
r
);
lok
(
SUCCEEDED
(
r
),
"GetHotkey failed (0x%08x)
\n
"
,
r
);
lok
(
i
==
desc
->
hotkey
,
"GetHotkey returned 0x%04x instead of 0x%04x
\n
"
,
i
,
desc
->
hotkey
);
...
...
@@ -516,7 +516,7 @@ static void test_load_save(void)
check_lnk
(
lnkfile
,
&
desc
);
r
=
GetModuleFileName
(
NULL
,
mypath
,
sizeof
(
mypath
));
ok
(
r
>=
0
&&
r
<
sizeof
(
mypath
),
"GetModuleFileName failed (%
l
d)
\n
"
,
r
);
ok
(
r
>=
0
&&
r
<
sizeof
(
mypath
),
"GetModuleFileName failed (%d)
\n
"
,
r
);
strcpy
(
mydir
,
mypath
);
p
=
strrchr
(
mydir
,
'\\'
);
if
(
p
)
...
...
@@ -541,7 +541,7 @@ static void test_load_save(void)
/* DeleteFileW is not implemented on Win9x */
r
=
DeleteFileA
(
"c:
\\
test.lnk"
);
ok
(
r
,
"failed to delete link (%
l
d)
\n
"
,
GetLastError
());
ok
(
r
,
"failed to delete link (%d)
\n
"
,
GetLastError
());
}
static
void
test_datalink
(
void
)
...
...
@@ -627,7 +627,7 @@ START_TEST(shelllink)
pSHILCreateFromPath
=
(
fnSHILCreateFromPath
)
GetProcAddress
(
hmod
,
(
LPSTR
)
28
);
r
=
CoInitialize
(
NULL
);
ok
(
SUCCEEDED
(
r
),
"CoInitialize failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"CoInitialize failed (0x%08x)
\n
"
,
r
);
if
(
!
SUCCEEDED
(
r
))
return
;
...
...
dlls/shell32/tests/shellpath.c
View file @
e5c1a014
...
...
@@ -178,7 +178,7 @@ static void loadShell32(void)
{
HRESULT
hr
=
pSHGetMalloc
(
&
pMalloc
);
ok
(
SUCCEEDED
(
hr
),
"SHGetMalloc failed: 0x%08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"SHGetMalloc failed: 0x%08x
\n
"
,
hr
);
ok
(
pMalloc
!=
NULL
,
"SHGetMalloc returned a NULL IMalloc
\n
"
);
}
...
...
@@ -187,7 +187,7 @@ static void loadShell32(void)
shellVersion
.
cbSize
=
sizeof
(
shellVersion
);
pDllGetVersion
(
&
shellVersion
);
if
(
winetest_interactive
)
printf
(
"shell32 version is %
ld.%l
d
\n
"
,
printf
(
"shell32 version is %
d.%
d
\n
"
,
shellVersion
.
dwMajorVersion
,
shellVersion
.
dwMinorVersion
);
}
}
...
...
@@ -296,7 +296,7 @@ static void testSHGetFolderLocationInvalidArgs(void)
hr
=
pSHGetFolderLocation
(
NULL
,
0xeeee
,
NULL
,
0
,
&
pidl
);
ok
(
hr
==
E_INVALIDARG
,
"SHGetFolderLocation(NULL, 0xeeee, NULL, 0, &pidl)
\n
"
"returned 0x%08
l
x, expected E_INVALIDARG
\n
"
,
hr
);
"returned 0x%08x, expected E_INVALIDARG
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
IMalloc_Free
(
pMalloc
,
pidl
);
/* check a bogus user token: */
...
...
@@ -304,7 +304,7 @@ static void testSHGetFolderLocationInvalidArgs(void)
hr
=
pSHGetFolderLocation
(
NULL
,
CSIDL_FAVORITES
,
(
HANDLE
)
2
,
0
,
&
pidl
);
ok
(
hr
==
E_FAIL
,
"SHGetFolderLocation(NULL, CSIDL_FAVORITES, 2, 0, &pidl)
\n
"
"returned 0x%08
l
x, expected E_FAIL
\n
"
,
hr
);
"returned 0x%08x, expected E_FAIL
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
IMalloc_Free
(
pMalloc
,
pidl
);
/* check reserved is not zero: */
...
...
@@ -312,7 +312,7 @@ static void testSHGetFolderLocationInvalidArgs(void)
hr
=
pSHGetFolderLocation
(
NULL
,
CSIDL_DESKTOP
,
NULL
,
1
,
&
pidl
);
ok
(
hr
==
E_INVALIDARG
,
"SHGetFolderLocation(NULL, CSIDL_DESKTOP, NULL, 1, &pidl)
\n
"
"returned 0x%08
l
x, expected E_INVALIDARG
\n
"
,
hr
);
"returned 0x%08x, expected E_INVALIDARG
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
IMalloc_Free
(
pMalloc
,
pidl
);
/* a NULL pidl pointer crashes, so don't test it */
...
...
@@ -328,7 +328,7 @@ static void testSHGetSpecialFolderLocationInvalidArgs(void)
/* SHGetSpecialFolderLocation(NULL, 0, NULL) crashes */
hr
=
pSHGetSpecialFolderLocation
(
NULL
,
0xeeee
,
&
pidl
);
ok
(
hr
==
E_INVALIDARG
,
"SHGetSpecialFolderLocation(NULL, 0xeeee, &pidl) returned 0x%08
l
x, "
"SHGetSpecialFolderLocation(NULL, 0xeeee, &pidl) returned 0x%08x, "
"expected E_INVALIDARG
\n
"
,
hr
);
}
...
...
@@ -344,11 +344,11 @@ static void testSHGetFolderPathInvalidArgs(void)
SHGFP_TYPE_DEFAULT
,
path
);
ok
(
hr
==
E_FAIL
,
"SHGetFolderPathA(NULL, CSIDL_DESKTOP, 2, SHGFP_TYPE_DEFAULT, path)
\n
"
"returned 0x%08
l
x, expected E_FAIL
\n
"
,
hr
);
"returned 0x%08x, expected E_FAIL
\n
"
,
hr
);
hr
=
pSHGetFolderPathA
(
NULL
,
0xeeee
,
NULL
,
SHGFP_TYPE_DEFAULT
,
path
);
ok
(
hr
==
E_INVALIDARG
,
"SHGetFolderPathA(NULL, 0xeeee, NULL, SHGFP_TYPE_DEFAULT, path)
\n
"
"returned 0x%08
l
x, expected E_INVALIDARG
\n
"
,
hr
);
"returned 0x%08x, expected E_INVALIDARG
\n
"
,
hr
);
}
static
void
testSHGetSpecialFolderPathInvalidArgs
(
void
)
...
...
@@ -399,7 +399,7 @@ static BYTE testSHGetFolderLocation(BOOL optional, int folder)
hr
=
pSHGetFolderLocation
(
NULL
,
folder
,
NULL
,
0
,
&
pidl
);
ok
(
SUCCEEDED
(
hr
)
||
optional
,
"SHGetFolderLocation(NULL, %s, NULL, 0, &pidl)
\n
"
"failed: 0x%08
l
x
\n
"
,
getFolderName
(
folder
),
hr
);
"failed: 0x%08x
\n
"
,
getFolderName
(
folder
),
hr
);
if
(
SUCCEEDED
(
hr
))
{
ok
(
pidl
!=
NULL
,
...
...
@@ -433,7 +433,7 @@ static BYTE testSHGetSpecialFolderLocation(BOOL optional, int folder)
hr
=
pSHGetSpecialFolderLocation
(
NULL
,
folder
,
&
pidl
);
ok
(
SUCCEEDED
(
hr
)
||
optional
,
"SHGetSpecialFolderLocation(NULL, %s, &pidl)
\n
"
"failed: 0x%08
l
x
\n
"
,
getFolderName
(
folder
),
hr
);
"failed: 0x%08x
\n
"
,
getFolderName
(
folder
),
hr
);
if
(
SUCCEEDED
(
hr
))
{
ok
(
pidl
!=
NULL
,
...
...
@@ -463,7 +463,7 @@ static void testSHGetFolderPath(BOOL optional, int folder)
hr
=
pSHGetFolderPathA
(
NULL
,
folder
,
NULL
,
SHGFP_TYPE_CURRENT
,
path
);
ok
(
SUCCEEDED
(
hr
)
||
optional
,
"SHGetFolderPathA(NULL, %s, NULL, SHGFP_TYPE_CURRENT, path)
\n
"
"failed: 0x%08
l
x
\n
"
,
getFolderName
(
folder
),
hr
);
"failed: 0x%08x
\n
"
,
getFolderName
(
folder
),
hr
);
}
static
void
testSHGetSpecialFolderPath
(
BOOL
optional
,
int
folder
)
...
...
@@ -723,19 +723,19 @@ static void testNonExistentPath1(void)
hr
=
pSHGetFolderPathA
(
NULL
,
CSIDL_FAVORITES
,
NULL
,
SHGFP_TYPE_CURRENT
,
path
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
),
"SHGetFolderPath returned 0x%08
l
x, expected 0x80070002
\n
"
,
hr
);
"SHGetFolderPath returned 0x%08x, expected 0x80070002
\n
"
,
hr
);
pidl
=
NULL
;
hr
=
pSHGetFolderLocation
(
NULL
,
CSIDL_FAVORITES
,
NULL
,
0
,
&
pidl
);
ok
(
hr
==
E_FAIL
,
"SHGetFolderLocation returned 0x%08
l
x, expected E_FAIL
\n
"
,
hr
);
"SHGetFolderLocation returned 0x%08x, expected E_FAIL
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
)
&&
pidl
)
IMalloc_Free
(
pMalloc
,
pidl
);
ok
(
!
pSHGetSpecialFolderPathA
(
NULL
,
path
,
CSIDL_FAVORITES
,
FALSE
),
"SHGetSpecialFolderPath succeeded, expected failure
\n
"
);
pidl
=
NULL
;
hr
=
pSHGetSpecialFolderLocation
(
NULL
,
CSIDL_FAVORITES
,
&
pidl
);
ok
(
hr
==
E_FAIL
,
"SHGetFolderLocation returned 0x%08
l
x, expected E_FAIL
\n
"
,
ok
(
hr
==
E_FAIL
,
"SHGetFolderLocation returned 0x%08x, expected E_FAIL
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
)
&&
pidl
)
IMalloc_Free
(
pMalloc
,
pidl
);
...
...
@@ -754,13 +754,13 @@ static void testNonExistentPath1(void)
"with ERROR_ALREADY_EXISTS
\n
"
);
if
(
!
ret
)
ok
(
GetLastError
()
==
ERROR_ALREADY_EXISTS
,
"CreateDirectoryA failed with %
l
d, "
"CreateDirectoryA failed with %d, "
"expected ERROR_ALREADY_EXISTS
\n
"
,
GetLastError
());
}
ok
(
SUCCEEDED
(
hr
),
"SHGetFolderPath(NULL, CSIDL_FAVORITES | CSIDL_FLAG_CREATE, "
"NULL, SHGFP_TYPE_CURRENT, path)
\n
failed: 0x%08
l
x
\n
"
,
hr
);
"NULL, SHGFP_TYPE_CURRENT, path)
\n
failed: 0x%08x
\n
"
,
hr
);
}
/* Subprocess helper 2: make sure SHGetFolderPath still succeeds when the
...
...
@@ -773,7 +773,7 @@ static void testNonExistentPath2(void)
hr
=
pSHGetFolderPathA
(
NULL
,
CSIDL_FAVORITES
|
CSIDL_FLAG_CREATE
,
NULL
,
SHGFP_TYPE_CURRENT
,
path
);
ok
(
SUCCEEDED
(
hr
),
"SHGetFolderPath failed: 0x%08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"SHGetFolderPath failed: 0x%08x
\n
"
,
hr
);
}
static
void
doChild
(
const
char
*
arg
)
...
...
@@ -849,7 +849,7 @@ static void testNonExistentPath(void)
/* Query the path to be able to delete it below */
hr
=
pSHGetFolderPathA
(
NULL
,
CSIDL_FAVORITES
,
NULL
,
SHGFP_TYPE_CURRENT
,
modifiedPath
);
ok
(
SUCCEEDED
(
hr
),
"SHGetFolderPathA failed: 0x%08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"SHGetFolderPathA failed: 0x%08x
\n
"
,
hr
);
/* restore original values: */
if
(
winetest_interactive
)
...
...
dlls/shell32/tests/shlexec.c
View file @
e5c1a014
...
...
@@ -546,12 +546,12 @@ static void test_filename(void)
rc
=
0
;
if
((
test
->
todo
&
0x1
)
==
0
)
{
ok
(
rc
==
test
->
rc
,
"%s failed: rc=%d err=%
l
d
\n
"
,
shell_call
,
ok
(
rc
==
test
->
rc
,
"%s failed: rc=%d err=%d
\n
"
,
shell_call
,
rc
,
GetLastError
());
}
else
todo_wine
{
ok
(
rc
==
test
->
rc
,
"%s failed: rc=%d err=%
l
d
\n
"
,
shell_call
,
ok
(
rc
==
test
->
rc
,
"%s failed: rc=%d err=%d
\n
"
,
shell_call
,
rc
,
GetLastError
());
}
if
(
rc
==
0
)
...
...
@@ -595,12 +595,12 @@ static void test_filename(void)
rc
=
0
;
if
((
test
->
todo
&
0x1
)
==
0
)
{
ok
(
rc
==
test
->
rc
,
"%s failed: rc=%d err=%
l
d
\n
"
,
shell_call
,
ok
(
rc
==
test
->
rc
,
"%s failed: rc=%d err=%d
\n
"
,
shell_call
,
rc
,
GetLastError
());
}
else
todo_wine
{
ok
(
rc
==
test
->
rc
,
"%s failed: rc=%d err=%
l
d
\n
"
,
shell_call
,
ok
(
rc
==
test
->
rc
,
"%s failed: rc=%d err=%d
\n
"
,
shell_call
,
rc
,
GetLastError
());
}
if
(
rc
==
0
)
...
...
@@ -664,7 +664,7 @@ static void test_filename(void)
*/
sprintf
(
filename
,
"
\"
%s
\\
test file.shlexec
\"
"
,
tmpdir
);
rc
=
shell_execute
(
NULL
,
filename
,
NULL
,
NULL
);
ok
(
rc
>=
32
,
"%s failed: rc=%d err=%
l
d
\n
"
,
shell_call
,
rc
,
ok
(
rc
>=
32
,
"%s failed: rc=%d err=%d
\n
"
,
shell_call
,
rc
,
GetLastError
());
okChildInt
(
"argcA"
,
5
);
okChildString
(
"argvA3"
,
"Open"
);
...
...
@@ -699,7 +699,7 @@ static void test_lnks(void)
sprintf
(
filename
,
"%s
\\
test_shortcut_shlexec.lnk"
,
tmpdir
);
rc
=
shell_execute_ex
(
SEE_MASK_NOZONECHECKS
,
NULL
,
filename
,
NULL
,
NULL
);
ok
(
rc
>=
32
,
"%s failed: rc=%d err=%
l
d
\n
"
,
shell_call
,
rc
,
ok
(
rc
>=
32
,
"%s failed: rc=%d err=%d
\n
"
,
shell_call
,
rc
,
GetLastError
());
okChildInt
(
"argcA"
,
5
);
okChildString
(
"argvA3"
,
"Open"
);
...
...
@@ -708,7 +708,7 @@ static void test_lnks(void)
sprintf
(
filename
,
"%s
\\
test_shortcut_exe.lnk"
,
tmpdir
);
rc
=
shell_execute_ex
(
SEE_MASK_NOZONECHECKS
,
NULL
,
filename
,
NULL
,
NULL
);
ok
(
rc
>=
32
,
"%s failed: rc=%d err=%
l
d
\n
"
,
shell_call
,
rc
,
ok
(
rc
>=
32
,
"%s failed: rc=%d err=%d
\n
"
,
shell_call
,
rc
,
GetLastError
());
okChildInt
(
"argcA"
,
4
);
okChildString
(
"argvA3"
,
"Lnk"
);
...
...
@@ -728,7 +728,7 @@ static void test_lnks(void)
c
++
;
}
rc
=
shell_execute_ex
(
SEE_MASK_NOZONECHECKS
,
NULL
,
filename
,
NULL
,
NULL
);
ok
(
rc
>=
32
,
"%s failed: rc=%d err=%
l
d
\n
"
,
shell_call
,
rc
,
ok
(
rc
>=
32
,
"%s failed: rc=%d err=%d
\n
"
,
shell_call
,
rc
,
GetLastError
());
okChildInt
(
"argcA"
,
4
);
okChildString
(
"argvA3"
,
"Lnk"
);
...
...
@@ -747,12 +747,12 @@ static void test_lnks(void)
rc
=
0
;
if
((
test
->
todo
&
0x1
)
==
0
)
{
ok
(
rc
==
test
->
rc
,
"%s failed: rc=%d err=%
l
d
\n
"
,
shell_call
,
ok
(
rc
==
test
->
rc
,
"%s failed: rc=%d err=%d
\n
"
,
shell_call
,
rc
,
GetLastError
());
}
else
todo_wine
{
ok
(
rc
==
test
->
rc
,
"%s failed: rc=%d err=%
l
d
\n
"
,
shell_call
,
ok
(
rc
==
test
->
rc
,
"%s failed: rc=%d err=%d
\n
"
,
shell_call
,
rc
,
GetLastError
());
}
if
(
rc
==
0
)
...
...
@@ -832,7 +832,7 @@ static void init_test(void)
{
dllver
.
cbSize
=
sizeof
(
dllver
);
pDllGetVersion
(
&
dllver
);
trace
(
"major=%
ld minor=%ld build=%ld platform=%l
d
\n
"
,
trace
(
"major=%
d minor=%d build=%d platform=%
d
\n
"
,
dllver
.
dwMajorVersion
,
dllver
.
dwMinorVersion
,
dllver
.
dwBuildNumber
,
dllver
.
dwPlatformID
);
}
...
...
@@ -842,7 +842,7 @@ static void init_test(void)
}
r
=
CoInitialize
(
NULL
);
ok
(
SUCCEEDED
(
r
),
"CoInitialize failed (0x%08
l
x)
\n
"
,
r
);
ok
(
SUCCEEDED
(
r
),
"CoInitialize failed (0x%08x)
\n
"
,
r
);
if
(
!
SUCCEEDED
(
r
))
exit
(
1
);
...
...
@@ -870,7 +870,7 @@ static void init_test(void)
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
hfile
==
INVALID_HANDLE_VALUE
)
{
trace
(
"unable to create '%s': err=%
l
d
\n
"
,
filename
,
GetLastError
());
trace
(
"unable to create '%s': err=%d
\n
"
,
filename
,
GetLastError
());
assert
(
0
);
}
CloseHandle
(
hfile
);
...
...
dlls/shell32/tests/shlfileop.c
View file @
e5c1a014
...
...
@@ -156,7 +156,7 @@ static void test_delete(void)
ok
(
!
file_exists
(
"test1.txt"
),
"File should be removed
\n
"
);
ret
=
SHFileOperationA
(
&
shfo
);
ok
(
!
ret
,
"Directory exists, but is not removed, ret=%
l
d
\n
"
,
ret
);
ok
(
!
ret
,
"Directory exists, but is not removed, ret=%d
\n
"
,
ret
);
ok
(
file_exists
(
"test4.txt"
),
"Directory should not be removed
\n
"
);
shfo
.
fFlags
=
FOF_NOCONFIRMATION
|
FOF_SILENT
|
FOF_NOERRORUI
;
...
...
@@ -165,7 +165,7 @@ static void test_delete(void)
ok
(
!
file_exists
(
"test4.txt"
),
"Directory should be removed
\n
"
);
ret
=
SHFileOperationA
(
&
shfo
);
ok
(
!
ret
,
"The requested file does not exist, ret=%
l
d
\n
"
,
ret
);
ok
(
!
ret
,
"The requested file does not exist, ret=%d
\n
"
,
ret
);
init_shfo_tests
();
sprintf
(
buf
,
"%s
\\
%s"
,
CURR_DIR
,
"test4.txt"
);
...
...
@@ -204,7 +204,7 @@ static void test_delete(void)
shfo
.
fFlags
&=
~
FOF_FILESONLY
;
shfo
.
fAnyOperationsAborted
=
FALSE
;
ret
=
SHFileOperation
(
&
shfo
);
ok
(
ret
==
ERROR_ACCESS_DENIED
,
"Expected ERROR_ACCESS_DENIED, got %
l
d
\n
"
,
ret
);
ok
(
ret
==
ERROR_ACCESS_DENIED
,
"Expected ERROR_ACCESS_DENIED, got %d
\n
"
,
ret
);
ok
(
!
shfo
.
fAnyOperationsAborted
,
"Expected no aborted operations
\n
"
);
ok
(
file_exists
(
"test1.txt"
),
"Expected test1.txt to exist
\n
"
);
...
...
@@ -213,7 +213,7 @@ static void test_delete(void)
shfo
.
pFrom
=
"test1.txt
\0
"
;
shfo
.
wFunc
=
0
;
ret
=
SHFileOperation
(
&
shfo
);
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
ret
);
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
ret
);
ok
(
file_exists
(
"test1.txt"
),
"Expected test1.txt to exist
\n
"
);
/* try an invalid list, only one null terminator */
...
...
@@ -221,7 +221,7 @@ static void test_delete(void)
shfo
.
pFrom
=
""
;
shfo
.
wFunc
=
FO_DELETE
;
ret
=
SHFileOperation
(
&
shfo
);
ok
(
ret
==
ERROR_ACCESS_DENIED
,
"Expected ERROR_ACCESS_DENIED, got %
l
d
\n
"
,
ret
);
ok
(
ret
==
ERROR_ACCESS_DENIED
,
"Expected ERROR_ACCESS_DENIED, got %d
\n
"
,
ret
);
ok
(
file_exists
(
"test1.txt"
),
"Expected test1.txt to exist
\n
"
);
/* delete a dir, and then a file inside the dir, same as
...
...
@@ -230,7 +230,7 @@ static void test_delete(void)
init_shfo_tests
();
shfo
.
pFrom
=
"testdir2
\0
testdir2
\\
one.txt
\0
"
;
ret
=
SHFileOperation
(
&
shfo
);
ok
(
ret
==
ERROR_PATH_NOT_FOUND
,
"Expected ERROR_PATH_NOT_FOUND, got %
l
d
\n
"
,
ret
);
ok
(
ret
==
ERROR_PATH_NOT_FOUND
,
"Expected ERROR_PATH_NOT_FOUND, got %d
\n
"
,
ret
);
ok
(
!
file_exists
(
"testdir2"
),
"Expected testdir2 to not exist
\n
"
);
ok
(
!
file_exists
(
"testdir2
\\
one.txt"
),
"Expected testdir2
\\
one.txt to not exist
\n
"
);
...
...
@@ -239,7 +239,7 @@ static void test_delete(void)
shfo
.
pFrom
=
"testdir2
\0
"
;
shfo
.
fFlags
|=
FOF_NORECURSION
;
ret
=
SHFileOperation
(
&
shfo
);
ok
(
ret
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
ret
);
ok
(
ret
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
ok
(
!
file_exists
(
"testdir2
\\
one.txt"
),
"Expected testdir2
\\
one.txt to not exist
\n
"
);
ok
(
!
file_exists
(
"testdir2
\\
nested"
),
"Expected testdir2
\\
nested to exist
\n
"
);
}
...
...
@@ -275,7 +275,7 @@ static void test_rename(void)
set_curr_dir_path
(
to
,
"test6.txt
\0
test7.txt
\0
test8.txt
\0
"
);
retval
=
SHFileOperationA
(
&
shfo
);
/* W98 returns 0, W2K and newer returns ERROR_GEN_FAILURE, both do nothing */
ok
(
!
retval
||
retval
==
ERROR_GEN_FAILURE
||
retval
==
ERROR_INVALID_TARGET_HANDLE
,
"Can't rename many files, retval = %
l
d
\n
"
,
retval
);
"Can't rename many files, retval = %d
\n
"
,
retval
);
ok
(
file_exists
(
"test1.txt"
),
"The file is renamed - many files are specified
\n
"
);
memcpy
(
&
shfo2
,
&
shfo
,
sizeof
(
SHFILEOPSTRUCTA
));
...
...
@@ -285,38 +285,38 @@ static void test_rename(void)
set_curr_dir_path
(
to
,
"test6.txt
\0
test7.txt
\0
test8.txt
\0
"
);
retval
=
SHFileOperationA
(
&
shfo2
);
/* W98 returns 0, W2K and newer returns ERROR_GEN_FAILURE, both do nothing */
ok
(
!
retval
||
retval
==
ERROR_GEN_FAILURE
||
retval
==
ERROR_INVALID_TARGET_HANDLE
,
"Can't rename many files, retval = %
l
d
\n
"
,
retval
);
"Can't rename many files, retval = %d
\n
"
,
retval
);
ok
(
file_exists
(
"test1.txt"
),
"The file is not renamed - many files are specified
\n
"
);
set_curr_dir_path
(
from
,
"test1.txt
\0
"
);
set_curr_dir_path
(
to
,
"test6.txt
\0
"
);
retval
=
SHFileOperationA
(
&
shfo
);
ok
(
!
retval
,
"Rename file failed, retval = %
l
d
\n
"
,
retval
);
ok
(
!
retval
,
"Rename file failed, retval = %d
\n
"
,
retval
);
ok
(
!
file_exists
(
"test1.txt"
),
"The file is not renamed
\n
"
);
ok
(
file_exists
(
"test6.txt"
),
"The file is not renamed
\n
"
);
set_curr_dir_path
(
from
,
"test6.txt
\0
"
);
set_curr_dir_path
(
to
,
"test1.txt
\0
"
);
retval
=
SHFileOperationA
(
&
shfo
);
ok
(
!
retval
,
"Rename file back failed, retval = %
l
d
\n
"
,
retval
);
ok
(
!
retval
,
"Rename file back failed, retval = %d
\n
"
,
retval
);
set_curr_dir_path
(
from
,
"test4.txt
\0
"
);
set_curr_dir_path
(
to
,
"test6.txt
\0
"
);
retval
=
SHFileOperationA
(
&
shfo
);
ok
(
!
retval
,
"Rename dir failed, retval = %
l
d
\n
"
,
retval
);
ok
(
!
retval
,
"Rename dir failed, retval = %d
\n
"
,
retval
);
ok
(
!
file_exists
(
"test4.txt"
),
"The dir is not renamed
\n
"
);
ok
(
file_exists
(
"test6.txt"
),
"The dir is not renamed
\n
"
);
set_curr_dir_path
(
from
,
"test6.txt
\0
"
);
set_curr_dir_path
(
to
,
"test4.txt
\0
"
);
retval
=
SHFileOperationA
(
&
shfo
);
ok
(
!
retval
,
"Rename dir back failed, retval = %
l
d
\n
"
,
retval
);
ok
(
!
retval
,
"Rename dir back failed, retval = %d
\n
"
,
retval
);
/* try to rename more than one file to a single file */
shfo
.
pFrom
=
"test1.txt
\0
test2.txt
\0
"
;
shfo
.
pTo
=
"a.txt
\0
"
;
retval
=
SHFileOperationA
(
&
shfo
);
ok
(
retval
==
ERROR_GEN_FAILURE
,
"Expected ERROR_GEN_FAILURE, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_GEN_FAILURE
,
"Expected ERROR_GEN_FAILURE, got %d
\n
"
,
retval
);
ok
(
file_exists
(
"test1.txt"
),
"Expected test1.txt to exist
\n
"
);
ok
(
file_exists
(
"test2.txt"
),
"Expected test2.txt to exist
\n
"
);
...
...
@@ -324,32 +324,32 @@ static void test_rename(void)
shfo
.
pFrom
=
"idontexist
\0
"
;
shfo
.
pTo
=
"newfile
\0
"
;
retval
=
SHFileOperationA
(
&
shfo
);
ok
(
retval
==
1026
,
"Expected 1026, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
1026
,
"Expected 1026, got %d
\n
"
,
retval
);
ok
(
!
file_exists
(
"newfile"
),
"Expected newfile to not exist
\n
"
);
/* pTo already exist */
shfo
.
pFrom
=
"test1.txt
\0
"
;
shfo
.
pTo
=
"test2.txt
\0
"
;
retval
=
SHFileOperationA
(
&
shfo
);
ok
(
retval
==
ERROR_ALREADY_EXISTS
,
"Expected ERROR_ALREADY_EXISTS, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_ALREADY_EXISTS
,
"Expected ERROR_ALREADY_EXISTS, got %d
\n
"
,
retval
);
/* pFrom is valid, but pTo is empty */
shfo
.
pFrom
=
"test1.txt
\0
"
;
shfo
.
pTo
=
"
\0
"
;
retval
=
SHFileOperationA
(
&
shfo
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %d
\n
"
,
retval
);
ok
(
file_exists
(
"test1.txt"
),
"Expected test1.txt to exist
\n
"
);
/* pFrom is empty */
shfo
.
pFrom
=
"
\0
"
;
retval
=
SHFileOperationA
(
&
shfo
);
ok
(
retval
==
ERROR_ACCESS_DENIED
,
"Expected ERROR_ACCESS_DENIED, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_ACCESS_DENIED
,
"Expected ERROR_ACCESS_DENIED, got %d
\n
"
,
retval
);
/* pFrom is NULL, commented out because it crashes on nt 4.0 */
#if 0
shfo.pFrom = NULL;
retval = SHFileOperationA(&shfo);
ok(retval == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %
l
d\n", retval);
ok(retval == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", retval);
#endif
}
...
...
@@ -466,7 +466,7 @@ static void test_copy(void)
shfo
.
pFrom
=
"test1.txt
\0
test2.txt
\0
test3.txt
\0
"
;
shfo
.
pTo
=
"testdir2
\0
"
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
retval
);
ok
(
file_exists
(
"testdir2
\\
test1.txt"
),
"Expected testdir2
\\
test1 to exist
\n
"
);
/* try to copy files to a file */
...
...
@@ -477,7 +477,7 @@ static void test_copy(void)
set_curr_dir_path
(
from
,
"test1.txt
\0
test2.txt
\0
"
);
set_curr_dir_path
(
to
,
"test3.txt
\0
"
);
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %d
\n
"
,
retval
);
ok
(
shfo
.
fAnyOperationsAborted
,
"Expected aborted operations
\n
"
);
ok
(
!
file_exists
(
"test3.txt
\\
test2.txt"
),
"Expected test3.txt
\\
test2.txt to not exist
\n
"
);
...
...
@@ -485,7 +485,7 @@ static void test_copy(void)
DeleteFile
(
to
);
shfo
.
fAnyOperationsAborted
=
FALSE
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
retval
);
ok
(
DeleteFile
(
"test3.txt
\\
test1.txt"
),
"Expected test3.txt
\\
test1.txt to exist
\n
"
);
ok
(
DeleteFile
(
"test3.txt
\\
test2.txt"
),
"Expected test3.txt
\\
test1.txt to exist
\n
"
);
ok
(
RemoveDirectory
(
to
),
"Expected test3.txt to exist
\n
"
);
...
...
@@ -496,7 +496,7 @@ static void test_copy(void)
shfo
.
pTo
=
"testdir2
\\
a.txt
\0
testdir2
\\
b.txt
\0
testdir2
\\
c.txt
\0
testdir2
\\
d.txt
\0
"
;
shfo
.
fFlags
|=
FOF_NOERRORUI
|
FOF_MULTIDESTFILES
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %d
\n
"
,
retval
);
ok
(
shfo
.
fAnyOperationsAborted
,
"Expected aborted operations
\n
"
);
ok
(
!
file_exists
(
"testdir2
\\
a.txt"
),
"Expected testdir2
\\
a.txt to not exist
\n
"
);
...
...
@@ -505,7 +505,7 @@ static void test_copy(void)
shfo
.
pTo
=
"e.txt
\0
f.txt
\0
"
;
shfo
.
fAnyOperationsAborted
=
FALSE
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %d
\n
"
,
retval
);
ok
(
shfo
.
fAnyOperationsAborted
,
"Expected aborted operations
\n
"
);
ok
(
!
file_exists
(
"e.txt"
),
"Expected e.txt to not exist
\n
"
);
...
...
@@ -514,7 +514,7 @@ static void test_copy(void)
shfo
.
pTo
=
"testdir2
\\
a.txt
\0
testdir2
\\
b.txt
\0
testdir2
\\
c.txt
\0
"
;
shfo
.
fAnyOperationsAborted
=
FALSE
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
retval
);
ok
(
DeleteFile
(
"testdir2
\\
a.txt"
),
"Expected testdir2
\\
a.txt to exist
\n
"
);
ok
(
DeleteFile
(
"testdir2
\\
b.txt"
),
"Expected testdir2
\\
b.txt to exist
\n
"
);
ok
(
RemoveDirectory
(
"testdir2
\\
c.txt"
),
"Expected testdir2
\\
c.txt to exist
\n
"
);
...
...
@@ -525,7 +525,7 @@ static void test_copy(void)
shfo
.
fAnyOperationsAborted
=
FALSE
;
shfo
.
fFlags
&=
~
FOF_MULTIDESTFILES
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %d
\n
"
,
retval
);
ok
(
!
file_exists
(
"a.txt"
),
"Expected a.txt to not exist
\n
"
);
/* try a glob */
...
...
@@ -533,7 +533,7 @@ static void test_copy(void)
shfo
.
pTo
=
"testdir2
\0
"
;
shfo
.
fFlags
&=
~
FOF_MULTIDESTFILES
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
retval
);
ok
(
file_exists
(
"testdir2
\\
test1.txt"
),
"Expected testdir2
\\
test1.txt to exist
\n
"
);
/* try a glob with FOF_FILESONLY */
...
...
@@ -542,7 +542,7 @@ static void test_copy(void)
shfo
.
pFrom
=
"test?.txt
\0
"
;
shfo
.
fFlags
|=
FOF_FILESONLY
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
retval
);
ok
(
file_exists
(
"testdir2
\\
test1.txt"
),
"Expected testdir2
\\
test1.txt to exist
\n
"
);
ok
(
!
file_exists
(
"testdir2
\\
test4.txt"
),
"Expected testdir2
\\
test4.txt to not exist
\n
"
);
...
...
@@ -555,7 +555,7 @@ static void test_copy(void)
shfo
.
fFlags
&=
~
FOF_FILESONLY
;
shfo
.
fFlags
|=
FOF_MULTIDESTFILES
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %d
\n
"
,
retval
);
ok
(
shfo
.
fAnyOperationsAborted
,
"Expected aborted operations
\n
"
);
ok
(
!
file_exists
(
"testdir2
\\
a.txt"
),
"Expected testdir2
\\
test1.txt to not exist
\n
"
);
ok
(
!
RemoveDirectory
(
"b.txt"
),
"b.txt should not exist
\n
"
);
...
...
@@ -567,7 +567,7 @@ static void test_copy(void)
shfo
.
pTo
=
"b.txt
\0
c.txt
\0
"
;
shfo
.
fAnyOperationsAborted
=
FALSE
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
retval
);
ok
(
DeleteFile
(
"b.txt"
),
"Expected b.txt to exist
\n
"
);
ok
(
!
DeleteFile
(
"c.txt"
),
"Expected c.txt to not exist
\n
"
);
...
...
@@ -575,7 +575,7 @@ static void test_copy(void)
shfo
.
pFrom
=
"test1.txt
\0
test2.txt
\0
"
;
shfo
.
pTo
=
"b.txt
\0
c.txt
\0
d.txt
\0
"
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %d
\n
"
,
retval
);
ok
(
shfo
.
fAnyOperationsAborted
,
"Expected operations to be aborted
\n
"
);
ok
(
!
DeleteFile
(
"b.txt"
),
"Expected b.txt to not exist
\n
"
);
...
...
@@ -584,7 +584,7 @@ static void test_copy(void)
shfo
.
pTo
=
"b.txt
\0
c.txt
\0
d.txt
\0
"
;
shfo
.
fAnyOperationsAborted
=
FALSE
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %d
\n
"
,
retval
);
ok
(
shfo
.
fAnyOperationsAborted
,
"Expected operations to be aborted
\n
"
);
ok
(
!
DeleteFile
(
"b.txt"
),
"Expected b.txt to not exist
\n
"
);
ok
(
!
DeleteFile
(
"c.txt"
),
"Expected c.txt to not exist
\n
"
);
...
...
@@ -596,7 +596,7 @@ static void test_copy(void)
shfo
.
fFlags
&=
~
FOF_MULTIDESTFILES
;
shfo
.
fAnyOperationsAborted
=
FALSE
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
retval
);
ok
(
DeleteFile
(
"testdir2
\\
test1.txt"
),
"Expected newdir
\\
test1.txt to exist
\n
"
);
ok
(
DeleteFile
(
"testdir2
\\
test4.txt
\\
a.txt"
),
"Expected a.txt to exist
\n
"
);
ok
(
RemoveDirectory
(
"testdir2
\\
test4.txt"
),
"Expected testdir2
\\
test4.txt to exist
\n
"
);
...
...
@@ -605,7 +605,7 @@ static void test_copy(void)
shfo
.
pFrom
=
"test4.txt
\0
test4.txt
\\
a.txt
\0
"
;
shfo
.
pTo
=
"testdir2
\0
"
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
retval
);
ok
(
DeleteFile
(
"testdir2
\\
test4.txt
\\
a.txt"
),
"Expected a.txt to exist
\n
"
);
ok
(
DeleteFile
(
"testdir2
\\
a.txt"
),
"Expected testdir2
\\
a.txt to exist
\n
"
);
...
...
@@ -613,7 +613,7 @@ static void test_copy(void)
shfo
.
pFrom
=
"test4.txt
\\
a.txt
\0
test4.txt
\0
"
;
shfo
.
pTo
=
"nonexistent
\0
"
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %d
\n
"
,
retval
);
ok
(
shfo
.
fAnyOperationsAborted
,
"Expected operations to be aborted
\n
"
);
ok
(
!
file_exists
(
"nonexistent
\\
test4.txt"
),
"Expected nonexistent
\\
test4.txt to not exist
\n
"
);
DeleteFile
(
"test4.txt
\\
a.txt"
);
...
...
@@ -625,7 +625,7 @@ static void test_copy(void)
shfo
.
fFlags
=
FOF_NOERRORUI
|
FOF_MULTIDESTFILES
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_NO_MORE_SEARCH_HANDLES
,
"Expected ERROR_NO_MORE_SEARCH_HANDLES, got %
l
d
\n
"
,
retval
);
"Expected ERROR_NO_MORE_SEARCH_HANDLES, got %d
\n
"
,
retval
);
ok
(
!
shfo
.
fAnyOperationsAborted
,
"Expected no operations to be aborted
\n
"
);
ok
(
DeleteFile
(
"b.txt"
),
"Expected b.txt to exist
\n
"
);
ok
(
!
file_exists
(
"c.txt"
),
"Expected c.txt to not exist
\n
"
);
...
...
@@ -635,7 +635,7 @@ static void test_copy(void)
shfo
.
pTo
=
"b.txt
\0
test4.txt
\0
c.txt
\0
"
;
shfo
.
fAnyOperationsAborted
=
FALSE
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
retval
);
ok
(
DeleteFile
(
"b.txt"
),
"Expected b.txt to exist
\n
"
);
ok
(
!
file_exists
(
"c.txt"
),
"Expected c.txt to not exist
\n
"
);
...
...
@@ -645,7 +645,7 @@ static void test_copy(void)
shfo
.
fFlags
&=
~
FOF_MULTIDESTFILES
;
shfo
.
fAnyOperationsAborted
=
FALSE
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
retval
);
ok
(
!
RemoveDirectory
(
"test4.txt
\\
newdir"
),
"Expected test4.txt
\\
newdir to not exist
\n
"
);
/* copy a directory to itself, error displayed in UI */
...
...
@@ -653,7 +653,7 @@ static void test_copy(void)
shfo
.
pTo
=
"test4.txt
\0
"
;
shfo
.
fAnyOperationsAborted
=
FALSE
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
retval
);
/* copy a file into a directory, and the directory into itself */
shfo
.
pFrom
=
"test1.txt
\0
test4.txt
\0
"
;
...
...
@@ -661,7 +661,7 @@ static void test_copy(void)
shfo
.
fAnyOperationsAborted
=
FALSE
;
shfo
.
fFlags
|=
FOF_NOCONFIRMATION
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
retval
);
ok
(
DeleteFile
(
"test4.txt
\\
test1.txt"
),
"Expected test4.txt
\\
test1.txt to exist
\n
"
);
/* copy a file to a file, and the directory into itself */
...
...
@@ -669,7 +669,7 @@ static void test_copy(void)
shfo
.
pTo
=
"test4.txt
\\
a.txt
\0
"
;
shfo
.
fAnyOperationsAborted
=
FALSE
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %d
\n
"
,
retval
);
ok
(
!
file_exists
(
"test4.txt
\\
a.txt"
),
"Expected test4.txt
\\
a.txt to not exist
\n
"
);
/* copy a nonexistent file to a nonexistent directory */
...
...
@@ -677,7 +677,7 @@ static void test_copy(void)
shfo
.
pTo
=
"nonexistent
\0
"
;
shfo
.
fAnyOperationsAborted
=
FALSE
;
retval
=
SHFileOperation
(
&
shfo
);
ok
(
retval
==
1026
,
"Expected 1026, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
1026
,
"Expected 1026, got %d
\n
"
,
retval
);
ok
(
!
file_exists
(
"nonexistent
\\
e.txt"
),
"Expected nonexistent
\\
e.txt to not exist
\n
"
);
ok
(
!
file_exists
(
"nonexistent"
),
"Expected nonexistent to not exist
\n
"
);
}
...
...
@@ -773,7 +773,7 @@ static void test_move(void)
shfo
.
pFrom
=
"test1.txt
\0
"
;
shfo
.
pTo
=
"a.txt
\0
b.txt
\0
"
;
retval
=
SHFileOperationA
(
&
shfo
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
retval
);
ok
(
!
file_exists
(
"test1.txt"
),
"Expected test1.txt to not exist
\n
"
);
ok
(
DeleteFile
(
"a.txt"
),
"Expected a.txt to exist
\n
"
);
ok
(
!
file_exists
(
"b.txt"
),
"Expected b.txt to not exist
\n
"
);
...
...
@@ -782,7 +782,7 @@ static void test_move(void)
shfo
.
pFrom
=
"test2.txt
\0
test3.txt
\0
"
;
shfo
.
pTo
=
"test1.txt
\0
"
;
retval
=
SHFileOperationA
(
&
shfo
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %d
\n
"
,
retval
);
ok
(
!
file_exists
(
"test1.txt"
),
"Expected test1.txt to not exist
\n
"
);
ok
(
file_exists
(
"test2.txt"
),
"Expected test2.txt to exist
\n
"
);
ok
(
file_exists
(
"test3.txt"
),
"Expected test3.txt to exist
\n
"
);
...
...
@@ -791,7 +791,7 @@ static void test_move(void)
shfo
.
pFrom
=
"test4.txt
\0
"
;
shfo
.
pTo
=
"test4.txt
\\
b.txt
\0
"
;
retval
=
SHFileOperationA
(
&
shfo
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
retval
);
ok
(
!
RemoveDirectory
(
"test4.txt
\\
b.txt"
),
"Expected test4.txt
\\
b.txt to not exist
\n
"
);
ok
(
file_exists
(
"test4.txt"
),
"Expected test4.txt to exist
\n
"
);
...
...
@@ -799,7 +799,7 @@ static void test_move(void)
shfo
.
pFrom
=
"test2.txt
\0
test3.txt
\0
"
;
shfo
.
pTo
=
"d.txt
\0
e.txt
\0
"
;
retval
=
SHFileOperationA
(
&
shfo
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %d
\n
"
,
retval
);
ok
(
!
DeleteFile
(
"d.txt"
),
"Expected d.txt to not exist
\n
"
);
ok
(
!
DeleteFile
(
"e.txt"
),
"Expected e.txt to not exist
\n
"
);
...
...
@@ -807,20 +807,20 @@ static void test_move(void)
shfo
.
pTo
=
"d.txt
\0
"
;
shfo
.
fFlags
|=
FOF_MULTIDESTFILES
;
retval
=
SHFileOperationA
(
&
shfo
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %d
\n
"
,
retval
);
ok
(
!
DeleteFile
(
"d.txt"
),
"Expected d.txt to not exist
\n
"
);
/* FO_MOVE does not create dest directories */
shfo
.
pFrom
=
"test2.txt
\0
"
;
shfo
.
pTo
=
"dir1
\\
dir2
\\
test2.txt
\0
"
;
retval
=
SHFileOperationA
(
&
shfo
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_CANCELLED
,
"Expected ERROR_CANCELLED, got %d
\n
"
,
retval
);
ok
(
!
file_exists
(
"dir1"
),
"Expected dir1 to not exist
\n
"
);
/* try to overwrite an existing file */
shfo
.
pTo
=
"test3.txt
\0
"
;
retval
=
SHFileOperationA
(
&
shfo
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %
l
d
\n
"
,
retval
);
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
retval
);
ok
(
!
file_exists
(
"test2.txt"
),
"Expected test2.txt to not exist
\n
"
);
ok
(
file_exists
(
"test3.txt"
),
"Expected test3.txt to exist
\n
"
);
}
...
...
dlls/shell32/tests/shlfolder.c
View file @
e5c1a014
...
...
@@ -68,7 +68,7 @@ static void init_function_pointers(void)
}
hr
=
SHGetMalloc
(
&
ppM
);
ok
(
hr
==
S_OK
,
"SHGetMalloc failed %08
l
x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"SHGetMalloc failed %08x
\n
"
,
hr
);
}
static
void
test_ParseDisplayName
(
void
)
...
...
@@ -92,7 +92,7 @@ static void test_ParseDisplayName(void)
hr
=
IShellFolder_ParseDisplayName
(
IDesktopFolder
,
NULL
,
NULL
,
cTestDirW
,
NULL
,
&
newPIDL
,
0
);
ok
((
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
))
||
(
hr
==
E_FAIL
),
"ParseDisplayName returned %08
l
x, expected 80070002 or E_FAIL
\n
"
,
hr
);
"ParseDisplayName returned %08x, expected 80070002 or E_FAIL
\n
"
,
hr
);
res
=
GetFileAttributesA
(
cNonExistDir2A
);
if
(
res
!=
INVALID_FILE_ATTRIBUTES
)
return
;
...
...
@@ -101,7 +101,7 @@ static void test_ParseDisplayName(void)
hr
=
IShellFolder_ParseDisplayName
(
IDesktopFolder
,
NULL
,
NULL
,
cTestDirW
,
NULL
,
&
newPIDL
,
0
);
ok
((
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
))
||
(
hr
==
E_FAIL
)
||
(
hr
==
E_INVALIDARG
),
"ParseDisplayName returned %08
l
x, expected 80070002, E_FAIL or E_INVALIDARG
\n
"
,
hr
);
"ParseDisplayName returned %08x, expected 80070002, E_FAIL or E_INVALIDARG
\n
"
,
hr
);
/* I thought that perhaps the DesktopFolder's ParseDisplayName would recognize the
* path corresponding to CSIDL_PERSONAL and return a CLSID_MyDocuments PIDL. Turns
...
...
@@ -109,11 +109,11 @@ static void test_ParseDisplayName(void)
if
(
!
pSHGetSpecialFolderPathW
||
!
pILFindLastID
)
goto
finished
;
bRes
=
pSHGetSpecialFolderPathW
(
NULL
,
cTestDirW
,
CSIDL_PERSONAL
,
FALSE
);
ok
(
bRes
,
"SHGetSpecialFolderPath(CSIDL_PERSONAL) failed! %
l
d
\n
"
,
GetLastError
());
ok
(
bRes
,
"SHGetSpecialFolderPath(CSIDL_PERSONAL) failed! %d
\n
"
,
GetLastError
());
if
(
!
bRes
)
goto
finished
;
hr
=
IShellFolder_ParseDisplayName
(
IDesktopFolder
,
NULL
,
NULL
,
cTestDirW
,
NULL
,
&
newPIDL
,
0
);
ok
(
SUCCEEDED
(
hr
),
"DesktopFolder->ParseDisplayName failed. hr = %08
l
x.
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"DesktopFolder->ParseDisplayName failed. hr = %08x.
\n
"
,
hr
);
if
(
FAILED
(
hr
))
goto
finished
;
ok
(
pILFindLastID
(
newPIDL
)
->
mkid
.
abID
[
0
]
==
0x31
,
"Last pidl should be of type "
...
...
@@ -195,7 +195,7 @@ static void test_EnumObjects(IShellFolder *iFolder)
};
hr
=
IShellFolder_EnumObjects
(
iFolder
,
NULL
,
SHCONTF_FOLDERS
|
SHCONTF_NONFOLDERS
|
SHCONTF_INCLUDEHIDDEN
,
&
iEnumList
);
ok
(
hr
==
S_OK
,
"EnumObjects failed %08
l
x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"EnumObjects failed %08x
\n
"
,
hr
);
/* This is to show that, contrary to what is said on MSDN, on IEnumIDList::Next,
* the filesystem shellfolders return S_OK even if less than 'celt' items are
...
...
@@ -206,7 +206,7 @@ static void test_EnumObjects(IShellFolder *iFolder)
ok
(
i
==
5
,
"i: %d
\n
"
,
i
);
hr
=
IEnumIDList_Release
(
iEnumList
);
ok
(
hr
==
S_OK
,
"IEnumIDList_Release failed %08
l
x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"IEnumIDList_Release failed %08x
\n
"
,
hr
);
/* Sort them first in case of wrong order from system */
for
(
i
=
0
;
i
<
5
;
i
++
)
for
(
j
=
0
;
j
<
5
;
j
++
)
...
...
@@ -220,7 +220,7 @@ static void test_EnumObjects(IShellFolder *iFolder)
for
(
i
=
0
;
i
<
5
;
i
++
)
for
(
j
=
0
;
j
<
5
;
j
++
)
{
hr
=
IShellFolder_CompareIDs
(
iFolder
,
0
,
idlArr
[
i
],
idlArr
[
j
]);
ok
(
hr
==
iResults
[
i
][
j
],
"Got %
l
x expected [%d]-[%d]=%x
\n
"
,
hr
,
i
,
j
,
iResults
[
i
][
j
]);
ok
(
hr
==
iResults
[
i
][
j
],
"Got %x expected [%d]-[%d]=%x
\n
"
,
hr
,
i
,
j
,
iResults
[
i
][
j
]);
}
...
...
@@ -231,14 +231,14 @@ static void test_EnumObjects(IShellFolder *iFolder)
flags
=
SFGAO_CANCOPY
;
hr
=
IShellFolder_GetAttributesOf
(
iFolder
,
1
,
(
LPCITEMIDLIST
*
)(
idlArr
+
i
),
&
flags
);
flags
&=
SFGAO_testfor
;
ok
(
hr
==
S_OK
,
"GetAttributesOf returns %08
l
x
\n
"
,
hr
);
ok
(
flags
==
(
attrs
[
i
]),
"GetAttributesOf[%i] got %08
lx, expected %08l
x
\n
"
,
i
,
flags
,
attrs
[
i
]);
ok
(
hr
==
S_OK
,
"GetAttributesOf returns %08x
\n
"
,
hr
);
ok
(
flags
==
(
attrs
[
i
]),
"GetAttributesOf[%i] got %08
x, expected %08
x
\n
"
,
i
,
flags
,
attrs
[
i
]);
flags
=
SFGAO_testfor
;
hr
=
IShellFolder_GetAttributesOf
(
iFolder
,
1
,
(
LPCITEMIDLIST
*
)(
idlArr
+
i
),
&
flags
);
flags
&=
SFGAO_testfor
;
ok
(
hr
==
S_OK
,
"GetAttributesOf returns %08
l
x
\n
"
,
hr
);
ok
(
flags
==
attrs
[
i
],
"GetAttributesOf[%i] got %08
lx, expected %08l
x
\n
"
,
i
,
flags
,
attrs
[
i
]);
ok
(
hr
==
S_OK
,
"GetAttributesOf returns %08x
\n
"
,
hr
);
ok
(
flags
==
attrs
[
i
],
"GetAttributesOf[%i] got %08
x, expected %08
x
\n
"
,
i
,
flags
,
attrs
[
i
]);
}
for
(
i
=
0
;
i
<
5
;
i
++
)
...
...
@@ -262,39 +262,39 @@ static void test_BindToObject(void)
* with an empty pidl. This is tested for Desktop, MyComputer and the FS ShellFolder
*/
hr
=
SHGetDesktopFolder
(
&
psfDesktop
);
ok
(
SUCCEEDED
(
hr
),
"SHGetDesktopFolder failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"SHGetDesktopFolder failed! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
hr
=
IShellFolder_BindToObject
(
psfDesktop
,
pidlEmpty
,
NULL
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
psfChild
);
ok
(
hr
==
E_INVALIDARG
,
"Desktop's BindToObject should fail, when called with empty pidl! hr = %08
l
x
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"Desktop's BindToObject should fail, when called with empty pidl! hr = %08x
\n
"
,
hr
);
hr
=
IShellFolder_BindToObject
(
psfDesktop
,
NULL
,
NULL
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
psfChild
);
ok
(
hr
==
E_INVALIDARG
,
"Desktop's BindToObject should fail, when called with NULL pidl! hr = %08
l
x
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"Desktop's BindToObject should fail, when called with NULL pidl! hr = %08x
\n
"
,
hr
);
hr
=
IShellFolder_ParseDisplayName
(
psfDesktop
,
NULL
,
NULL
,
wszMyComputer
,
NULL
,
&
pidlMyComputer
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IShellFolder_Release
(
psfDesktop
);
return
;
}
hr
=
IShellFolder_BindToObject
(
psfDesktop
,
pidlMyComputer
,
NULL
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
psfMyComputer
);
ok
(
SUCCEEDED
(
hr
),
"Desktop failed to bind to MyComputer object! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Desktop failed to bind to MyComputer object! hr = %08x
\n
"
,
hr
);
IShellFolder_Release
(
psfDesktop
);
IMalloc_Free
(
ppM
,
pidlMyComputer
);
if
(
FAILED
(
hr
))
return
;
hr
=
IShellFolder_BindToObject
(
psfMyComputer
,
pidlEmpty
,
NULL
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
psfChild
);
ok
(
hr
==
E_INVALIDARG
,
"MyComputers's BindToObject should fail, when called with empty pidl! hr = %08
l
x
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"MyComputers's BindToObject should fail, when called with empty pidl! hr = %08x
\n
"
,
hr
);
#if 0
/* this call segfaults on 98SE */
hr = IShellFolder_BindToObject(psfMyComputer, NULL, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
ok (hr == E_INVALIDARG, "MyComputers's BindToObject should fail, when called with NULL pidl! hr = %08
l
x\n", hr);
ok (hr == E_INVALIDARG, "MyComputers's BindToObject should fail, when called with NULL pidl! hr = %08x\n", hr);
#endif
cChars
=
GetSystemDirectoryA
(
szSystemDir
,
MAX_PATH
);
ok
(
cChars
>
0
&&
cChars
<
MAX_PATH
,
"GetSystemDirectoryA failed! LastError: %08
l
x
\n
"
,
GetLastError
());
ok
(
cChars
>
0
&&
cChars
<
MAX_PATH
,
"GetSystemDirectoryA failed! LastError: %08x
\n
"
,
GetLastError
());
if
(
cChars
==
0
||
cChars
>=
MAX_PATH
)
{
IShellFolder_Release
(
psfMyComputer
);
return
;
...
...
@@ -302,27 +302,27 @@ static void test_BindToObject(void)
MultiByteToWideChar
(
CP_ACP
,
0
,
szSystemDir
,
-
1
,
wszSystemDir
,
MAX_PATH
);
hr
=
IShellFolder_ParseDisplayName
(
psfMyComputer
,
NULL
,
NULL
,
wszSystemDir
,
NULL
,
&
pidlSystemDir
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"MyComputers's ParseDisplayName failed to parse the SystemDirectory! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"MyComputers's ParseDisplayName failed to parse the SystemDirectory! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IShellFolder_Release
(
psfMyComputer
);
return
;
}
hr
=
IShellFolder_BindToObject
(
psfMyComputer
,
pidlSystemDir
,
NULL
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
psfSystemDir
);
ok
(
SUCCEEDED
(
hr
),
"MyComputer failed to bind to a FileSystem ShellFolder! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"MyComputer failed to bind to a FileSystem ShellFolder! hr = %08x
\n
"
,
hr
);
IShellFolder_Release
(
psfMyComputer
);
IMalloc_Free
(
ppM
,
pidlSystemDir
);
if
(
FAILED
(
hr
))
return
;
hr
=
IShellFolder_BindToObject
(
psfSystemDir
,
pidlEmpty
,
NULL
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
psfChild
);
ok
(
hr
==
E_INVALIDARG
,
"FileSystem ShellFolder's BindToObject should fail, when called with empty pidl! hr = %08
l
x
\n
"
,
hr
);
"FileSystem ShellFolder's BindToObject should fail, when called with empty pidl! hr = %08x
\n
"
,
hr
);
#if 0
/* this call segfaults on 98SE */
hr = IShellFolder_BindToObject(psfSystemDir, NULL, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
ok (hr == E_INVALIDARG,
"FileSystem ShellFolder's BindToObject should fail, when called with NULL pidl! hr = %08
l
x\n", hr);
"FileSystem ShellFolder's BindToObject should fail, when called with NULL pidl! hr = %08x\n", hr);
#endif
IShellFolder_Release
(
psfSystemDir
);
...
...
@@ -356,14 +356,14 @@ static void test_GetDisplayName(void)
/* First creating a directory in MyDocuments and a file in this directory. */
result
=
pSHGetSpecialFolderPathW
(
NULL
,
wszTestDir
,
CSIDL_PERSONAL
,
FALSE
);
ok
(
result
,
"SHGetSpecialFolderPathW failed! Last error: %08
l
x
\n
"
,
GetLastError
());
ok
(
result
,
"SHGetSpecialFolderPathW failed! Last error: %08x
\n
"
,
GetLastError
());
if
(
!
result
)
return
;
PathAddBackslashW
(
wszTestDir
);
lstrcatW
(
wszTestDir
,
wszDirName
);
WideCharToMultiByte
(
CP_ACP
,
0
,
wszTestDir
,
-
1
,
szTestDir
,
MAX_PATH
,
0
,
0
);
result
=
CreateDirectoryA
(
szTestDir
,
NULL
);
ok
(
result
,
"CreateDirectoryA failed! Last error: %08
l
x
\n
"
,
GetLastError
());
ok
(
result
,
"CreateDirectoryA failed! Last error: %08x
\n
"
,
GetLastError
());
if
(
!
result
)
return
;
lstrcpyW
(
wszTestFile
,
wszTestDir
);
...
...
@@ -372,17 +372,17 @@ static void test_GetDisplayName(void)
WideCharToMultiByte
(
CP_ACP
,
0
,
wszTestFile
,
-
1
,
szTestFile
,
MAX_PATH
,
0
,
0
);
hTestFile
=
CreateFileA
(
szTestFile
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
NULL
);
ok
((
hTestFile
!=
INVALID_HANDLE_VALUE
),
"CreateFileA failed! Last error: %08
l
x
\n
"
,
GetLastError
());
ok
((
hTestFile
!=
INVALID_HANDLE_VALUE
),
"CreateFileA failed! Last error: %08x
\n
"
,
GetLastError
());
if
(
hTestFile
==
INVALID_HANDLE_VALUE
)
return
;
CloseHandle
(
hTestFile
);
/* Getting an itemidlist for the file. */
hr
=
SHGetDesktopFolder
(
&
psfDesktop
);
ok
(
SUCCEEDED
(
hr
),
"SHGetDesktopFolder failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"SHGetDesktopFolder failed! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
hr
=
IShellFolder_ParseDisplayName
(
psfDesktop
,
NULL
,
NULL
,
wszTestFile
,
NULL
,
&
pidlTestFile
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Desktop->ParseDisplayName failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Desktop->ParseDisplayName failed! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IShellFolder_Release
(
psfDesktop
);
return
;
...
...
@@ -399,14 +399,14 @@ static void test_GetDisplayName(void)
/* It seems as if we cannot bind to regular files on windows, but only directories.
*/
hr
=
IShellFolder_BindToObject
(
psfDesktop
,
pidlTestFile
,
NULL
,
&
IID_IUnknown
,
(
VOID
**
)
&
psfFile
);
todo_wine
{
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
),
"hr = %08
l
x
\n
"
,
hr
);
}
todo_wine
{
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
),
"hr = %08x
\n
"
,
hr
);
}
if
(
SUCCEEDED
(
hr
))
{
IShellFolder_Release
(
psfFile
);
}
/* Some tests for IShellFolder::SetNameOf */
hr
=
pSHBindToParent
(
pidlTestFile
,
&
IID_IShellFolder
,
(
VOID
**
)
&
psfPersonal
,
&
pidlLast
);
ok
(
SUCCEEDED
(
hr
),
"SHBindToParent failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"SHBindToParent failed! hr = %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
/* It's ok to use this fixed path. Call will fail anyway. */
WCHAR
wszAbsoluteFilename
[]
=
{
'C'
,
':'
,
'\\'
,
'w'
,
'i'
,
'n'
,
'e'
,
't'
,
'e'
,
's'
,
't'
,
0
};
...
...
@@ -414,7 +414,7 @@ static void test_GetDisplayName(void)
/* The pidl returned through the last parameter of SetNameOf is a simple one. */
hr
=
IShellFolder_SetNameOf
(
psfPersonal
,
NULL
,
pidlLast
,
wszDirName
,
SHGDN_NORMAL
,
&
pidlNew
);
ok
(
SUCCEEDED
(
hr
),
"SetNameOf failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"SetNameOf failed! hr = %08x
\n
"
,
hr
);
ok
(((
LPITEMIDLIST
)((
LPBYTE
)
pidlNew
+
pidlNew
->
mkid
.
cb
))
->
mkid
.
cb
==
0
,
"pidl returned from SetNameOf should be simple!
\n
"
);
...
...
@@ -422,12 +422,12 @@ static void test_GetDisplayName(void)
* 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 = %08
l
x
\n
"
,
hr
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_CANCELLED
),
"SetNameOf succeeded! hr = %08x
\n
"
,
hr
);
/* Rename the file back to it's 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
(
SUCCEEDED
(
hr
),
"SetNameOf failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"SetNameOf failed! hr = %08x
\n
"
,
hr
);
ILFree
(
pidlNew
);
IShellFolder_Release
(
psfPersonal
);
...
...
@@ -439,7 +439,7 @@ static void test_GetDisplayName(void)
/* SHGetPathFromIDListW still works, although the file is not present anymore. */
result
=
SHGetPathFromIDListW
(
pidlTestFile
,
wszTestFile2
);
ok
(
result
,
"SHGetPathFromIDListW failed! Last error: %08
l
x
\n
"
,
GetLastError
());
ok
(
result
,
"SHGetPathFromIDListW failed! Last error: %08x
\n
"
,
GetLastError
());
ok
(
!
lstrcmpiW
(
wszTestFile
,
wszTestFile2
),
"SHGetPathFromIDListW returns incorrect path!
\n
"
);
if
(
!
pSHBindToParent
)
return
;
...
...
@@ -450,14 +450,14 @@ static void test_GetDisplayName(void)
/* But it succeeds with an empty PIDL. */
hr
=
pSHBindToParent
(
pidlEmpty
,
&
IID_IShellFolder
,
(
VOID
**
)
&
psfPersonal
,
&
pidlLast
);
ok
(
SUCCEEDED
(
hr
),
"SHBindToParent(empty PIDL) should succeed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"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
(
SUCCEEDED
(
hr
))
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
);
ok
(
SUCCEEDED
(
hr
),
"SHBindToParent failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"SHBindToParent failed! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IShellFolder_Release
(
psfDesktop
);
return
;
...
...
@@ -469,7 +469,7 @@ static void test_GetDisplayName(void)
"SHBindToParent doesn't return the last id of the pidl param!
\n
"
);
hr
=
IShellFolder_GetDisplayNameOf
(
psfPersonal
,
pidlLast
,
SHGDN_FORPARSING
,
&
strret
);
ok
(
SUCCEEDED
(
hr
),
"Personal->GetDisplayNameOf failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Personal->GetDisplayNameOf failed! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IShellFolder_Release
(
psfDesktop
);
IShellFolder_Release
(
psfPersonal
);
...
...
@@ -479,7 +479,7 @@ static void test_GetDisplayName(void)
if
(
pStrRetToBufW
)
{
hr
=
pStrRetToBufW
(
&
strret
,
pidlLast
,
wszTestFile2
,
MAX_PATH
);
ok
(
SUCCEEDED
(
hr
),
"StrRetToBufW failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"StrRetToBufW failed! hr = %08x
\n
"
,
hr
);
ok
(
!
lstrcmpiW
(
wszTestFile
,
wszTestFile2
),
"GetDisplayNameOf returns incorrect path!
\n
"
);
}
...
...
@@ -517,13 +517,13 @@ static void test_CallForAttributes(void)
* on MSDN. This test is meant to document the observed behaviour on WinXP SP2.
*/
hr
=
SHGetDesktopFolder
(
&
psfDesktop
);
ok
(
SUCCEEDED
(
hr
),
"SHGetDesktopFolder failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"SHGetDesktopFolder failed! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
hr
=
IShellFolder_ParseDisplayName
(
psfDesktop
,
NULL
,
NULL
,
wszMyDocuments
,
NULL
,
&
pidlMyDocuments
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Desktop's ParseDisplayName failed to parse MyDocuments's CLSID! hr = %08
l
x
\n
"
,
hr
);
"Desktop's ParseDisplayName failed to parse MyDocuments's CLSID! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IShellFolder_Release
(
psfDesktop
);
return
;
...
...
@@ -532,7 +532,7 @@ static void test_CallForAttributes(void)
dwAttributes
=
0xffffffff
;
hr
=
IShellFolder_GetAttributesOf
(
psfDesktop
,
1
,
(
LPCITEMIDLIST
*
)
&
pidlMyDocuments
,
&
dwAttributes
);
ok
(
SUCCEEDED
(
hr
),
"Desktop->GetAttributesOf(MyDocuments) failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Desktop->GetAttributesOf(MyDocuments) failed! hr = %08x
\n
"
,
hr
);
/* We need the following setup (as observed on WinXP SP2), for the tests to make sense. */
ok
(
dwAttributes
&
SFGAO_FILESYSTEM
,
"SFGAO_FILESYSTEM attribute is not set for MyDocuments!
\n
"
);
...
...
@@ -543,7 +543,7 @@ static void test_CallForAttributes(void)
* key. So the test will return at this point, if run on wine.
*/
lResult
=
RegOpenKeyExW
(
HKEY_CLASSES_ROOT
,
wszMyDocumentsKey
,
0
,
KEY_WRITE
|
KEY_READ
,
&
hKey
);
ok
(
lResult
==
ERROR_SUCCESS
,
"RegOpenKeyEx failed! result: %08
l
x
\n
"
,
lResult
);
ok
(
lResult
==
ERROR_SUCCESS
,
"RegOpenKeyEx failed! result: %08x
\n
"
,
lResult
);
if
(
lResult
!=
ERROR_SUCCESS
)
{
IMalloc_Free
(
ppM
,
pidlMyDocuments
);
IShellFolder_Release
(
psfDesktop
);
...
...
@@ -553,7 +553,7 @@ static void test_CallForAttributes(void)
/* Query MyDocuments' Attributes value, to be able to restore it later. */
dwSize
=
sizeof
(
DWORD
);
lResult
=
RegQueryValueExW
(
hKey
,
wszAttributes
,
NULL
,
NULL
,
(
LPBYTE
)
&
dwOrigAttributes
,
&
dwSize
);
ok
(
lResult
==
ERROR_SUCCESS
,
"RegQueryValueEx failed! result: %08
l
x
\n
"
,
lResult
);
ok
(
lResult
==
ERROR_SUCCESS
,
"RegQueryValueEx failed! result: %08x
\n
"
,
lResult
);
if
(
lResult
!=
ERROR_SUCCESS
)
{
RegCloseKey
(
hKey
);
IMalloc_Free
(
ppM
,
pidlMyDocuments
);
...
...
@@ -565,7 +565,7 @@ static void test_CallForAttributes(void)
dwSize
=
sizeof
(
DWORD
);
lResult
=
RegQueryValueExW
(
hKey
,
wszCallForAttributes
,
NULL
,
NULL
,
(
LPBYTE
)
&
dwOrigCallForAttributes
,
&
dwSize
);
ok
(
lResult
==
ERROR_SUCCESS
,
"RegQueryValueEx failed! result: %08
l
x
\n
"
,
lResult
);
ok
(
lResult
==
ERROR_SUCCESS
,
"RegQueryValueEx failed! result: %08x
\n
"
,
lResult
);
if
(
lResult
!=
ERROR_SUCCESS
)
{
RegCloseKey
(
hKey
);
IMalloc_Free
(
ppM
,
pidlMyDocuments
);
...
...
@@ -590,10 +590,10 @@ static void test_CallForAttributes(void)
dwAttributes
=
SFGAO_ISSLOW
|
SFGAO_GHOSTED
|
SFGAO_FILESYSTEM
;
hr
=
IShellFolder_GetAttributesOf
(
psfDesktop
,
1
,
(
LPCITEMIDLIST
*
)
&
pidlMyDocuments
,
&
dwAttributes
);
ok
(
SUCCEEDED
(
hr
),
"Desktop->GetAttributesOf(MyDocuments) failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Desktop->GetAttributesOf(MyDocuments) failed! hr = %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
ok
(
dwAttributes
==
SFGAO_FILESYSTEM
,
"Desktop->GetAttributes(MyDocuments) returned unexpected attributes: %08
l
x
\n
"
,
"Desktop->GetAttributes(MyDocuments) returned unexpected attributes: %08x
\n
"
,
dwAttributes
);
/* Restore MyDocuments' original Attributes and CallForAttributes registry values */
...
...
@@ -631,26 +631,26 @@ static void test_GetAttributesOf(void)
int
len
;
hr
=
SHGetDesktopFolder
(
&
psfDesktop
);
ok
(
SUCCEEDED
(
hr
),
"SHGetDesktopFolder failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"SHGetDesktopFolder failed! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
/* The Desktop attributes can be queried with a single empty itemidlist, .. */
dwFlags
=
0xffffffff
;
hr
=
IShellFolder_GetAttributesOf
(
psfDesktop
,
1
,
&
pidlEmpty
,
&
dwFlags
);
ok
(
SUCCEEDED
(
hr
),
"Desktop->GetAttributesOf(empty pidl) failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
dwFlags
==
dwDesktopFlags
,
"Wrong Desktop attributes: %08
lx, expected: %08l
x
\n
"
,
ok
(
SUCCEEDED
(
hr
),
"Desktop->GetAttributesOf(empty pidl) failed! hr = %08x
\n
"
,
hr
);
ok
(
dwFlags
==
dwDesktopFlags
,
"Wrong Desktop attributes: %08
x, expected: %08
x
\n
"
,
dwFlags
,
dwDesktopFlags
);
/* .. or with no itemidlist at all. */
dwFlags
=
0xffffffff
;
hr
=
IShellFolder_GetAttributesOf
(
psfDesktop
,
0
,
NULL
,
&
dwFlags
);
ok
(
SUCCEEDED
(
hr
),
"Desktop->GetAttributesOf(NULL) failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
dwFlags
==
dwDesktopFlags
,
"Wrong Desktop attributes: %08
lx, expected: %08l
x
\n
"
,
ok
(
SUCCEEDED
(
hr
),
"Desktop->GetAttributesOf(NULL) failed! hr = %08x
\n
"
,
hr
);
ok
(
dwFlags
==
dwDesktopFlags
,
"Wrong Desktop attributes: %08
x, expected: %08
x
\n
"
,
dwFlags
,
dwDesktopFlags
);
/* Testing the attributes of the MyComputer shellfolder */
hr
=
IShellFolder_ParseDisplayName
(
psfDesktop
,
NULL
,
NULL
,
wszMyComputer
,
NULL
,
&
pidlMyComputer
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IShellFolder_Release
(
psfDesktop
);
return
;
...
...
@@ -665,24 +665,24 @@ static void test_GetAttributesOf(void)
*/
dwFlags
=
0xffffffff
;
hr
=
IShellFolder_GetAttributesOf
(
psfDesktop
,
1
,
(
LPCITEMIDLIST
*
)
&
pidlMyComputer
,
&
dwFlags
);
ok
(
SUCCEEDED
(
hr
),
"Desktop->GetAttributesOf(MyComputer) failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Desktop->GetAttributesOf(MyComputer) failed! hr = %08x
\n
"
,
hr
);
ok
((
dwFlags
&
~
(
DWORD
)
SFGAO_CANLINK
)
==
dwMyComputerFlags
,
"Wrong MyComputer attributes: %08
lx, expected: %08l
x
\n
"
,
dwFlags
,
dwMyComputerFlags
);
"Wrong MyComputer attributes: %08
x, expected: %08
x
\n
"
,
dwFlags
,
dwMyComputerFlags
);
hr
=
IShellFolder_BindToObject
(
psfDesktop
,
pidlMyComputer
,
NULL
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
psfMyComputer
);
ok
(
SUCCEEDED
(
hr
),
"Desktop failed to bind to MyComputer object! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Desktop failed to bind to MyComputer object! hr = %08x
\n
"
,
hr
);
IShellFolder_Release
(
psfDesktop
);
IMalloc_Free
(
ppM
,
pidlMyComputer
);
if
(
FAILED
(
hr
))
return
;
hr
=
IShellFolder_GetAttributesOf
(
psfMyComputer
,
1
,
&
pidlEmpty
,
&
dwFlags
);
todo_wine
{
ok
(
hr
==
E_INVALIDARG
,
"MyComputer->GetAttributesOf(emtpy pidl) should fail! hr = %08
l
x
\n
"
,
hr
);
}
todo_wine
{
ok
(
hr
==
E_INVALIDARG
,
"MyComputer->GetAttributesOf(emtpy pidl) should fail! hr = %08x
\n
"
,
hr
);
}
dwFlags
=
0xffffffff
;
hr
=
IShellFolder_GetAttributesOf
(
psfMyComputer
,
0
,
NULL
,
&
dwFlags
);
ok
(
SUCCEEDED
(
hr
),
"MyComputer->GetAttributesOf(NULL) failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"MyComputer->GetAttributesOf(NULL) failed! hr = %08x
\n
"
,
hr
);
todo_wine
{
ok
(
dwFlags
==
dwMyComputerFlags
,
"Wrong MyComputer attributes: %08
lx, expected: %08l
x
\n
"
,
dwFlags
,
dwMyComputerFlags
);
}
"Wrong MyComputer attributes: %08
x, expected: %08
x
\n
"
,
dwFlags
,
dwMyComputerFlags
);
}
IShellFolder_Release
(
psfMyComputer
);
...
...
@@ -702,25 +702,25 @@ static void test_GetAttributesOf(void)
MultiByteToWideChar
(
CP_ACP
,
0
,
cCurrDirA
,
-
1
,
cCurrDirW
,
MAX_PATH
);
hr
=
SHGetDesktopFolder
(
&
IDesktopFolder
);
ok
(
hr
==
S_OK
,
"SHGetDesktopfolder failed %08
l
x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"SHGetDesktopfolder failed %08x
\n
"
,
hr
);
hr
=
IShellFolder_ParseDisplayName
(
IDesktopFolder
,
NULL
,
NULL
,
cCurrDirW
,
NULL
,
&
newPIDL
,
0
);
ok
(
hr
==
S_OK
,
"ParseDisplayName failed %08
l
x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"ParseDisplayName failed %08x
\n
"
,
hr
);
hr
=
IShellFolder_BindToObject
(
IDesktopFolder
,
newPIDL
,
NULL
,
(
REFIID
)
&
IID_IShellFolder
,
(
LPVOID
*
)
&
testIShellFolder
);
ok
(
hr
==
S_OK
,
"BindToObject failed %08
l
x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"BindToObject failed %08x
\n
"
,
hr
);
IMalloc_Free
(
ppM
,
newPIDL
);
/* get relative PIDL */
hr
=
IShellFolder_ParseDisplayName
(
testIShellFolder
,
NULL
,
NULL
,
(
LPWSTR
)
cTestDirW
,
NULL
,
&
newPIDL
,
0
);
ok
(
hr
==
S_OK
,
"ParseDisplayName failed %08
l
x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"ParseDisplayName failed %08x
\n
"
,
hr
);
/* test the shell attributes of the test directory using the relative PIDL */
dwFlags
=
SFGAO_FOLDER
;
hr
=
IShellFolder_GetAttributesOf
(
testIShellFolder
,
1
,
(
LPCITEMIDLIST
*
)
&
newPIDL
,
&
dwFlags
);
ok
(
SUCCEEDED
(
hr
),
"Desktop->GetAttributesOf() failed! hr = %08
l
x
\n
"
,
hr
);
ok
((
dwFlags
&
SFGAO_FOLDER
),
"Wrong directory attribute for relative PIDL: %08
l
x
\n
"
,
dwFlags
);
ok
(
SUCCEEDED
(
hr
),
"Desktop->GetAttributesOf() failed! hr = %08x
\n
"
,
hr
);
ok
((
dwFlags
&
SFGAO_FOLDER
),
"Wrong directory attribute for relative PIDL: %08x
\n
"
,
dwFlags
);
/* free memory */
IMalloc_Free
(
ppM
,
newPIDL
);
...
...
@@ -730,13 +730,13 @@ static void test_GetAttributesOf(void)
lstrcatW
(
cCurrDirW
,
cTestDirW
);
hr
=
IShellFolder_ParseDisplayName
(
IDesktopFolder
,
NULL
,
NULL
,
cCurrDirW
,
NULL
,
&
newPIDL
,
0
);
ok
(
hr
==
S_OK
,
"ParseDisplayName failed %08
l
x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"ParseDisplayName failed %08x
\n
"
,
hr
);
/* test the shell attributes of the test directory using the absolute PIDL */
dwFlags
=
SFGAO_FOLDER
;
hr
=
IShellFolder_GetAttributesOf
(
IDesktopFolder
,
1
,
(
LPCITEMIDLIST
*
)
&
newPIDL
,
&
dwFlags
);
ok
(
SUCCEEDED
(
hr
),
"Desktop->GetAttributesOf() failed! hr = %08
l
x
\n
"
,
hr
);
ok
((
dwFlags
&
SFGAO_FOLDER
),
"Wrong directory attribute for absolute PIDL: %08
l
x
\n
"
,
dwFlags
);
ok
(
SUCCEEDED
(
hr
),
"Desktop->GetAttributesOf() failed! hr = %08x
\n
"
,
hr
);
ok
((
dwFlags
&
SFGAO_FOLDER
),
"Wrong directory attribute for absolute PIDL: %08x
\n
"
,
dwFlags
);
/* free memory */
IMalloc_Free
(
ppM
,
newPIDL
);
...
...
@@ -781,21 +781,21 @@ static void test_SHGetPathFromIDList(void)
/* Calling SHGetPathFromIDList with an empty pidl should return the desktop folder's path. */
result
=
pSHGetSpecialFolderPathW
(
NULL
,
wszDesktop
,
CSIDL_DESKTOP
,
FALSE
);
ok
(
result
,
"SHGetSpecialFolderPathW(CSIDL_DESKTOP) failed! Last error: %08
l
x
\n
"
,
GetLastError
());
ok
(
result
,
"SHGetSpecialFolderPathW(CSIDL_DESKTOP) failed! Last error: %08x
\n
"
,
GetLastError
());
if
(
!
result
)
return
;
result
=
SHGetPathFromIDListW
(
pidlEmpty
,
wszPath
);
ok
(
result
,
"SHGetPathFromIDListW failed! Last error: %08
l
x
\n
"
,
GetLastError
());
ok
(
result
,
"SHGetPathFromIDListW failed! Last error: %08x
\n
"
,
GetLastError
());
if
(
!
result
)
return
;
ok
(
!
lstrcmpiW
(
wszDesktop
,
wszPath
),
"SHGetPathFromIDList didn't return desktop path for empty pidl!
\n
"
);
/* MyComputer does not map to a filesystem path. SHGetPathFromIDList should fail. */
hr
=
SHGetDesktopFolder
(
&
psfDesktop
);
ok
(
SUCCEEDED
(
hr
),
"SHGetDesktopFolder failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"SHGetDesktopFolder failed! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
hr
=
IShellFolder_ParseDisplayName
(
psfDesktop
,
NULL
,
NULL
,
wszMyComputer
,
NULL
,
&
pidlMyComputer
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IShellFolder_Release
(
psfDesktop
);
return
;
...
...
@@ -806,7 +806,7 @@ static void test_SHGetPathFromIDList(void)
wszPath
[
1
]
=
'\0'
;
result
=
SHGetPathFromIDListW
(
pidlMyComputer
,
wszPath
);
ok
(
!
result
,
"SHGetPathFromIDList succeeded where it shouldn't!
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"SHGetPathFromIDList shouldn't set last error! Last error: %08
l
x
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
0xdeadbeef
,
"SHGetPathFromIDList shouldn't set last error! Last error: %08x
\n
"
,
GetLastError
());
ok
(
!
wszPath
[
0
],
"Expected empty path
\n
"
);
if
(
result
)
{
IShellFolder_Release
(
psfDesktop
);
...
...
@@ -816,7 +816,7 @@ static void test_SHGetPathFromIDList(void)
IMalloc_Free
(
ppM
,
pidlMyComputer
);
result
=
pSHGetSpecialFolderPathW
(
NULL
,
wszFileName
,
CSIDL_DESKTOPDIRECTORY
,
FALSE
);
ok
(
result
,
"SHGetSpecialFolderPathW failed! Last error: %08
l
x
\n
"
,
GetLastError
());
ok
(
result
,
"SHGetSpecialFolderPathW failed! Last error: %08x
\n
"
,
GetLastError
());
if
(
!
result
)
{
IShellFolder_Release
(
psfDesktop
);
return
;
...
...
@@ -824,7 +824,7 @@ static void test_SHGetPathFromIDList(void)
PathAddBackslashW
(
wszFileName
);
lstrcatW
(
wszFileName
,
wszTestFile
);
hTestFile
=
CreateFileW
(
wszFileName
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_NEW
,
0
,
NULL
);
ok
(
hTestFile
!=
INVALID_HANDLE_VALUE
,
"CreateFileW failed! Last error: %08
l
x
\n
"
,
GetLastError
());
ok
(
hTestFile
!=
INVALID_HANDLE_VALUE
,
"CreateFileW failed! Last error: %08x
\n
"
,
GetLastError
());
if
(
hTestFile
==
INVALID_HANDLE_VALUE
)
{
IShellFolder_Release
(
psfDesktop
);
return
;
...
...
@@ -832,7 +832,7 @@ static void test_SHGetPathFromIDList(void)
CloseHandle
(
hTestFile
);
hr
=
IShellFolder_ParseDisplayName
(
psfDesktop
,
NULL
,
NULL
,
wszTestFile
,
NULL
,
&
pidlTestFile
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Desktop's ParseDisplayName failed to parse filename hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Desktop's ParseDisplayName failed to parse filename hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IShellFolder_Release
(
psfDesktop
);
DeleteFileW
(
wszFileName
);
...
...
@@ -843,7 +843,7 @@ static void test_SHGetPathFromIDList(void)
/* This test is to show that the Desktop shellfolder prepends the CSIDL_DESKTOPDIRECTORY
* path for files placed on the desktop, if called with SHGDN_FORPARSING. */
hr
=
IShellFolder_GetDisplayNameOf
(
psfDesktop
,
pidlTestFile
,
SHGDN_FORPARSING
,
&
strret
);
ok
(
SUCCEEDED
(
hr
),
"Desktop's GetDisplayNamfOf failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Desktop's GetDisplayNamfOf failed! hr = %08x
\n
"
,
hr
);
IShellFolder_Release
(
psfDesktop
);
DeleteFileW
(
wszFileName
);
if
(
FAILED
(
hr
))
{
...
...
@@ -859,7 +859,7 @@ static void test_SHGetPathFromIDList(void)
}
result
=
SHGetPathFromIDListW
(
pidlTestFile
,
wszPath
);
ok
(
result
,
"SHGetPathFromIDListW failed! Last error: %08
l
x
\n
"
,
GetLastError
());
ok
(
result
,
"SHGetPathFromIDListW failed! Last error: %08x
\n
"
,
GetLastError
());
IMalloc_Free
(
ppM
,
pidlTestFile
);
if
(
!
result
)
return
;
ok
(
0
==
lstrcmpW
(
wszFileName
,
wszPath
),
"SHGetPathFromIDListW returned incorrect path for file placed on desktop
\n
"
);
...
...
@@ -870,7 +870,7 @@ static void test_SHGetPathFromIDList(void)
pSHGetSpecialFolderLocation
=
(
void
*
)
GetProcAddress
(
hShell32
,
"SHGetSpecialFolderLocation"
);
hr
=
pSHGetSpecialFolderLocation
(
NULL
,
CSIDL_PROGRAM_FILES
,
&
pidlPrograms
);
ok
(
SUCCEEDED
(
hr
),
"SHGetFolderLocation failed: 0x%08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"SHGetFolderLocation failed: 0x%08x
\n
"
,
hr
);
SetLastError
(
0xdeadbeef
);
result
=
SHGetPathFromIDListW
(
pidlPrograms
,
wszPath
);
...
...
@@ -902,15 +902,15 @@ static void test_EnumObjects_and_CompareIDs(void)
lstrcatW
(
cCurrDirW
,
cTestDirW
);
hr
=
SHGetDesktopFolder
(
&
IDesktopFolder
);
ok
(
hr
==
S_OK
,
"SHGetDesktopfolder failed %08
l
x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"SHGetDesktopfolder failed %08x
\n
"
,
hr
);
CreateFilesFolders
();
hr
=
IShellFolder_ParseDisplayName
(
IDesktopFolder
,
NULL
,
NULL
,
cCurrDirW
,
NULL
,
&
newPIDL
,
0
);
ok
(
hr
==
S_OK
,
"ParseDisplayName failed %08
l
x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"ParseDisplayName failed %08x
\n
"
,
hr
);
hr
=
IShellFolder_BindToObject
(
IDesktopFolder
,
newPIDL
,
NULL
,
(
REFIID
)
&
IID_IShellFolder
,
(
LPVOID
*
)
&
testIShellFolder
);
ok
(
hr
==
S_OK
,
"BindToObject failed %08
l
x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"BindToObject failed %08x
\n
"
,
hr
);
test_EnumObjects
(
testIShellFolder
);
...
...
@@ -982,7 +982,7 @@ static HRESULT WINAPI InitPropertyBag_IPropertyBag_Read(IPropertyBag *iface, LPC
if
(
V_VT
(
pVar
)
!=
VT_BSTR
)
return
E_INVALIDARG
;
result
=
pSHGetSpecialFolderPathW
(
NULL
,
wszPath
,
CSIDL_DESKTOPDIRECTORY
,
FALSE
);
ok
(
result
,
"SHGetSpecialFolderPathW(DESKTOPDIRECTORY) failed! x%08
l
x
\n
"
,
GetLastError
());
ok
(
result
,
"SHGetSpecialFolderPathW(DESKTOPDIRECTORY) failed! x%08x
\n
"
,
GetLastError
());
if
(
!
result
)
return
E_INVALIDARG
;
V_BSTR
(
pVar
)
=
SysAllocString
(
wszPath
);
...
...
@@ -1054,11 +1054,11 @@ void test_FolderShortcut(void) {
*/
hr
=
CoCreateInstance
(
&
CLSID_FolderShortcut
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IPersistPropertyBag
,
(
LPVOID
*
)
&
pPersistPropertyBag
);
ok
(
SUCCEEDED
(
hr
),
"CoCreateInstance failed! hr = 0x%08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"CoCreateInstance failed! hr = 0x%08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
hr
=
IPersistPropertyBag_Load
(
pPersistPropertyBag
,
&
InitPropertyBag
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"IPersistPropertyBag_Load failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"IPersistPropertyBag_Load failed! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IPersistPropertyBag_Release
(
pPersistPropertyBag
);
return
;
...
...
@@ -1067,18 +1067,18 @@ void test_FolderShortcut(void) {
hr
=
IPersistPropertyBag_QueryInterface
(
pPersistPropertyBag
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
pShellFolder
);
IPersistPropertyBag_Release
(
pPersistPropertyBag
);
ok
(
SUCCEEDED
(
hr
),
"IPersistPropertyBag_QueryInterface(IShellFolder) failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"IPersistPropertyBag_QueryInterface(IShellFolder) failed! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
hr
=
IShellFolder_GetDisplayNameOf
(
pShellFolder
,
NULL
,
SHGDN_FORPARSING
,
&
strret
);
ok
(
SUCCEEDED
(
hr
),
"IShellFolder_GetDisplayNameOf(NULL) failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"IShellFolder_GetDisplayNameOf(NULL) failed! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IShellFolder_Release
(
pShellFolder
);
return
;
}
result
=
pSHGetSpecialFolderPathW
(
NULL
,
wszDesktopPath
,
CSIDL_DESKTOPDIRECTORY
,
FALSE
);
ok
(
result
,
"SHGetSpecialFolderPathW(CSIDL_DESKTOPDIRECTORY) failed! 0x%08
l
x
\n
"
,
GetLastError
());
ok
(
result
,
"SHGetSpecialFolderPathW(CSIDL_DESKTOPDIRECTORY) failed! 0x%08x
\n
"
,
GetLastError
());
if
(
!
result
)
return
;
pStrRetToBufW
(
&
strret
,
NULL
,
wszBuffer
,
MAX_PATH
);
...
...
@@ -1086,15 +1086,15 @@ void test_FolderShortcut(void) {
hr
=
IShellFolder_QueryInterface
(
pShellFolder
,
&
IID_IPersistFolder3
,
(
LPVOID
*
)
&
pPersistFolder3
);
IShellFolder_Release
(
pShellFolder
);
ok
(
SUCCEEDED
(
hr
),
"IShellFolder_QueryInterface(IID_IPersistFolder3 failed! hr = 0x%08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"IShellFolder_QueryInterface(IID_IPersistFolder3 failed! hr = 0x%08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
hr
=
IPersistFolder3_GetClassID
(
pPersistFolder3
,
&
clsid
);
ok
(
SUCCEEDED
(
hr
),
"IPersistFolder3_GetClassID failed! hr=0x%08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"IPersistFolder3_GetClassID failed! hr=0x%08x
\n
"
,
hr
);
ok
(
IsEqualCLSID
(
&
clsid
,
&
CLSID_FolderShortcut
),
"Unexpected CLSID!
\n
"
);
hr
=
IPersistFolder3_GetCurFolder
(
pPersistFolder3
,
&
pidlCurrentFolder
);
ok
(
SUCCEEDED
(
hr
),
"IPersistFolder3_GetCurFolder failed! hr=0x%08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"IPersistFolder3_GetCurFolder failed! hr=0x%08x
\n
"
,
hr
);
ok
(
!
pidlCurrentFolder
,
"IPersistFolder3_GetCurFolder should return a NULL pidl!
\n
"
);
/* For FolderShortcut objects, the Initialize method initialized the folder's position in the
...
...
@@ -1104,7 +1104,7 @@ void test_FolderShortcut(void) {
* itemidlist, but GetDisplayNameOf still returns the path from above.
*/
hr
=
SHGetDesktopFolder
(
&
pDesktopFolder
);
ok
(
SUCCEEDED
(
hr
),
"SHGetDesktopFolder failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"SHGetDesktopFolder failed! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
/* Temporarily register WineTestFolder as a shell namespace extension at the Desktop.
...
...
@@ -1115,11 +1115,11 @@ void test_FolderShortcut(void) {
&
pidlWineTestFolder
,
NULL
);
RegDeleteKeyW
(
HKEY_CURRENT_USER
,
wszShellExtKey
);
IShellFolder_Release
(
pDesktopFolder
);
ok
(
SUCCEEDED
(
hr
),
"IShellFolder::ParseDisplayName failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"IShellFolder::ParseDisplayName failed! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
hr
=
IPersistFolder3_Initialize
(
pPersistFolder3
,
pidlWineTestFolder
);
ok
(
SUCCEEDED
(
hr
),
"IPersistFolder3::Initialize failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"IPersistFolder3::Initialize failed! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IPersistFolder3_Release
(
pPersistFolder3
);
ILFree
(
pidlWineTestFolder
);
...
...
@@ -1127,7 +1127,7 @@ void test_FolderShortcut(void) {
}
hr
=
IPersistFolder3_GetCurFolder
(
pPersistFolder3
,
&
pidlCurrentFolder
);
ok
(
SUCCEEDED
(
hr
),
"IPersistFolder3_GetCurFolder failed! hr=0x%08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"IPersistFolder3_GetCurFolder failed! hr=0x%08x
\n
"
,
hr
);
ok
(
ILIsEqual
(
pidlCurrentFolder
,
pidlWineTestFolder
),
"IPersistFolder3_GetCurFolder should return pidlWineTestFolder!
\n
"
);
ILFree
(
pidlCurrentFolder
);
...
...
@@ -1135,11 +1135,11 @@ void test_FolderShortcut(void) {
hr
=
IPersistFolder3_QueryInterface
(
pPersistFolder3
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
pShellFolder
);
IPersistFolder3_Release
(
pPersistFolder3
);
ok
(
SUCCEEDED
(
hr
),
"IPersistFolder3_QueryInterface(IShellFolder) failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"IPersistFolder3_QueryInterface(IShellFolder) failed! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
hr
=
IShellFolder_GetDisplayNameOf
(
pShellFolder
,
NULL
,
SHGDN_FORPARSING
,
&
strret
);
ok
(
SUCCEEDED
(
hr
),
"IShellFolder_GetDisplayNameOf(NULL) failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"IShellFolder_GetDisplayNameOf(NULL) failed! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IShellFolder_Release
(
pShellFolder
);
return
;
...
...
@@ -1160,7 +1160,7 @@ void test_FolderShortcut(void) {
hr
=
IShellFolder_ParseDisplayName
(
pShellFolder
,
NULL
,
NULL
,
wszSomeSubFolder
,
NULL
,
&
pidlSubFolder
,
NULL
);
RemoveDirectoryW
(
wszDesktopPath
);
ok
(
SUCCEEDED
(
hr
),
"IShellFolder::ParseDisplayName failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"IShellFolder::ParseDisplayName failed! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IShellFolder_Release
(
pShellFolder
);
return
;
...
...
@@ -1170,14 +1170,14 @@ void test_FolderShortcut(void) {
(
LPVOID
*
)
&
pPersistFolder3
);
IShellFolder_Release
(
pShellFolder
);
ILFree
(
pidlSubFolder
);
ok
(
SUCCEEDED
(
hr
),
"IShellFolder::BindToObject failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"IShellFolder::BindToObject failed! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
/* On windows, we expect CLSID_ShellFSFolder. On wine we relax this constraint
* a little bit and also allow CLSID_UnixDosFolder. */
hr
=
IPersistFolder3_GetClassID
(
pPersistFolder3
,
&
clsid
);
ok
(
SUCCEEDED
(
hr
),
"IPersistFolder3_GetClassID failed! hr=0x%08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"IPersistFolder3_GetClassID failed! hr=0x%08x
\n
"
,
hr
);
ok
(
IsEqualCLSID
(
&
clsid
,
&
CLSID_ShellFSFolder
)
||
IsEqualCLSID
(
&
clsid
,
&
CLSID_UnixDosFolder
),
"IPersistFolder3::GetClassID returned unexpected CLSID!
\n
"
);
...
...
@@ -1224,19 +1224,19 @@ void test_ITEMIDLIST_format(void) {
if
(
!
pSHGetSpecialFolderPathW
)
return
;
bResult
=
pSHGetSpecialFolderPathW
(
NULL
,
wszPersonal
,
CSIDL_PERSONAL
,
FALSE
);
ok
(
bResult
,
"SHGetSpecialFolderPathW failed! Last error: %08
l
x
\n
"
,
GetLastError
());
ok
(
bResult
,
"SHGetSpecialFolderPathW failed! Last error: %08x
\n
"
,
GetLastError
());
if
(
!
bResult
)
return
;
bResult
=
SetCurrentDirectoryW
(
wszPersonal
);
ok
(
bResult
,
"SetCurrentDirectory failed! Last error: %
l
d
\n
"
,
GetLastError
());
ok
(
bResult
,
"SetCurrentDirectory failed! Last error: %d
\n
"
,
GetLastError
());
if
(
!
bResult
)
return
;
hr
=
SHGetDesktopFolder
(
&
psfDesktop
);
ok
(
SUCCEEDED
(
hr
),
"SHGetDesktopFolder failed! hr: %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"SHGetDesktopFolder failed! hr: %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
hr
=
IShellFolder_ParseDisplayName
(
psfDesktop
,
NULL
,
NULL
,
wszPersonal
,
NULL
,
&
pidlPersonal
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"psfDesktop->ParseDisplayName failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"psfDesktop->ParseDisplayName failed! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IShellFolder_Release
(
psfDesktop
);
return
;
...
...
@@ -1246,7 +1246,7 @@ void test_ITEMIDLIST_format(void) {
(
LPVOID
*
)
&
psfPersonal
);
IShellFolder_Release
(
psfDesktop
);
ILFree
(
pidlPersonal
);
ok
(
SUCCEEDED
(
hr
),
"psfDesktop->BindToObject failed! hr = %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"psfDesktop->BindToObject failed! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
...
...
@@ -1257,7 +1257,7 @@ void test_ITEMIDLIST_format(void) {
WideCharToMultiByte
(
CP_ACP
,
0
,
wszFile
[
i
],
-
1
,
szFile
,
MAX_PATH
,
NULL
,
NULL
);
hFile
=
CreateFileW
(
wszFile
[
i
],
GENERIC_WRITE
,
0
,
NULL
,
CREATE_NEW
,
FILE_FLAG_WRITE_THROUGH
,
NULL
);
ok
(
hFile
!=
INVALID_HANDLE_VALUE
,
"CreateFile failed! (%
l
d)
\n
"
,
GetLastError
());
ok
(
hFile
!=
INVALID_HANDLE_VALUE
,
"CreateFile failed! (%d)
\n
"
,
GetLastError
());
if
(
hFile
==
INVALID_HANDLE_VALUE
)
{
IShellFolder_Release
(
psfPersonal
);
return
;
...
...
@@ -1266,7 +1266,7 @@ void test_ITEMIDLIST_format(void) {
hr
=
IShellFolder_ParseDisplayName
(
psfPersonal
,
NULL
,
NULL
,
wszFile
[
i
],
NULL
,
&
pidlFile
,
NULL
);
DeleteFileW
(
wszFile
[
i
]);
ok
(
SUCCEEDED
(
hr
),
"psfPersonal->ParseDisplayName failed! hr: %08
l
x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"psfPersonal->ParseDisplayName failed! hr: %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IShellFolder_Release
(
psfPersonal
);
return
;
...
...
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