Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b5cc68f6
Commit
b5cc68f6
authored
Mar 03, 2008
by
Stefan Leichter
Committed by
Alexandre Julliard
Mar 04, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Added tests for SHGetFolderPathAndSubDirA.
parent
257d8270
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
104 additions
and
0 deletions
+104
-0
shlfolder.c
dlls/shell32/tests/shlfolder.c
+104
-0
No files found.
dlls/shell32/tests/shlfolder.c
View file @
b5cc68f6
...
...
@@ -43,6 +43,8 @@
static
IMalloc
*
ppM
;
static
HRESULT
(
WINAPI
*
pSHBindToParent
)(
LPCITEMIDLIST
,
REFIID
,
LPVOID
*
,
LPCITEMIDLIST
*
);
static
HRESULT
(
WINAPI
*
pSHGetFolderPathA
)(
HWND
,
int
,
HANDLE
,
DWORD
,
LPSTR
);
static
HRESULT
(
WINAPI
*
pSHGetFolderPathAndSubDirA
)(
HWND
,
int
,
HANDLE
,
DWORD
,
LPCSTR
,
LPSTR
);
static
BOOL
(
WINAPI
*
pSHGetPathFromIDListW
)(
LPCITEMIDLIST
,
LPWSTR
);
static
BOOL
(
WINAPI
*
pSHGetSpecialFolderPathW
)(
HWND
,
LPWSTR
,
int
,
BOOL
);
static
HRESULT
(
WINAPI
*
pStrRetToBufW
)(
STRRET
*
,
LPCITEMIDLIST
,
LPWSTR
,
UINT
);
...
...
@@ -57,6 +59,8 @@ static void init_function_pointers(void)
hmod
=
GetModuleHandleA
(
"shell32.dll"
);
pSHBindToParent
=
(
void
*
)
GetProcAddress
(
hmod
,
"SHBindToParent"
);
pSHGetFolderPathA
=
(
void
*
)
GetProcAddress
(
hmod
,
"SHGetFolderPathA"
);
pSHGetFolderPathAndSubDirA
=
(
void
*
)
GetProcAddress
(
hmod
,
"SHGetFolderPathAndSubDirA"
);
pSHGetPathFromIDListW
=
(
void
*
)
GetProcAddress
(
hmod
,
"SHGetPathFromIDListW"
);
pSHGetSpecialFolderPathW
=
(
void
*
)
GetProcAddress
(
hmod
,
"SHGetSpecialFolderPathW"
);
pILFindLastID
=
(
void
*
)
GetProcAddress
(
hmod
,
(
LPCSTR
)
16
);
...
...
@@ -1365,6 +1369,102 @@ static void test_ITEMIDLIST_format(void) {
}
}
static
void
testSHGetFolderPathAndSubDirA
(
void
)
{
HRESULT
ret
;
BOOL
delret
;
DWORD
dwret
;
int
i
;
static
char
wine
[]
=
"wine"
;
static
char
winetemp
[]
=
"wine
\\
temp"
;
static
char
appdata
[
MAX_PATH
];
static
char
testpath
[
MAX_PATH
];
static
char
toolongpath
[
MAX_PATH
+
1
];
if
(
!
pSHGetFolderPathA
)
{
skip
(
"SHGetFolderPathA not present!
\n
"
);
return
;
}
if
(
!
SUCCEEDED
(
pSHGetFolderPathA
(
NULL
,
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
appdata
)))
{
skip
(
"SHGetFolderPathA failed for CSIDL_LOCAL_APPDATA!
\n
"
);
return
;
}
sprintf
(
testpath
,
"%s
\\
%s"
,
appdata
,
winetemp
);
delret
=
RemoveDirectoryA
(
testpath
);
if
(
!
delret
&&
(
ERROR_PATH_NOT_FOUND
!=
GetLastError
())
)
{
skip
(
"RemoveDirectoryA(%s) failed with error %u
\n
"
,
testpath
,
GetLastError
());
return
;
}
sprintf
(
testpath
,
"%s
\\
%s"
,
appdata
,
wine
);
delret
=
RemoveDirectoryA
(
testpath
);
if
(
!
delret
&&
(
ERROR_PATH_NOT_FOUND
!=
GetLastError
())
&&
(
ERROR_FILE_NOT_FOUND
!=
GetLastError
()))
{
skip
(
"RemoveDirectoryA(%s) failed with error %u
\n
"
,
testpath
,
GetLastError
());
return
;
}
for
(
i
=
0
;
i
<
MAX_PATH
;
i
++
)
toolongpath
[
i
]
=
'0'
+
i
%
10
;
toolongpath
[
MAX_PATH
]
=
'\0'
;
/* test invalid second parameter */
ret
=
pSHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_DONT_VERIFY
|
0xff
,
NULL
,
SHGFP_TYPE_CURRENT
,
wine
,
testpath
);
ok
(
E_INVALIDARG
==
ret
,
"expected E_INVALIDARG, got %x
\n
"
,
ret
);
/* test invalid forth parameter */
ret
=
pSHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_DONT_VERIFY
|
CSIDL_LOCAL_APPDATA
,
NULL
,
2
,
wine
,
testpath
);
ok
(
E_INVALIDARG
==
ret
,
"expected E_INVALIDARG, got %x
\n
"
,
ret
);
/* test fifth parameter */
testpath
[
0
]
=
'\0'
;
ret
=
pSHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_DONT_VERIFY
|
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
NULL
,
testpath
);
ok
(
S_OK
==
ret
,
"expected S_OK, got %x
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
appdata
,
testpath
),
"expected %s, got %s
\n
"
,
appdata
,
testpath
);
testpath
[
0
]
=
'\0'
;
ret
=
pSHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_DONT_VERIFY
|
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
""
,
testpath
);
ok
(
S_OK
==
ret
,
"expected S_OK, got %x
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
appdata
,
testpath
),
"expected %s, got %s
\n
"
,
appdata
,
testpath
);
testpath
[
0
]
=
'\0'
;
ret
=
pSHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_DONT_VERIFY
|
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
"
\\
"
,
testpath
);
ok
(
S_OK
==
ret
,
"expected S_OK, got %x
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
appdata
,
testpath
),
"expected %s, got %s
\n
"
,
appdata
,
testpath
);
ret
=
pSHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_DONT_VERIFY
|
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
toolongpath
,
testpath
);
ok
(
HRESULT_FROM_WIN32
(
ERROR_FILENAME_EXCED_RANGE
)
==
ret
,
"expected %x, got %x
\n
"
,
HRESULT_FROM_WIN32
(
ERROR_FILENAME_EXCED_RANGE
),
ret
);
testpath
[
0
]
=
'\0'
;
ret
=
pSHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_DONT_VERIFY
|
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
wine
,
NULL
);
ok
(
S_OK
==
ret
,
"expected S_OK, got %x
\n
"
,
ret
);
/* test a not existing path */
testpath
[
0
]
=
'\0'
;
ret
=
pSHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
winetemp
,
testpath
);
ok
(
HRESULT_FROM_WIN32
(
ERROR_PATH_NOT_FOUND
)
==
ret
,
"expected %x, got %x
\n
"
,
HRESULT_FROM_WIN32
(
ERROR_PATH_NOT_FOUND
),
ret
);
/* create a directory inside a not existing directory */
testpath
[
0
]
=
'\0'
;
ret
=
pSHGetFolderPathAndSubDirA
(
NULL
,
CSIDL_FLAG_CREATE
|
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
winetemp
,
testpath
);
ok
(
S_OK
==
ret
,
"expected S_OK, got %x
\n
"
,
ret
);
ok
(
!
strncmp
(
appdata
,
testpath
,
strlen
(
appdata
)),
"expected %s to start with %s
\n
"
,
testpath
,
appdata
);
ok
(
!
lstrcmpA
(
&
testpath
[
1
+
strlen
(
appdata
)],
winetemp
),
"expected %s to end with %s
\n
"
,
testpath
,
winetemp
);
dwret
=
GetFileAttributes
(
testpath
);
ok
(
FILE_ATTRIBUTE_DIRECTORY
|
dwret
,
"expected %x to contain FILE_ATTRIBUTE_DIRECTORY
\n
"
,
dwret
);
/* cleanup */
sprintf
(
testpath
,
"%s
\\
%s"
,
appdata
,
winetemp
);
RemoveDirectoryA
(
testpath
);
sprintf
(
testpath
,
"%s
\\
%s"
,
appdata
,
wine
);
RemoveDirectoryA
(
testpath
);
}
START_TEST
(
shlfolder
)
{
init_function_pointers
();
...
...
@@ -1381,6 +1481,10 @@ START_TEST(shlfolder)
test_CallForAttributes
();
test_FolderShortcut
();
test_ITEMIDLIST_format
();
if
(
pSHGetFolderPathAndSubDirA
)
testSHGetFolderPathAndSubDirA
();
else
skip
(
"SHGetFolderPathAndSubDirA not present
\n
"
);
OleUninitialize
();
}
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