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
114975d9
Commit
114975d9
authored
Jun 25, 2005
by
Michael Jung
Committed by
Alexandre Julliard
Jun 25, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a lurking infinite loop in SHGetPathFromIDList.
parent
41a97576
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
28 deletions
+40
-28
shlfolder.c
dlls/shell32/shlfolder.c
+40
-28
No files found.
dlls/shell32/shlfolder.c
View file @
114975d9
...
...
@@ -70,14 +70,26 @@ static const WCHAR wszDotShellClassInfo[] = {
* TRUE if returned non-NULL value.
* FALSE otherwise.
*/
BOOL
SHELL32_GetCustomFolderAttribute
(
LP
CITEMIDLIST
pidl
,
LPCWSTR
pwszHeading
,
LPCWSTR
pwszAttribute
,
static
inline
BOOL
SHELL32_GetCustomFolderAttributeFromPath
(
LP
WSTR
pwszFolderPath
,
LPCWSTR
pwszHeading
,
LPCWSTR
pwszAttribute
,
LPWSTR
pwszValue
,
DWORD
cchValue
)
{
static
const
WCHAR
wszDesktopIni
[]
=
{
'd'
,
'e'
,
's'
,
'k'
,
't'
,
'o'
,
'p'
,
'.'
,
'i'
,
'n'
,
'i'
,
0
};
static
const
WCHAR
wszDefault
[]
=
{
0
};
PathAddBackslashW
(
pwszFolderPath
);
PathAppendW
(
pwszFolderPath
,
wszDesktopIni
);
return
GetPrivateProfileStringW
(
pwszHeading
,
pwszAttribute
,
wszDefault
,
pwszValue
,
cchValue
,
pwszFolderPath
);
}
BOOL
SHELL32_GetCustomFolderAttribute
(
LPCITEMIDLIST
pidl
,
LPCWSTR
pwszHeading
,
LPCWSTR
pwszAttribute
,
LPWSTR
pwszValue
,
DWORD
cchValue
)
{
DWORD
dwAttrib
=
FILE_ATTRIBUTE_SYSTEM
;
WCHAR
wszFolderPath
[
MAX_PATH
];
/* Hack around not having system attribute on non-Windows file systems */
if
(
0
)
...
...
@@ -85,20 +97,15 @@ BOOL SHELL32_GetCustomFolderAttribute(
if
(
dwAttrib
&
FILE_ATTRIBUTE_SYSTEM
)
{
DWORD
ret
;
WCHAR
wszDesktopIniPath
[
MAX_PATH
];
if
(
!
SHGetPathFromIDListW
(
pidl
,
wszDesktopIniPath
))
if
(
!
SHGetPathFromIDListW
(
pidl
,
wszFolderPath
))
return
FALSE
;
PathAppendW
(
wszDesktopIniPath
,
wszDesktopIni
);
ret
=
GetPrivateProfileStringW
(
pwszHeading
,
pwszAttribute
,
wszDefault
,
pwszValue
,
cchValue
,
wszDesktopIniPath
);
return
ret
;
return
SHELL32_GetCustomFolderAttributeFromPath
(
wszFolderPath
,
pwszHeading
,
pwszAttribute
,
pwszValue
,
cchValue
);
}
return
FALSE
;
}
/***************************************************************************
* GetNextElement (internal function)
*
...
...
@@ -256,7 +263,7 @@ HRESULT SHELL32_CoCreateInitSF (LPCITEMIDLIST pidlRoot, LPCSTR pathRoot,
* means you probably can't use it for your IShellFolder implementation.
*/
HRESULT
SHELL32_BindToChild
(
LPCITEMIDLIST
pidlRoot
,
LPCSTR
pathRoot
,
LPCITEMIDLIST
pidlComplete
,
REFIID
riid
,
LPVOID
*
ppvOut
)
LPCSTR
pathRoot
,
LPCITEMIDLIST
pidlComplete
,
REFIID
riid
,
LPVOID
*
ppvOut
)
{
GUID
const
*
clsid
;
IShellFolder
*
pSF
;
...
...
@@ -264,40 +271,45 @@ HRESULT SHELL32_BindToChild (LPCITEMIDLIST pidlRoot,
LPITEMIDLIST
pidlChild
;
if
(
!
pidlRoot
||
!
ppvOut
||
!
pidlComplete
||
!
pidlComplete
->
mkid
.
cb
)
return
E_INVALIDARG
;
return
E_INVALIDARG
;
*
ppvOut
=
NULL
;
pidlChild
=
ILCloneFirst
(
pidlComplete
);
if
((
clsid
=
_ILGetGUIDPointer
(
pidlChild
)))
{
/* virtual folder */
hr
=
SHELL32_CoCreateInitSF
(
pidlRoot
,
pathRoot
,
pidlChild
,
clsid
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
pSF
);
/* virtual folder */
hr
=
SHELL32_CoCreateInitSF
(
pidlRoot
,
pathRoot
,
pidlChild
,
clsid
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
pSF
);
}
else
{
/* file system folder */
CLSID
clsidFolder
=
CLSID_ShellFSFolder
;
static
const
WCHAR
wszCLSID
[]
=
{
'C'
,
'L'
,
'S'
,
'I'
,
'D'
,
0
};
WCHAR
wszCLSIDValue
[
CHARS_IN_GUID
];
LPITEMIDLIST
pidlAbsolute
=
ILCombine
(
pidlRoot
,
pidlChild
);
WCHAR
wszCLSIDValue
[
CHARS_IN_GUID
]
,
wszFolderPath
[
MAX_PATH
],
*
pwszPathTail
=
wszFolderPath
;
/* see if folder CLSID should be overridden by desktop.ini file */
if
(
SHELL32_GetCustomFolderAttribute
(
pidlAbsolute
,
if
(
pathRoot
)
{
MultiByteToWideChar
(
CP_ACP
,
0
,
pathRoot
,
-
1
,
wszFolderPath
,
MAX_PATH
);
pwszPathTail
=
PathAddBackslashW
(
wszFolderPath
);
}
MultiByteToWideChar
(
CP_ACP
,
0
,
_ILGetTextPointer
(
pidlChild
),
-
1
,
pwszPathTail
,
MAX_PATH
);
if
(
SHELL32_GetCustomFolderAttributeFromPath
(
wszFolderPath
,
wszDotShellClassInfo
,
wszCLSID
,
wszCLSIDValue
,
CHARS_IN_GUID
))
CLSIDFromString
(
wszCLSIDValue
,
&
clsidFolder
);
ILFree
(
pidlAbsolute
);
hr
=
SHELL32_CoCreateInitSF
(
pidlRoot
,
pathRoot
,
pidlChild
,
hr
=
SHELL32_CoCreateInitSF
(
pidlRoot
,
pathRoot
,
pidlChild
,
&
clsidFolder
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
pSF
);
}
ILFree
(
pidlChild
);
if
(
SUCCEEDED
(
hr
))
{
if
(
_ILIsPidlSimple
(
pidlComplete
))
{
/* no sub folders */
hr
=
IShellFolder_QueryInterface
(
pSF
,
riid
,
ppvOut
);
}
else
{
/* go deeper */
hr
=
IShellFolder_BindToObject
(
pSF
,
ILGetNext
(
pidlComplete
),
NULL
,
riid
,
ppvOut
);
}
IShellFolder_Release
(
pSF
);
if
(
_ILIsPidlSimple
(
pidlComplete
))
{
/* no sub folders */
hr
=
IShellFolder_QueryInterface
(
pSF
,
riid
,
ppvOut
);
}
else
{
/* go deeper */
hr
=
IShellFolder_BindToObject
(
pSF
,
ILGetNext
(
pidlComplete
),
NULL
,
riid
,
ppvOut
);
}
IShellFolder_Release
(
pSF
);
}
TRACE
(
"-- returning (%p) %08lx
\n
"
,
*
ppvOut
,
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