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
500c7850
Commit
500c7850
authored
Mar 03, 2010
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 03, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Implement SHParseDisplayName with basic tests.
parent
721be713
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
98 additions
and
7 deletions
+98
-7
pidl.c
dlls/shell32/pidl.c
+18
-3
shfldr_desktop.c
dlls/shell32/shfldr_desktop.c
+3
-3
shlfolder.c
dlls/shell32/tests/shlfolder.c
+77
-1
No files found.
dlls/shell32/pidl.c
View file @
500c7850
...
...
@@ -1326,9 +1326,24 @@ HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCI
HRESULT
WINAPI
SHParseDisplayName
(
LPCWSTR
name
,
IBindCtx
*
bindctx
,
LPITEMIDLIST
*
pidlist
,
SFGAOF
attr_in
,
SFGAOF
*
attr_out
)
{
FIXME
(
"%s %p %p %d %p stub!
\n
"
,
debugstr_w
(
name
),
bindctx
,
pidlist
,
attr_in
,
attr_out
);
if
(
pidlist
)
*
pidlist
=
NULL
;
return
E_NOTIMPL
;
IShellFolder
*
desktop
;
HRESULT
hr
;
TRACE
(
"%s %p %p %d %p
\n
"
,
debugstr_w
(
name
),
bindctx
,
pidlist
,
attr_in
,
attr_out
);
*
pidlist
=
NULL
;
if
(
!
name
)
return
E_OUTOFMEMORY
;
hr
=
SHGetDesktopFolder
(
&
desktop
);
if
(
hr
!=
S_OK
)
return
hr
;
hr
=
IShellFolder_ParseDisplayName
(
desktop
,
NULL
,
bindctx
,
(
LPWSTR
)
name
,
NULL
,
pidlist
,
&
attr_in
);
if
(
attr_out
)
*
attr_out
=
attr_in
;
IShellFolder_Release
(
desktop
);
return
hr
;
}
/**************************************************************************
...
...
dlls/shell32/shfldr_desktop.c
View file @
500c7850
...
...
@@ -151,11 +151,11 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
This
,
hwndOwner
,
pbc
,
lpszDisplayName
,
debugstr_w
(
lpszDisplayName
),
pchEaten
,
ppidl
,
pdwAttributes
);
if
(
!
lpszDisplayName
||
!
ppidl
)
return
E_INVALIDARG
;
if
(
!
ppidl
)
return
E_INVALIDARG
;
*
ppidl
=
0
;
if
(
!
lpszDisplayName
)
return
E_INVALIDARG
;
if
(
pchEaten
)
*
pchEaten
=
0
;
/* strange but like the original */
...
...
dlls/shell32/tests/shlfolder.c
View file @
500c7850
...
...
@@ -54,7 +54,7 @@ static void (WINAPI *pILFree)(LPITEMIDLIST);
static
BOOL
(
WINAPI
*
pILIsEqual
)(
LPCITEMIDLIST
,
LPCITEMIDLIST
);
static
HRESULT
(
WINAPI
*
pSHCreateShellItem
)(
LPCITEMIDLIST
,
IShellFolder
*
,
LPCITEMIDLIST
,
IShellItem
**
);
static
LPITEMIDLIST
(
WINAPI
*
pILCombine
)(
LPCITEMIDLIST
,
LPCITEMIDLIST
);
static
HRESULT
(
WINAPI
*
pSHParseDisplayName
)(
LPCWSTR
,
IBindCtx
*
,
LPITEMIDLIST
*
,
SFGAOF
,
SFGAOF
*
);
static
void
init_function_pointers
(
void
)
{
...
...
@@ -71,6 +71,7 @@ static void init_function_pointers(void)
MAKEFUNC
(
SHGetPathFromIDListW
);
MAKEFUNC
(
SHGetSpecialFolderPathA
);
MAKEFUNC
(
SHGetSpecialFolderPathW
);
MAKEFUNC
(
SHParseDisplayName
);
#undef MAKEFUNC
#define MAKEFUNC_ORD(f, ord) (p##f = (void*)GetProcAddress(hmod, (LPSTR)(ord)))
...
...
@@ -103,6 +104,18 @@ static void test_ParseDisplayName(void)
hr
=
SHGetDesktopFolder
(
&
IDesktopFolder
);
if
(
hr
!=
S_OK
)
return
;
/* null name and pidl */
hr
=
IShellFolder_ParseDisplayName
(
IDesktopFolder
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
0
);
ok
(
hr
==
E_INVALIDARG
,
"returned %08x, expected E_INVALIDARG
\n
"
,
hr
);
/* null name */
newPIDL
=
(
ITEMIDLIST
*
)
0xdeadbeef
;
hr
=
IShellFolder_ParseDisplayName
(
IDesktopFolder
,
NULL
,
NULL
,
NULL
,
NULL
,
&
newPIDL
,
0
);
ok
(
newPIDL
==
0
,
"expected null, got %p
\n
"
,
newPIDL
);
ok
(
hr
==
E_INVALIDARG
,
"returned %08x, expected E_INVALIDARG
\n
"
,
hr
);
MultiByteToWideChar
(
CP_ACP
,
0
,
cInetTestA
,
-
1
,
cTestDirW
,
MAX_PATH
);
hr
=
IShellFolder_ParseDisplayName
(
IDesktopFolder
,
NULL
,
NULL
,
cTestDirW
,
NULL
,
&
newPIDL
,
0
);
...
...
@@ -1962,6 +1975,68 @@ static void test_SHCreateShellItem(void)
IShellFolder_Release
(
desktopfolder
);
}
static
void
test_SHParseDisplayName
(
void
)
{
static
const
WCHAR
prefixW
[]
=
{
'w'
,
't'
,
0
};
LPITEMIDLIST
pidl1
,
pidl2
;
IShellFolder
*
desktop
;
WCHAR
dirW
[
MAX_PATH
];
WCHAR
nameW
[
10
];
HRESULT
hr
;
BOOL
ret
;
if
(
!
pSHParseDisplayName
)
{
win_skip
(
"SHParseDisplayName isn't available
\n
"
);
return
;
}
if
(
0
)
{
/* crashes on native */
hr
=
pSHParseDisplayName
(
NULL
,
NULL
,
NULL
,
0
,
NULL
);
nameW
[
0
]
=
0
;
hr
=
pSHParseDisplayName
(
nameW
,
NULL
,
NULL
,
0
,
NULL
);
}
pidl1
=
(
LPITEMIDLIST
)
0xdeadbeef
;
hr
=
pSHParseDisplayName
(
NULL
,
NULL
,
&
pidl1
,
0
,
NULL
);
ok
(
hr
==
E_OUTOFMEMORY
,
"failed %08x
\n
"
,
hr
);
ok
(
pidl1
==
0
,
"expected null ptr, got %p
\n
"
,
pidl1
);
/* dummy name */
nameW
[
0
]
=
0
;
hr
=
pSHParseDisplayName
(
nameW
,
NULL
,
&
pidl1
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"failed %08x
\n
"
,
hr
);
hr
=
SHGetDesktopFolder
(
&
desktop
);
ok
(
hr
==
S_OK
,
"failed %08x
\n
"
,
hr
);
hr
=
IShellFolder_ParseDisplayName
(
desktop
,
NULL
,
NULL
,
nameW
,
NULL
,
&
pidl2
,
NULL
);
ok
(
hr
==
S_OK
,
"failed %08x
\n
"
,
hr
);
ret
=
pILIsEqual
(
pidl1
,
pidl2
);
ok
(
ret
==
TRUE
,
"expected equal idls
\n
"
);
pILFree
(
pidl1
);
pILFree
(
pidl2
);
/* with path */
GetTempPathW
(
sizeof
(
dirW
)
/
sizeof
(
WCHAR
),
dirW
);
GetTempFileNameW
(
dirW
,
prefixW
,
0
,
dirW
);
CreateFileW
(
dirW
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
NULL
);
hr
=
pSHParseDisplayName
(
dirW
,
NULL
,
&
pidl1
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"failed %08x
\n
"
,
hr
);
hr
=
IShellFolder_ParseDisplayName
(
desktop
,
NULL
,
NULL
,
dirW
,
NULL
,
&
pidl2
,
NULL
);
ok
(
hr
==
S_OK
,
"failed %08x
\n
"
,
hr
);
ret
=
pILIsEqual
(
pidl1
,
pidl2
);
ok
(
ret
==
TRUE
,
"expected equal idls
\n
"
);
pILFree
(
pidl1
);
pILFree
(
pidl2
);
DeleteFileW
(
dirW
);
IShellFolder_Release
(
desktop
);
}
START_TEST
(
shlfolder
)
{
init_function_pointers
();
...
...
@@ -1970,6 +2045,7 @@ START_TEST(shlfolder)
OleInitialize
(
NULL
);
test_ParseDisplayName
();
test_SHParseDisplayName
();
test_BindToObject
();
test_EnumObjects_and_CompareIDs
();
test_GetDisplayName
();
...
...
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