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
2f5b53e7
Commit
2f5b53e7
authored
Jul 25, 2010
by
David Hedberg
Committed by
Alexandre Julliard
Jul 26, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Implement SHGetItemFromObject.
parent
d3846bb3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
0 deletions
+95
-0
shell32.spec
dlls/shell32/shell32.spec
+1
-0
shellitem.c
dlls/shell32/shellitem.c
+15
-0
shlfolder.c
dlls/shell32/tests/shlfolder.c
+78
-0
shobjidl.idl
include/shobjidl.idl
+1
-0
No files found.
dlls/shell32/shell32.spec
View file @
2f5b53e7
...
...
@@ -362,6 +362,7 @@
@ stdcall SHGetIDListFromObject(ptr ptr)
@ stdcall SHGetInstanceExplorer(long)
@ stdcall SHGetItemFromDataObject(ptr long ptr ptr)
@ stdcall SHGetItemFromObject(ptr ptr ptr)
@ stdcall SHGetLocalizedName(wstr ptr long ptr)
@ stdcall SHGetMalloc(ptr)
@ stdcall SHGetNameFromIDList(ptr long ptr)
...
...
dlls/shell32/shellitem.c
View file @
2f5b53e7
...
...
@@ -535,3 +535,18 @@ HRESULT WINAPI SHGetItemFromDataObject(IDataObject *pdtobj,
return
ret
;
}
HRESULT
WINAPI
SHGetItemFromObject
(
IUnknown
*
punk
,
REFIID
riid
,
void
**
ppv
)
{
LPITEMIDLIST
pidl
;
HRESULT
ret
;
ret
=
SHGetIDListFromObject
(
punk
,
&
pidl
);
if
(
SUCCEEDED
(
ret
))
{
ret
=
SHCreateItemFromIDList
(
pidl
,
riid
,
ppv
);
ILFree
(
pidl
);
}
return
ret
;
}
dlls/shell32/tests/shlfolder.c
View file @
2f5b53e7
...
...
@@ -64,6 +64,7 @@ static LPITEMIDLIST (WINAPI *pSHSimpleIDListFromPathAW)(LPCVOID);
static
HRESULT
(
WINAPI
*
pSHGetNameFromIDList
)(
PCIDLIST_ABSOLUTE
,
SIGDN
,
PWSTR
*
);
static
HRESULT
(
WINAPI
*
pSHGetItemFromDataObject
)(
IDataObject
*
,
DATAOBJ_GET_ITEM_FLAGS
,
REFIID
,
void
**
);
static
HRESULT
(
WINAPI
*
pSHGetIDListFromObject
)(
IUnknown
*
,
PIDLIST_ABSOLUTE
*
);
static
HRESULT
(
WINAPI
*
pSHGetItemFromObject
)(
IUnknown
*
,
REFIID
,
void
**
);
static
void
init_function_pointers
(
void
)
{
...
...
@@ -88,6 +89,7 @@ static void init_function_pointers(void)
MAKEFUNC
(
SHGetNameFromIDList
);
MAKEFUNC
(
SHGetItemFromDataObject
);
MAKEFUNC
(
SHGetIDListFromObject
);
MAKEFUNC
(
SHGetItemFromObject
);
#undef MAKEFUNC
#define MAKEFUNC_ORD(f, ord) (p##f = (void*)GetProcAddress(hmod, (LPSTR)(ord)))
...
...
@@ -2627,6 +2629,81 @@ static void test_SHGetIDListFromObject(void)
pILFree
(
pidl_desktop
);
}
static
void
test_SHGetItemFromObject
(
void
)
{
IUnknownImpl
*
punkimpl
;
IShellFolder
*
psfdesktop
;
LPITEMIDLIST
pidl
;
IShellItem
*
psi
;
IUnknown
*
punk
;
HRESULT
hres
;
struct
if_count
ifaces
[]
=
{
{
&
IID_IPersistIDList
,
0
},
{
&
IID_IPersistFolder2
,
0
},
{
&
IID_IDataObject
,
0
},
{
&
IID_IParentAndItem
,
0
},
{
&
IID_IFolderView
,
0
},
{
NULL
,
0
}
};
if
(
!
pSHGetItemFromObject
)
{
skip
(
"No SHGetItemFromObject.
\n
"
);
return
;
}
SHGetDesktopFolder
(
&
psfdesktop
);
if
(
0
)
{
/* Crashes with Windows 7 */
hres
=
pSHGetItemFromObject
((
IUnknown
*
)
psfdesktop
,
&
IID_IUnknown
,
(
void
**
)
NULL
);
hres
=
pSHGetItemFromObject
(
NULL
,
&
IID_IUnknown
,
(
void
**
)
NULL
);
hres
=
pSHGetItemFromObject
((
IUnknown
*
)
psfdesktop
,
NULL
,
(
void
**
)
&
punk
);
}
hres
=
pSHGetItemFromObject
(
NULL
,
&
IID_IUnknown
,
(
void
**
)
&
punk
);
ok
(
hres
==
E_NOINTERFACE
,
"Got 0x%08x
\n
"
,
hres
);
punkimpl
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
IUnknownImpl
));
punkimpl
->
lpVtbl
=
&
vt_IUnknown
;
punkimpl
->
ifaces
=
ifaces
;
punkimpl
->
unknown
=
0
;
/* The same as SHGetIDListFromObject */
hres
=
pSHGetIDListFromObject
((
IUnknown
*
)
punkimpl
,
&
pidl
);
ok
(
hres
==
E_NOINTERFACE
,
"Got %x
\n
"
,
hres
);
ok
(
ifaces
[
0
].
count
,
"interface not requested.
\n
"
);
ok
(
ifaces
[
1
].
count
,
"interface not requested.
\n
"
);
ok
(
ifaces
[
2
].
count
,
"interface not requested.
\n
"
);
todo_wine
ok
(
ifaces
[
3
].
count
||
broken
(
!
ifaces
[
3
].
count
/*vista*/
),
"interface not requested.
\n
"
);
ok
(
ifaces
[
4
].
count
||
broken
(
!
ifaces
[
4
].
count
/*vista*/
),
"interface not requested.
\n
"
);
ok
(
!
punkimpl
->
unknown
,
"Got %d unknown.
\n
"
,
punkimpl
->
unknown
);
HeapFree
(
GetProcessHeap
(),
0
,
punkimpl
);
/* Test IShellItem */
hres
=
pSHGetItemFromObject
((
IUnknown
*
)
psfdesktop
,
&
IID_IShellItem
,
(
void
**
)
&
psi
);
ok
(
hres
==
S_OK
,
"Got 0x%08x
\n
"
,
hres
);
if
(
SUCCEEDED
(
hres
))
{
IShellItem
*
psi2
;
hres
=
pSHGetItemFromObject
((
IUnknown
*
)
psi
,
&
IID_IShellItem
,
(
void
**
)
&
psi2
);
ok
(
hres
==
S_OK
,
"Got 0x%08x
\n
"
,
hres
);
if
(
SUCCEEDED
(
hres
))
{
todo_wine
ok
(
psi
==
psi2
,
"Different instances (%p != %p).
\n
"
,
psi
,
psi2
);
IShellItem_Release
(
psi2
);
}
IShellItem_Release
(
psi
);
}
IShellFolder_Release
(
psfdesktop
);
}
static
void
test_SHParseDisplayName
(
void
)
{
LPITEMIDLIST
pidl1
,
pidl2
;
...
...
@@ -3135,6 +3212,7 @@ START_TEST(shlfolder)
test_SHGetNameFromIDList
();
test_SHGetItemFromDataObject
();
test_SHGetIDListFromObject
();
test_SHGetItemFromObject
();
OleUninitialize
();
}
include/shobjidl.idl
View file @
2f5b53e7
...
...
@@ -509,6 +509,7 @@ cpp_quote("HRESULT WINAPI SHCreateItemFromParsingName(PCWSTR pszPath, IBindCtx *
cpp_quote
(
"HRESULT WINAPI SHCreateItemFromIDList(PCIDLIST_ABSOLUTE pidl, REFIID riid, void **ppv);"
)
cpp_quote
(
"HRESULT WINAPI SHGetItemFromDataObject(IDataObject *pdtobj, DATAOBJ_GET_ITEM_FLAGS dwFlags, REFIID riid, void **ppv);"
)
cpp_quote
(
"HRESULT WINAPI SHGetIDListFromObject(IUnknown *punk, PIDLIST_ABSOLUTE *ppidl);"
)
cpp_quote
(
"HRESULT WINAPI SHGetItemFromObject(IUnknown *punk, REFIID riid, void **ppv);"
)
/*****************************************************************************
*
IShellItemFilter
interface
...
...
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