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
937441b3
Commit
937441b3
authored
Sep 07, 2005
by
Michael Jung
Committed by
Alexandre Julliard
Sep 07, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't clone pidlLast in SHBindToParent.
parent
908e9e88
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
34 deletions
+32
-34
pidl.c
dlls/shell32/pidl.c
+17
-31
shlfolder.c
dlls/shell32/tests/shlfolder.c
+15
-3
No files found.
dlls/shell32/pidl.c
View file @
937441b3
...
...
@@ -1278,55 +1278,41 @@ BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
*/
HRESULT
WINAPI
SHBindToParent
(
LPCITEMIDLIST
pidl
,
REFIID
riid
,
LPVOID
*
ppv
,
LPCITEMIDLIST
*
ppidlLast
)
{
IShellFolder
*
psf
;
LPITEMIDLIST
pidlChild
,
pidlParent
;
IShellFolder
*
psfDesktop
;
HRESULT
hr
=
E_FAIL
;
TRACE_
(
shell
)(
"pidl=%p
\n
"
,
pidl
);
pdump
(
pidl
);
if
(
!
pidl
||
!
ppv
)
return
E_INVALIDARG
;
*
ppv
=
NULL
;
if
(
ppidlLast
)
*
ppidlLast
=
NULL
;
hr
=
SHGetDesktopFolder
(
&
psfDesktop
);
if
(
FAILED
(
hr
))
return
hr
;
if
(
_ILIsPidlSimple
(
pidl
))
{
IShellFolder
*
desktop
;
/* we are on desktop level */
hr
=
SHGetDesktopFolder
(
&
desktop
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IShellFolder_QueryInterface
(
desktop
,
riid
,
ppv
);
if
(
SUCCEEDED
(
hr
)
&&
ppidlLast
)
*
ppidlLast
=
ILClone
(
pidl
);
IShellFolder_Release
(
desktop
);
}
hr
=
IShellFolder_QueryInterface
(
psfDesktop
,
riid
,
ppv
);
}
else
{
pidlChild
=
ILClone
(
ILFindLastID
(
pidl
));
pidlParent
=
ILClone
(
pidl
);
LPITEMIDLIST
pidlParent
=
ILClone
(
pidl
);
ILRemoveLastID
(
pidlParent
);
hr
=
SHGetDesktopFolder
(
&
psf
);
if
(
SUCCEEDED
(
hr
))
hr
=
IShellFolder_BindToObject
(
psf
,
pidlParent
,
NULL
,
riid
,
ppv
);
if
(
SUCCEEDED
(
hr
)
&&
ppidlLast
)
*
ppidlLast
=
pidlChild
;
else
ILFree
(
pidlChild
);
hr
=
IShellFolder_BindToObject
(
psfDesktop
,
pidlParent
,
NULL
,
riid
,
ppv
);
SHFree
(
pidlParent
);
if
(
psf
)
IShellFolder_Release
(
psf
);
}
IShellFolder_Release
(
psfDesktop
);
if
(
SUCCEEDED
(
hr
)
&&
ppidlLast
)
*
ppidlLast
=
ILFindLastID
(
pidl
);
TRACE_
(
shell
)(
"-- psf=%p pidl=%p ret=0x%08lx
\n
"
,
*
ppv
,
(
ppidlLast
)
?*
ppidlLast
:
NULL
,
hr
);
return
hr
;
}
...
...
dlls/shell32/tests/shlfolder.c
View file @
937441b3
...
...
@@ -304,7 +304,8 @@ static void test_GetDisplayName(void)
STRRET
strret
;
LPSHELLFOLDER
psfDesktop
,
psfPersonal
;
IUnknown
*
psfFile
;
LPITEMIDLIST
pidlTestFile
;
SHITEMID
emptyitem
=
{
0
,
{
0
}
};
LPITEMIDLIST
pidlTestFile
,
pidlEmpty
=
(
LPITEMIDLIST
)
&
emptyitem
;
LPCITEMIDLIST
pidlLast
;
static
const
WCHAR
wszFileName
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
't'
,
'e'
,
's'
,
't'
,
'.'
,
'f'
,
'o'
,
'o'
,
0
};
static
const
WCHAR
wszDirName
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
't'
,
'e'
,
's'
,
't'
,
0
};
...
...
@@ -372,6 +373,17 @@ static void test_GetDisplayName(void)
if
(
!
pSHBindToParent
)
return
;
/* SHBindToParent fails, if called with a NULL PIDL. */
hr
=
pSHBindToParent
(
NULL
,
&
IID_IShellFolder
,
(
VOID
**
)
&
psfPersonal
,
&
pidlLast
);
ok
(
FAILED
(
hr
),
"SHBindToParent(NULL) should fail!
\n
"
);
/* But it succeeds with an empty PIDL. */
hr
=
pSHBindToParent
(
pidlEmpty
,
&
IID_IShellFolder
,
(
VOID
**
)
&
psfPersonal
,
&
pidlLast
);
ok
(
SUCCEEDED
(
hr
),
"SHBindToParent(empty PIDL) should succeed! hr = %08lx
\n
"
,
hr
);
ok
(
pidlLast
==
pidlEmpty
,
"The last element of an empty PIDL should be the PIDL itself!
\n
"
);
if
(
SUCCEEDED
(
hr
))
IShellFolder_Release
(
psfPersonal
);
/* Binding to the folder and querying the display name of the file also works. */
hr
=
pSHBindToParent
(
pidlTestFile
,
&
IID_IShellFolder
,
(
VOID
**
)
&
psfPersonal
,
&
pidlLast
);
ok
(
SUCCEEDED
(
hr
),
"SHBindToParent failed! hr = %08lx
\n
"
,
hr
);
...
...
@@ -382,8 +394,8 @@ static void test_GetDisplayName(void)
/* This test shows that Windows doesn't allocate a new pidlLast, but returns a pointer into
* pidlTestFile (In accordance with MSDN). */
todo_wine
{
ok
(
pILFindLastID
(
pidlTestFile
)
==
pidlLast
,
"SHBindToParent doesn't return the last id of the pidl param!
\n
"
);
}
ok
(
pILFindLastID
(
pidlTestFile
)
==
pidlLast
,
"SHBindToParent doesn't return the last id of the pidl param!
\n
"
);
hr
=
IShellFolder_GetDisplayNameOf
(
psfPersonal
,
pidlLast
,
SHGDN_FORPARSING
,
&
strret
);
ok
(
SUCCEEDED
(
hr
),
"Personal->GetDisplayNameOf failed! hr = %08lx
\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