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
fb88e06e
Commit
fb88e06e
authored
Jul 18, 2010
by
David Hedberg
Committed by
Alexandre Julliard
Jul 20, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Implement IPersistFolder2 for the desktop folder.
parent
1d658d4b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
20 deletions
+86
-20
shfldr_desktop.c
dlls/shell32/shfldr_desktop.c
+40
-20
shlfolder.c
dlls/shell32/tests/shlfolder.c
+46
-0
No files found.
dlls/shell32/shfldr_desktop.c
View file @
fb88e06e
...
...
@@ -65,7 +65,7 @@ extern HRESULT WINAPI IEParseDisplayNameWithBCW(DWORD codepage, LPCWSTR lpszDisp
typedef
struct
{
const
IShellFolder2Vtbl
*
lpVtbl
;
const
IPersist
Vtbl
*
lpVtblIPersist
;
const
IPersist
Folder2Vtbl
*
lpVtblPF2
;
LONG
ref
;
/* both paths are parsible from the desktop */
...
...
@@ -76,9 +76,9 @@ typedef struct {
BOOL
fAcceptFmt
;
/* flag for pending Drop */
}
IDesktopFolderImpl
;
static
inline
IDesktopFolderImpl
*
impl_from_IPersist
(
IPersist
*
iface
)
static
inline
IDesktopFolderImpl
*
impl_from_IPersist
Folder2
(
IPersistFolder2
*
iface
)
{
return
(
IDesktopFolderImpl
*
)((
char
*
)
iface
-
FIELD_OFFSET
(
IDesktopFolderImpl
,
lpVtbl
IPersist
));
return
(
IDesktopFolderImpl
*
)((
char
*
)
iface
-
FIELD_OFFSET
(
IDesktopFolderImpl
,
lpVtbl
PF2
));
}
static
const
shvheader
desktop_header
[]
=
{
...
...
@@ -94,7 +94,6 @@ static const shvheader desktop_header[] = {
/**************************************************************************
* ISF_Desktop_fnQueryInterface
*
* NOTES supports not IPersistFolder
*/
static
HRESULT
WINAPI
ISF_Desktop_fnQueryInterface
(
IShellFolder2
*
iface
,
REFIID
riid
,
LPVOID
*
ppvObj
)
...
...
@@ -111,9 +110,11 @@ static HRESULT WINAPI ISF_Desktop_fnQueryInterface(
{
*
ppvObj
=
This
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IPersist
))
else
if
(
IsEqualIID
(
riid
,
&
IID_IPersist
)
||
IsEqualIID
(
riid
,
&
IID_IPersistFolder
)
||
IsEqualIID
(
riid
,
&
IID_IPersistFolder2
))
{
*
ppvObj
=
&
This
->
lpVtbl
IPersist
;
*
ppvObj
=
&
This
->
lpVtbl
PF2
;
}
if
(
*
ppvObj
)
...
...
@@ -877,37 +878,56 @@ static const IShellFolder2Vtbl vt_MCFldr_ShellFolder2 =
/**************************************************************************
* IPersist
*/
static
HRESULT
WINAPI
ISF_Desktop_IPersist_fnQueryInterface
(
IPersist
*
iface
,
REFIID
riid
,
LPVOID
*
ppvObj
)
static
HRESULT
WINAPI
ISF_Desktop_IPersist
Folder2
_fnQueryInterface
(
IPersist
Folder2
*
iface
,
REFIID
riid
,
LPVOID
*
ppvObj
)
{
IDesktopFolderImpl
*
This
=
impl_from_IPersist
(
iface
);
IDesktopFolderImpl
*
This
=
impl_from_IPersist
Folder2
(
iface
);
return
IShellFolder2_QueryInterface
((
IShellFolder2
*
)
This
,
riid
,
ppvObj
);
}
static
ULONG
WINAPI
ISF_Desktop_IPersist_fnAddRef
(
IPersist
*
iface
)
static
ULONG
WINAPI
ISF_Desktop_IPersistFolder2_fnAddRef
(
IPersistFolder2
*
iface
)
{
IDesktopFolderImpl
*
This
=
impl_from_IPersist
(
iface
);
IDesktopFolderImpl
*
This
=
impl_from_IPersist
Folder2
(
iface
);
return
IShellFolder2_AddRef
((
IShellFolder2
*
)
This
);
}
static
ULONG
WINAPI
ISF_Desktop_IPersist_fnRelease
(
IPersist
*
iface
)
static
ULONG
WINAPI
ISF_Desktop_IPersistFolder2_fnRelease
(
IPersistFolder2
*
iface
)
{
IDesktopFolderImpl
*
This
=
impl_from_IPersist
(
iface
);
IDesktopFolderImpl
*
This
=
impl_from_IPersist
Folder2
(
iface
);
return
IShellFolder2_Release
((
IShellFolder2
*
)
This
);
}
static
HRESULT
WINAPI
ISF_Desktop_IPersist_fnGetClassID
(
IPersist
*
iface
,
CLSID
*
clsid
)
static
HRESULT
WINAPI
ISF_Desktop_IPersistFolder2_fnGetClassID
(
IPersistFolder2
*
iface
,
CLSID
*
clsid
)
{
*
clsid
=
CLSID_ShellDesktop
;
return
S_OK
;
}
static
HRESULT
WINAPI
ISF_Desktop_IPersistFolder2_fnInitialize
(
IPersistFolder2
*
iface
,
LPCITEMIDLIST
pidl
)
{
IDesktopFolderImpl
*
This
=
impl_from_IPersistFolder2
(
iface
);
FIXME
(
"(%p)->(%p) stub
\n
"
,
This
,
pidl
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
ISF_Desktop_IPersistFolder2_fnGetCurFolder
(
IPersistFolder2
*
iface
,
LPITEMIDLIST
*
ppidl
)
{
IDesktopFolderImpl
*
This
=
impl_from_IPersistFolder2
(
iface
);
*
ppidl
=
ILClone
(
This
->
pidlRoot
);
return
S_OK
;
}
static
const
IPersist
Vtbl
vt_IPersist
=
static
const
IPersist
Folder2Vtbl
vt_IPersistFolder2
=
{
ISF_Desktop_IPersist_fnQueryInterface
,
ISF_Desktop_IPersist_fnAddRef
,
ISF_Desktop_IPersist_fnRelease
,
ISF_Desktop_IPersist_fnGetClassID
ISF_Desktop_IPersistFolder2_fnQueryInterface
,
ISF_Desktop_IPersistFolder2_fnAddRef
,
ISF_Desktop_IPersistFolder2_fnRelease
,
ISF_Desktop_IPersistFolder2_fnGetClassID
,
ISF_Desktop_IPersistFolder2_fnInitialize
,
ISF_Desktop_IPersistFolder2_fnGetCurFolder
};
/**************************************************************************
...
...
@@ -939,7 +959,7 @@ HRESULT WINAPI ISF_Desktop_Constructor (
sf
->
ref
=
1
;
sf
->
lpVtbl
=
&
vt_MCFldr_ShellFolder2
;
sf
->
lpVtbl
IPersist
=
&
vt_IPersist
;
sf
->
lpVtbl
PF2
=
&
vt_IPersistFolder2
;
sf
->
pidlRoot
=
_ILCreateDesktop
();
/* my qualified pidl */
sf
->
sPathTarget
=
SHAlloc
(
(
lstrlenW
(
szMyPath
)
+
1
)
*
sizeof
(
WCHAR
)
);
lstrcpyW
(
sf
->
sPathTarget
,
szMyPath
);
...
...
dlls/shell32/tests/shlfolder.c
View file @
fb88e06e
...
...
@@ -2014,6 +2014,26 @@ static void test_SHCreateShellItem(void)
IShellItem_Release
(
shellitem
);
}
ret
=
pSHCreateShellItem
(
NULL
,
desktopfolder
,
pidl_testfile
,
&
shellitem
);
ok
(
SUCCEEDED
(
ret
),
"SHCreateShellItem returned %x
\n
"
,
ret
);
if
(
SUCCEEDED
(
ret
))
{
ret
=
IShellItem_QueryInterface
(
shellitem
,
&
IID_IPersistIDList
,
(
void
**
)
&
persistidl
);
ok
(
SUCCEEDED
(
ret
),
"QueryInterface returned %x
\n
"
,
ret
);
if
(
SUCCEEDED
(
ret
))
{
ret
=
IPersistIDList_GetIDList
(
persistidl
,
&
pidl_test
);
ok
(
SUCCEEDED
(
ret
),
"GetIDList returned %x
\n
"
,
ret
);
if
(
SUCCEEDED
(
ret
))
{
ok
(
ILIsEqual
(
pidl_testfile
,
pidl_test
),
"id lists are not equal
\n
"
);
pILFree
(
pidl_test
);
}
IPersistIDList_Release
(
persistidl
);
}
IShellItem_Release
(
shellitem
);
}
DeleteFileA
(
".
\\
testfile"
);
pILFree
(
pidl_abstestfile
);
pILFree
(
pidl_testfile
);
...
...
@@ -2084,6 +2104,7 @@ static void test_desktop_IPersist(void)
{
IShellFolder
*
desktop
;
IPersist
*
persist
;
IPersistFolder2
*
ppf2
;
CLSID
clsid
;
HRESULT
hr
;
...
...
@@ -2107,6 +2128,31 @@ static void test_desktop_IPersist(void)
IPersist_Release
(
persist
);
}
hr
=
IShellFolder_QueryInterface
(
desktop
,
&
IID_IPersistFolder2
,
(
void
**
)
&
ppf2
);
ok
(
hr
==
S_OK
||
broken
(
hr
==
E_NOINTERFACE
)
/* pre-Vista */
,
"failed %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
IPersistFolder
*
ppf
;
LPITEMIDLIST
pidl
;
hr
=
IShellFolder_QueryInterface
(
desktop
,
&
IID_IPersistFolder
,
(
void
**
)
&
ppf
);
ok
(
hr
==
S_OK
,
"IID_IPersistFolder2 without IID_IPersistFolder.
\n
"
);
if
(
SUCCEEDED
(
hr
))
IPersistFolder_Release
(
ppf
);
todo_wine
{
hr
=
IPersistFolder2_Initialize
(
ppf2
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
}
pidl
=
NULL
;
hr
=
IPersistFolder2_GetCurFolder
(
ppf2
,
&
pidl
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
pidl
!=
NULL
,
"pidl was NULL.
\n
"
);
if
(
SUCCEEDED
(
hr
))
pILFree
(
pidl
);
IPersistFolder2_Release
(
ppf2
);
}
IShellFolder_Release
(
desktop
);
}
...
...
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