Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexey Alyaev
wine
Commits
d22568d0
Commit
d22568d0
authored
17 years ago
by
Francois Gouget
Committed by
Alexandre Julliard
17 years ago
Browse files
Options
Downloads
Patches
Plain Diff
shell32/tests: Use GetProcAddress() on SHGetPathFromIDListW() because it is missing on Windows 95.
parent
3874c55c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/shell32/tests/shlfolder.c
+28
-19
28 additions, 19 deletions
dlls/shell32/tests/shlfolder.c
with
28 additions
and
19 deletions
dlls/shell32/tests/shlfolder.c
+
28
−
19
View file @
d22568d0
...
@@ -43,6 +43,7 @@
...
@@ -43,6 +43,7 @@
static
IMalloc
*
ppM
;
static
IMalloc
*
ppM
;
static
HRESULT
(
WINAPI
*
pSHBindToParent
)(
LPCITEMIDLIST
,
REFIID
,
LPVOID
*
,
LPCITEMIDLIST
*
);
static
HRESULT
(
WINAPI
*
pSHBindToParent
)(
LPCITEMIDLIST
,
REFIID
,
LPVOID
*
,
LPCITEMIDLIST
*
);
static
BOOL
(
WINAPI
*
pSHGetPathFromIDListW
)(
LPCITEMIDLIST
,
LPWSTR
);
static
BOOL
(
WINAPI
*
pSHGetSpecialFolderPathW
)(
HWND
,
LPWSTR
,
int
,
BOOL
);
static
BOOL
(
WINAPI
*
pSHGetSpecialFolderPathW
)(
HWND
,
LPWSTR
,
int
,
BOOL
);
static
HRESULT
(
WINAPI
*
pStrRetToBufW
)(
STRRET
*
,
LPCITEMIDLIST
,
LPWSTR
,
UINT
);
static
HRESULT
(
WINAPI
*
pStrRetToBufW
)(
STRRET
*
,
LPCITEMIDLIST
,
LPWSTR
,
UINT
);
static
LPITEMIDLIST
(
WINAPI
*
pILFindLastID
)(
LPCITEMIDLIST
);
static
LPITEMIDLIST
(
WINAPI
*
pILFindLastID
)(
LPCITEMIDLIST
);
...
@@ -56,6 +57,7 @@ static void init_function_pointers(void)
...
@@ -56,6 +57,7 @@ static void init_function_pointers(void)
hmod
=
GetModuleHandleA
(
"shell32.dll"
);
hmod
=
GetModuleHandleA
(
"shell32.dll"
);
pSHBindToParent
=
(
void
*
)
GetProcAddress
(
hmod
,
"SHBindToParent"
);
pSHBindToParent
=
(
void
*
)
GetProcAddress
(
hmod
,
"SHBindToParent"
);
pSHGetPathFromIDListW
=
(
void
*
)
GetProcAddress
(
hmod
,
"SHGetPathFromIDListW"
);
pSHGetSpecialFolderPathW
=
(
void
*
)
GetProcAddress
(
hmod
,
"SHGetSpecialFolderPathW"
);
pSHGetSpecialFolderPathW
=
(
void
*
)
GetProcAddress
(
hmod
,
"SHGetSpecialFolderPathW"
);
pILFindLastID
=
(
void
*
)
GetProcAddress
(
hmod
,
(
LPCSTR
)
16
);
pILFindLastID
=
(
void
*
)
GetProcAddress
(
hmod
,
(
LPCSTR
)
16
);
pILFree
=
(
void
*
)
GetProcAddress
(
hmod
,
(
LPSTR
)
155
);
pILFree
=
(
void
*
)
GetProcAddress
(
hmod
,
(
LPSTR
)
155
);
...
@@ -363,10 +365,10 @@ static void test_GetDisplayName(void)
...
@@ -363,10 +365,10 @@ static void test_GetDisplayName(void)
static
const
WCHAR
wszDirName
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
't'
,
'e'
,
's'
,
't'
,
0
};
static
const
WCHAR
wszDirName
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
't'
,
'e'
,
's'
,
't'
,
0
};
/* I'm trying to figure if there is a functional difference between calling
/* I'm trying to figure if there is a functional difference between calling
* SHGetPathFromIDList and calling GetDisplayNameOf(SHGDN_FORPARSING) after
* SHGetPathFromIDList
W
and calling GetDisplayNameOf(SHGDN_FORPARSING) after
* binding to the shellfolder. One thing I thought of was that perhaps
* binding to the shellfolder. One thing I thought of was that perhaps
* SHGetPathFromIDList would be able to get the path to a file, which does
* SHGetPathFromIDList
W
would be able to get the path to a file, which does
* not exist anymore, while the other method would
'
nt. It turns out there's
* not exist anymore, while the other method wouldn
'
t. It turns out there's
* no functional difference in this respect.
* no functional difference in this respect.
*/
*/
...
@@ -461,9 +463,12 @@ static void test_GetDisplayName(void)
...
@@ -461,9 +463,12 @@ static void test_GetDisplayName(void)
RemoveDirectoryA
(
szTestDir
);
RemoveDirectoryA
(
szTestDir
);
/* SHGetPathFromIDListW still works, although the file is not present anymore. */
/* SHGetPathFromIDListW still works, although the file is not present anymore. */
result
=
SHGetPathFromIDListW
(
pidlTestFile
,
wszTestFile2
);
if
(
pSHGetPathFromIDListW
)
ok
(
result
,
"SHGetPathFromIDListW failed! Last error: %u
\n
"
,
GetLastError
());
{
ok
(
!
lstrcmpiW
(
wszTestFile
,
wszTestFile2
),
"SHGetPathFromIDListW returns incorrect path!
\n
"
);
result
=
pSHGetPathFromIDListW
(
pidlTestFile
,
wszTestFile2
);
ok
(
result
,
"SHGetPathFromIDListW failed! Last error: %u
\n
"
,
GetLastError
());
ok
(
!
lstrcmpiW
(
wszTestFile
,
wszTestFile2
),
"SHGetPathFromIDListW returns incorrect path!
\n
"
);
}
if
(
!
pSHBindToParent
)
return
;
if
(
!
pSHBindToParent
)
return
;
...
@@ -793,26 +798,30 @@ static void test_SHGetPathFromIDList(void)
...
@@ -793,26 +798,30 @@ static void test_SHGetPathFromIDList(void)
HMODULE
hShell32
;
HMODULE
hShell32
;
LPITEMIDLIST
pidlPrograms
;
LPITEMIDLIST
pidlPrograms
;
if
(
!
pSHGetSpecialFolderPathW
)
return
;
if
(
!
pSHGetPathFromIDListW
||
!
pSHGetSpecialFolderPathW
)
{
skip
(
"SHGetPathFromIDListW() or SHGetSpecialFolderPathW() is missing
\n
"
);
return
;
}
/* Calling SHGetPathFromIDList with no pidl should return the empty string */
/* Calling SHGetPathFromIDList
W
with no pidl should return the empty string */
wszPath
[
0
]
=
'a'
;
wszPath
[
0
]
=
'a'
;
wszPath
[
1
]
=
'\0'
;
wszPath
[
1
]
=
'\0'
;
result
=
SHGetPathFromIDListW
(
NULL
,
wszPath
);
result
=
p
SHGetPathFromIDListW
(
NULL
,
wszPath
);
ok
(
!
result
,
"Expected failure
\n
"
);
ok
(
!
result
,
"Expected failure
\n
"
);
ok
(
!
wszPath
[
0
],
"Expected empty string
\n
"
);
ok
(
!
wszPath
[
0
],
"Expected empty string
\n
"
);
/* Calling SHGetPathFromIDList with an empty pidl should return the desktop folder's path. */
/* Calling SHGetPathFromIDList
W
with an empty pidl should return the desktop folder's path. */
result
=
pSHGetSpecialFolderPathW
(
NULL
,
wszDesktop
,
CSIDL_DESKTOP
,
FALSE
);
result
=
pSHGetSpecialFolderPathW
(
NULL
,
wszDesktop
,
CSIDL_DESKTOP
,
FALSE
);
ok
(
result
,
"SHGetSpecialFolderPathW(CSIDL_DESKTOP) failed! Last error: %u
\n
"
,
GetLastError
());
ok
(
result
,
"SHGetSpecialFolderPathW(CSIDL_DESKTOP) failed! Last error: %u
\n
"
,
GetLastError
());
if
(
!
result
)
return
;
if
(
!
result
)
return
;
result
=
SHGetPathFromIDListW
(
pidlEmpty
,
wszPath
);
result
=
p
SHGetPathFromIDListW
(
pidlEmpty
,
wszPath
);
ok
(
result
,
"SHGetPathFromIDListW failed! Last error: %u
\n
"
,
GetLastError
());
ok
(
result
,
"SHGetPathFromIDListW failed! Last error: %u
\n
"
,
GetLastError
());
if
(
!
result
)
return
;
if
(
!
result
)
return
;
ok
(
!
lstrcmpiW
(
wszDesktop
,
wszPath
),
"SHGetPathFromIDList didn't return desktop path for empty pidl!
\n
"
);
ok
(
!
lstrcmpiW
(
wszDesktop
,
wszPath
),
"SHGetPathFromIDList
W
didn't return desktop path for empty pidl!
\n
"
);
/* MyComputer does not map to a filesystem path. SHGetPathFromIDList should fail. */
/* MyComputer does not map to a filesystem path. SHGetPathFromIDList
W
should fail. */
hr
=
SHGetDesktopFolder
(
&
psfDesktop
);
hr
=
SHGetDesktopFolder
(
&
psfDesktop
);
ok
(
SUCCEEDED
(
hr
),
"SHGetDesktopFolder failed! hr = %08x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"SHGetDesktopFolder failed! hr = %08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
if
(
FAILED
(
hr
))
return
;
...
@@ -827,9 +836,9 @@ static void test_SHGetPathFromIDList(void)
...
@@ -827,9 +836,9 @@ static void test_SHGetPathFromIDList(void)
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
wszPath
[
0
]
=
'a'
;
wszPath
[
0
]
=
'a'
;
wszPath
[
1
]
=
'\0'
;
wszPath
[
1
]
=
'\0'
;
result
=
SHGetPathFromIDListW
(
pidlMyComputer
,
wszPath
);
result
=
p
SHGetPathFromIDListW
(
pidlMyComputer
,
wszPath
);
ok
(
!
result
,
"SHGetPathFromIDList succeeded where it shouldn't!
\n
"
);
ok
(
!
result
,
"SHGetPathFromIDList
W
succeeded where it shouldn't!
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"SHGetPathFromIDList shouldn't set last error! Last error: %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
0xdeadbeef
,
"SHGetPathFromIDList
W
shouldn't set last error! Last error: %u
\n
"
,
GetLastError
());
ok
(
!
wszPath
[
0
],
"Expected empty path
\n
"
);
ok
(
!
wszPath
[
0
],
"Expected empty path
\n
"
);
if
(
result
)
{
if
(
result
)
{
IShellFolder_Release
(
psfDesktop
);
IShellFolder_Release
(
psfDesktop
);
...
@@ -881,7 +890,7 @@ static void test_SHGetPathFromIDList(void)
...
@@ -881,7 +890,7 @@ static void test_SHGetPathFromIDList(void)
"returned incorrect path for file placed on desktop
\n
"
);
"returned incorrect path for file placed on desktop
\n
"
);
}
}
result
=
SHGetPathFromIDListW
(
pidlTestFile
,
wszPath
);
result
=
p
SHGetPathFromIDListW
(
pidlTestFile
,
wszPath
);
ok
(
result
,
"SHGetPathFromIDListW failed! Last error: %u
\n
"
,
GetLastError
());
ok
(
result
,
"SHGetPathFromIDListW failed! Last error: %u
\n
"
,
GetLastError
());
IMalloc_Free
(
ppM
,
pidlTestFile
);
IMalloc_Free
(
ppM
,
pidlTestFile
);
if
(
!
result
)
return
;
if
(
!
result
)
return
;
...
@@ -896,9 +905,9 @@ static void test_SHGetPathFromIDList(void)
...
@@ -896,9 +905,9 @@ static void test_SHGetPathFromIDList(void)
ok
(
SUCCEEDED
(
hr
),
"SHGetFolderLocation failed: 0x%08x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"SHGetFolderLocation failed: 0x%08x
\n
"
,
hr
);
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
result
=
SHGetPathFromIDListW
(
pidlPrograms
,
wszPath
);
result
=
p
SHGetPathFromIDListW
(
pidlPrograms
,
wszPath
);
IMalloc_Free
(
ppM
,
pidlPrograms
);
IMalloc_Free
(
ppM
,
pidlPrograms
);
ok
(
result
,
"SHGetPathFromIDList failed
\n
"
);
ok
(
result
,
"SHGetPathFromIDList
W
failed
\n
"
);
}
}
static
void
test_EnumObjects_and_CompareIDs
(
void
)
static
void
test_EnumObjects_and_CompareIDs
(
void
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment