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
20872fad
Commit
20872fad
authored
Aug 18, 2010
by
David Hedberg
Committed by
Alexandre Julliard
Aug 18, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
explorerframe: Implement GetSelectedItems.
parent
29bf096f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
213 additions
and
3 deletions
+213
-3
nstc.c
dlls/explorerframe/nstc.c
+11
-2
nstc.c
dlls/explorerframe/tests/nstc.c
+202
-1
No files found.
dlls/explorerframe/nstc.c
View file @
20872fad
...
...
@@ -1212,8 +1212,17 @@ static HRESULT WINAPI NSTC2_fnGetSelectedItems(INameSpaceTreeControl2* iface,
IShellItemArray
**
psiaItems
)
{
NSTC2Impl
*
This
=
(
NSTC2Impl
*
)
iface
;
FIXME
(
"stub, %p (%p)
\n
"
,
This
,
psiaItems
);
return
E_NOTIMPL
;
IShellItem
*
psiselected
;
HRESULT
hr
;
TRACE
(
"%p (%p)
\n
"
,
This
,
psiaItems
);
psiselected
=
get_selected_shellitem
(
This
);
if
(
!
psiselected
)
return
E_FAIL
;
hr
=
SHCreateShellItemArrayFromShellItem
(
psiselected
,
&
IID_IShellItemArray
,
(
void
**
)
psiaItems
);
return
hr
;
}
static
HRESULT
WINAPI
NSTC2_fnGetItemCustomState
(
INameSpaceTreeControl2
*
iface
,
...
...
dlls/explorerframe/tests/nstc.c
View file @
20872fad
...
...
@@ -723,10 +723,12 @@ static void test_basics(void)
INameSpaceTreeControl2
*
pnstc2
;
IShellItemArray
*
psia
;
IShellFolder
*
psfdesktop
;
IShellItem
*
psi
;
IShellItem
*
psidesktop
,
*
psidesktop2
;
IShellItem
*
psitestdir
,
*
psitestdir2
;
IShellItem
*
psitestdir
,
*
psitestdir2
,
*
psitest1
;
IOleWindow
*
pow
;
LPITEMIDLIST
pidl_desktop
;
NSTCITEMSTATE
istate
;
HRESULT
hr
;
UINT
i
,
res
;
RECT
rc
;
...
...
@@ -736,9 +738,12 @@ static void test_basics(void)
static
const
WCHAR
testdirW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
'd'
,
'i'
,
'r'
,
0
};
static
const
WCHAR
testdir2W
[]
=
{
't'
,
'e'
,
's'
,
't'
,
'd'
,
'i'
,
'r'
,
'\\'
,
't'
,
'e'
,
's'
,
't'
,
'd'
,
'i'
,
'r'
,
'2'
,
0
};
static
const
WCHAR
test1W
[]
=
{
't'
,
'e'
,
's'
,
't'
,
'd'
,
'i'
,
'r'
,
'\\'
,
't'
,
'e'
,
's'
,
't'
,
'1'
,
'.'
,
't'
,
'x'
,
't'
,
0
};
/* These should exist on platforms supporting the NSTC */
ok
(
pSHCreateShellItem
!=
NULL
,
"No SHCreateShellItem.
\n
"
);
ok
(
pSHCreateItemFromParsingName
!=
NULL
,
"No SHCreateItemFromParsingName
\n
"
);
ok
(
pSHGetIDListFromObject
!=
NULL
,
"No SHCreateShellItem.
\n
"
);
ok
(
pSHCreateItemFromParsingName
!=
NULL
,
"No SHCreateItemFromParsingName
\n
"
);
...
...
@@ -783,6 +788,12 @@ static void test_basics(void)
hr
=
pSHCreateItemFromParsingName
(
buf
,
NULL
,
&
IID_IShellItem
,
(
void
**
)
&
psitestdir2
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
goto
cleanup
;
lstrcpyW
(
buf
,
curdirW
);
myPathAddBackslashW
(
buf
);
lstrcatW
(
buf
,
test1W
);
hr
=
pSHCreateItemFromParsingName
(
buf
,
NULL
,
&
IID_IShellItem
,
(
void
**
)
&
psitest1
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
goto
cleanup
;
hr
=
CoCreateInstance
(
&
CLSID_NamespaceTreeControl
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_INameSpaceTreeControl
,
(
void
**
)
&
pnstc
);
...
...
@@ -1296,10 +1307,200 @@ static void test_basics(void)
ok
(
hr
==
S_OK
,
"Got (0x%08x)
\n
"
,
hr
);
}
/* GetSelectedItems */
if
(
0
)
{
/* Crashes under Windows 7 */
hr
=
INameSpaceTreeControl_GetSelectedItems
(
pnstc
,
NULL
);
}
psia
=
(
void
*
)
0xdeadbeef
;
hr
=
INameSpaceTreeControl_GetSelectedItems
(
pnstc
,
&
psia
);
ok
(
hr
==
E_FAIL
,
"Got 0x%08x
\n
"
,
hr
);
ok
(
psia
==
(
void
*
)
0xdeadbeef
,
"Got %p"
,
psia
);
hr
=
INameSpaceTreeControl_AppendRoot
(
pnstc
,
psitestdir2
,
SHCONTF_FOLDERS
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"Got (0x%08x)
\n
"
,
hr
);
process_msgs
();
hr
=
INameSpaceTreeControl_AppendRoot
(
pnstc
,
psitestdir
,
SHCONTF_FOLDERS
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"Got (0x%08x)
\n
"
,
hr
);
process_msgs
();
hr
=
INameSpaceTreeControl_SetItemState
(
pnstc
,
psitestdir
,
NSTCIS_SELECTED
,
NSTCIS_SELECTED
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
hr
=
INameSpaceTreeControl_GetSelectedItems
(
pnstc
,
&
psia
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
UINT
count
;
hr
=
IShellItemArray_GetCount
(
psia
,
&
count
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
ok
(
count
==
1
,
"Got %d selected items.
\n
"
,
count
);
if
(
count
)
{
hr
=
IShellItemArray_GetItemAt
(
psia
,
0
,
&
psi
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
int
cmp
;
hr
=
IShellItem_Compare
(
psi
,
psitestdir
,
SICHINT_DISPLAY
,
&
cmp
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
IShellItem_Release
(
psi
);
}
}
IShellItemArray_Release
(
psia
);
}
hr
=
INameSpaceTreeControl_SetItemState
(
pnstc
,
psitestdir2
,
NSTCIS_SELECTED
,
NSTCIS_SELECTED
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
process_msgs
();
hr
=
INameSpaceTreeControl_GetSelectedItems
(
pnstc
,
&
psia
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
UINT
count
;
hr
=
IShellItemArray_GetCount
(
psia
,
&
count
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
ok
(
count
==
1
,
"Got %d selected items.
\n
"
,
count
);
if
(
count
)
{
hr
=
IShellItemArray_GetItemAt
(
psia
,
0
,
&
psi
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
int
cmp
;
hr
=
IShellItem_Compare
(
psi
,
psitestdir2
,
SICHINT_DISPLAY
,
&
cmp
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
IShellItem_Release
(
psi
);
}
}
IShellItemArray_Release
(
psia
);
}
hr
=
INameSpaceTreeControl_SetItemState
(
pnstc
,
psitest1
,
NSTCIS_SELECTED
,
NSTCIS_SELECTED
);
todo_wine
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
hr
=
INameSpaceTreeControl_GetSelectedItems
(
pnstc
,
&
psia
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
UINT
count
;
hr
=
IShellItemArray_GetCount
(
psia
,
&
count
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
ok
(
count
==
1
,
"Got %d selected items.
\n
"
,
count
);
if
(
count
)
{
hr
=
IShellItemArray_GetItemAt
(
psia
,
0
,
&
psi
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
int
cmp
;
hr
=
IShellItem_Compare
(
psi
,
psitest1
,
SICHINT_DISPLAY
,
&
cmp
);
todo_wine
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
IShellItem_Release
(
psi
);
}
}
IShellItemArray_Release
(
psia
);
}
hr
=
INameSpaceTreeControl_RemoveAllRoots
(
pnstc
);
ok
(
hr
==
S_OK
||
broken
(
hr
==
E_FAIL
),
"Got 0x%08x
\n
"
,
hr
);
if
(
hr
==
E_FAIL
)
{
/* For some reason, Vista fails to properly remove both the
* roots here on the first try. */
hr
=
INameSpaceTreeControl_RemoveAllRoots
(
pnstc
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
}
/* Adding without NSTCRS_EXPANDED does not set the selection */
hr
=
INameSpaceTreeControl_AppendRoot
(
pnstc
,
psitestdir
,
SHCONTF_FOLDERS
|
SHCONTF_NONFOLDERS
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
process_msgs
();
hr
=
INameSpaceTreeControl_GetItemState
(
pnstc
,
psitestdir
,
0xFF
,
&
istate
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
ok
(
!
(
istate
&
NSTCIS_SELECTED
),
"Got 0x%08x
\n
"
,
istate
);
hr
=
INameSpaceTreeControl_GetSelectedItems
(
pnstc
,
&
psia
);
ok
(
hr
==
E_FAIL
,
"Got 0x%08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
IShellItemArray_Release
(
psia
);
hr
=
INameSpaceTreeControl_RemoveAllRoots
(
pnstc
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
/* Adding with NSTCRS_EXPANDED sets the selection */
hr
=
INameSpaceTreeControl_AppendRoot
(
pnstc
,
psitestdir
,
SHCONTF_FOLDERS
|
SHCONTF_NONFOLDERS
,
NSTCRS_EXPANDED
,
NULL
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
process_msgs
();
hr
=
INameSpaceTreeControl_GetItemState
(
pnstc
,
psitestdir
,
0xFF
,
&
istate
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
todo_wine
ok
(
istate
&
NSTCIS_SELECTED
,
"Got 0x%08x
\n
"
,
istate
);
hr
=
INameSpaceTreeControl_GetSelectedItems
(
pnstc
,
&
psia
);
todo_wine
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
IShellItem
*
psi
;
hr
=
IShellItemArray_GetItemAt
(
psia
,
0
,
&
psi
);
if
(
SUCCEEDED
(
hr
))
{
INT
cmp
;
hr
=
IShellItem_Compare
(
psi
,
psitestdir
,
SICHINT_DISPLAY
,
&
cmp
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
IShellItem_Release
(
psi
);
}
IShellItemArray_Release
(
psia
);
}
/* Adding a second root with NSTCRS_EXPANDED does not change the selection */
hr
=
INameSpaceTreeControl_AppendRoot
(
pnstc
,
psitestdir2
,
SHCONTF_FOLDERS
|
SHCONTF_NONFOLDERS
,
NSTCRS_EXPANDED
,
NULL
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
process_msgs
();
hr
=
INameSpaceTreeControl_GetItemState
(
pnstc
,
psitestdir2
,
0xFF
,
&
istate
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
ok
(
!
(
istate
&
NSTCIS_SELECTED
),
"Got 0x%08x
\n
"
,
istate
);
hr
=
INameSpaceTreeControl_GetSelectedItems
(
pnstc
,
&
psia
);
todo_wine
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
IShellItem
*
psi
;
hr
=
IShellItemArray_GetItemAt
(
psia
,
0
,
&
psi
);
if
(
SUCCEEDED
(
hr
))
{
INT
cmp
;
hr
=
IShellItem_Compare
(
psi
,
psitestdir
,
SICHINT_DISPLAY
,
&
cmp
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
IShellItem_Release
(
psi
);
}
IShellItemArray_Release
(
psia
);
}
hr
=
INameSpaceTreeControl_RemoveAllRoots
(
pnstc
);
ok
(
hr
==
S_OK
,
"Got (0x%08x)
\n
"
,
hr
);
IShellItem_Release
(
psidesktop
);
IShellItem_Release
(
psidesktop2
);
IShellItem_Release
(
psitestdir
);
IShellItem_Release
(
psitestdir2
);
IShellItem_Release
(
psitest1
);
hr
=
INameSpaceTreeControl_QueryInterface
(
pnstc
,
&
IID_IOleWindow
,
(
void
**
)
&
pow
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
...
...
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