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
ebb1aaee
Commit
ebb1aaee
authored
Jun 15, 2005
by
Michael Jung
Committed by
Alexandre Julliard
Jun 15, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement SHGetPathFromIDList based on GetDisplayNameOf.
parent
7691aca1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
177 deletions
+22
-177
pidl.c
dlls/shell32/pidl.c
+22
-174
pidl.h
dlls/shell32/pidl.h
+0
-3
No files found.
dlls/shell32/pidl.c
View file @
ebb1aaee
...
...
@@ -1210,87 +1210,6 @@ HRESULT WINAPI SHGetDataFromIDListW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl,
}
/*************************************************************************
* SHELL_GetPathFromIDListA
*/
HRESULT
SHELL_GetPathFromIDListA
(
LPCITEMIDLIST
pidl
,
LPSTR
pszPath
,
UINT
uOutSize
)
{
HRESULT
hr
=
S_OK
;
pszPath
[
0
]
=
0
;
/* One case is a PIDL rooted at desktop level */
if
(
_ILIsDesktop
(
pidl
)
||
_ILIsValue
(
pidl
)
||
_ILIsFolder
(
pidl
))
{
hr
=
SHGetSpecialFolderPathA
(
0
,
pszPath
,
CSIDL_DESKTOP
,
FALSE
);
if
(
SUCCEEDED
(
hr
))
PathAddBackslashA
(
pszPath
);
}
/* The only other valid case is an item ID list beginning at "My Computer" */
else
if
(
_ILIsMyComputer
(
pidl
))
pidl
=
ILGetNext
(
pidl
);
if
(
SUCCEEDED
(
hr
))
{
LPSTR
txt
;
while
(
pidl
&&
pidl
->
mkid
.
cb
)
{
if
(
_ILIsSpecialFolder
(
pidl
))
{
hr
=
E_INVALIDARG
;
break
;
}
txt
=
_ILGetTextPointer
(
pidl
);
if
(
!
txt
)
{
hr
=
E_INVALIDARG
;
break
;
}
if
(
lstrlenA
(
txt
)
>
pidl
->
mkid
.
cb
)
ERR
(
"pidl %p is borked
\n
"
,
pidl
);
/* make sure there's enough space for the next segment */
if
((
lstrlenA
(
txt
)
+
lstrlenA
(
pszPath
))
>
uOutSize
)
{
hr
=
E_INVALIDARG
;
break
;
}
lstrcatA
(
pszPath
,
txt
);
pidl
=
ILGetNext
(
pidl
);
if
(
!
pidl
)
{
hr
=
E_INVALIDARG
;
break
;
}
/* Are we at the end and successfully converted the complete PIDL? */
if
(
!
pidl
->
mkid
.
cb
)
break
;
if
((
lstrlenA
(
pszPath
)
+
1
)
>
uOutSize
)
{
hr
=
E_INVALIDARG
;
break
;
}
if
(
!
PathAddBackslashA
(
pszPath
))
{
hr
=
E_INVALIDARG
;
break
;
}
}
}
else
hr
=
E_INVALIDARG
;
TRACE_
(
shell
)(
"-- %s, 0x%08lx
\n
"
,
pszPath
,
hr
);
return
hr
;
}
/*************************************************************************
* SHGetPathFromIDListA [SHELL32.@][NT 4.0: SHELL32.220]
*
* PARAMETERS
...
...
@@ -1307,100 +1226,14 @@ HRESULT SHELL_GetPathFromIDListA(LPCITEMIDLIST pidl, LPSTR pszPath, UINT uOutSiz
*/
BOOL
WINAPI
SHGetPathFromIDListA
(
LPCITEMIDLIST
pidl
,
LPSTR
pszPath
)
{
HRESULT
hr
;
TRACE_
(
shell
)(
"(pidl=%p,%p)
\n
"
,
pidl
,
pszPath
);
pdump
(
pidl
);
if
(
!
pidl
)
return
FALSE
;
WCHAR
wszPath
[
MAX_PATH
];
BOOL
bSuccess
;
hr
=
SHELL_GetPathFromIDListA
(
pidl
,
pszPath
,
MAX_PATH
);
bSuccess
=
SHGetPathFromIDListW
(
pidl
,
wszPath
);
if
(
bSuccess
)
WideCharToMultiByte
(
CP_ACP
,
0
,
wszPath
,
-
1
,
pszPath
,
MAX_PATH
,
NULL
,
NULL
);
return
SUCCEEDED
(
hr
);
}
/*************************************************************************
* SHELL_GetPathFromIDListW
*/
HRESULT
SHELL_GetPathFromIDListW
(
LPCITEMIDLIST
pidl
,
LPWSTR
pszPath
,
UINT
uOutSize
)
{
HRESULT
hr
=
S_OK
;
UINT
len
;
pszPath
[
0
]
=
0
;
/* One case is a PIDL rooted at desktop level */
if
(
_ILIsDesktop
(
pidl
)
||
_ILIsValue
(
pidl
)
||
_ILIsFolder
(
pidl
))
{
hr
=
SHGetSpecialFolderPathW
(
0
,
pszPath
,
CSIDL_DESKTOP
,
FALSE
);
if
(
SUCCEEDED
(
hr
))
PathAddBackslashW
(
pszPath
);
}
/* The only other valid case is an item ID list beginning at "My Computer" */
else
if
(
_ILIsMyComputer
(
pidl
))
pidl
=
ILGetNext
(
pidl
);
if
(
SUCCEEDED
(
hr
))
{
LPSTR
txt
;
while
(
pidl
&&
pidl
->
mkid
.
cb
)
{
if
(
_ILIsSpecialFolder
(
pidl
))
{
hr
=
E_INVALIDARG
;
break
;
}
txt
=
_ILGetTextPointer
(
pidl
);
if
(
!
txt
)
{
hr
=
E_INVALIDARG
;
break
;
}
if
(
lstrlenA
(
txt
)
>
pidl
->
mkid
.
cb
)
ERR
(
"pidl %p is borked
\n
"
,
pidl
);
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
txt
,
-
1
,
NULL
,
0
);
if
(
(
lstrlenW
(
pszPath
)
+
len
)
>
uOutSize
)
{
hr
=
E_INVALIDARG
;
break
;
}
MultiByteToWideChar
(
CP_ACP
,
0
,
txt
,
-
1
,
&
pszPath
[
lstrlenW
(
pszPath
)],
len
);
pidl
=
ILGetNext
(
pidl
);
if
(
!
pidl
)
{
hr
=
E_INVALIDARG
;
break
;
}
/* Are we at the end and successfully converted the complete PIDL? */
if
(
!
pidl
->
mkid
.
cb
)
break
;
if
((
lstrlenW
(
pszPath
)
+
1
)
>
uOutSize
)
{
hr
=
E_INVALIDARG
;
break
;
}
if
(
!
PathAddBackslashW
(
pszPath
))
{
hr
=
E_INVALIDARG
;
break
;
}
}
}
else
hr
=
E_INVALIDARG
;
TRACE_
(
shell
)(
"-- %s, 0x%08lx
\n
"
,
debugstr_w
(
pszPath
),
hr
);
return
hr
;
return
bSuccess
;
}
/*************************************************************************
...
...
@@ -1409,6 +1242,10 @@ HRESULT SHELL_GetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath, UINT uOutSi
BOOL
WINAPI
SHGetPathFromIDListW
(
LPCITEMIDLIST
pidl
,
LPWSTR
pszPath
)
{
HRESULT
hr
;
LPCITEMIDLIST
pidlLast
;
LPSHELLFOLDER
psfFolder
;
DWORD
dwAttributes
;
STRRET
strret
;
TRACE_
(
shell
)(
"(pidl=%p,%p)
\n
"
,
pidl
,
debugstr_w
(
pszPath
));
pdump
(
pidl
);
...
...
@@ -1416,7 +1253,18 @@ BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
if
(
!
pidl
)
return
FALSE
;
hr
=
SHELL_GetPathFromIDListW
(
pidl
,
pszPath
,
MAX_PATH
);
hr
=
SHBindToParent
(
pidl
,
&
IID_IShellFolder
,
(
VOID
**
)
&
psfFolder
,
&
pidlLast
);
if
(
FAILED
(
hr
))
return
FALSE
;
dwAttributes
=
SFGAO_FILESYSTEM
;
hr
=
IShellFolder_GetAttributesOf
(
psfFolder
,
1
,
&
pidlLast
,
&
dwAttributes
);
if
(
FAILED
(
hr
)
||
!
(
dwAttributes
&
SFGAO_FILESYSTEM
))
return
FALSE
;
hr
=
IShellFolder_GetDisplayNameOf
(
psfFolder
,
pidlLast
,
SHGDN_FORPARSING
,
&
strret
);
if
(
FAILED
(
hr
))
return
FALSE
;
hr
=
StrRetToBufW
(
&
strret
,
pidlLast
,
pszPath
,
MAX_PATH
);
IShellFolder_Release
(
psfFolder
);
TRACE_
(
shell
)(
"-- %s, 0x%08lx
\n
"
,
debugstr_w
(
pszPath
),
hr
);
return
SUCCEEDED
(
hr
);
...
...
dlls/shell32/pidl.h
View file @
ebb1aaee
...
...
@@ -257,7 +257,4 @@ LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST* pidl, LPIDA cida);
BOOL
WINAPI
ILGetDisplayNameExA
(
LPSHELLFOLDER
psf
,
LPCITEMIDLIST
pidl
,
LPSTR
path
,
DWORD
type
);
BOOL
WINAPI
ILGetDisplayNameExW
(
LPSHELLFOLDER
psf
,
LPCITEMIDLIST
pidl
,
LPWSTR
path
,
DWORD
type
);
HRESULT
SHELL_GetPathFromIDListA
(
LPCITEMIDLIST
pidl
,
LPSTR
pszPath
,
UINT
uOutSize
);
HRESULT
SHELL_GetPathFromIDListW
(
LPCITEMIDLIST
pidl
,
LPWSTR
pszPath
,
UINT
uOutSize
);
#endif
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