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
19b1a95e
Commit
19b1a95e
authored
Apr 08, 2004
by
Juan Lang
Committed by
Alexandre Julliard
Apr 08, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- move CreateMyCompEnumList and CreateDesktopEnumList to their
respective files - rewrite CreateFolderEnumList to only FindFirstFile/FindNextFile once
parent
b0047713
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
149 additions
and
206 deletions
+149
-206
enumidlist.c
dlls/shell32/enumidlist.c
+25
-194
enumidlist.h
dlls/shell32/enumidlist.h
+6
-9
shfldr_desktop.c
dlls/shell32/shfldr_desktop.c
+56
-1
shfldr_fs.c
dlls/shell32/shfldr_fs.c
+3
-1
shfldr_mycomp.c
dlls/shell32/shfldr_mycomp.c
+59
-1
No files found.
dlls/shell32/enumidlist.c
View file @
19b1a95e
...
@@ -102,19 +102,18 @@ BOOL AddToEnumList(
...
@@ -102,19 +102,18 @@ BOOL AddToEnumList(
/**************************************************************************
/**************************************************************************
* CreateFolderEnumList()
* CreateFolderEnumList()
*/
*/
static
BOOL
CreateFolderEnumList
(
BOOL
CreateFolderEnumList
(
IEnumIDList
*
iface
,
IEnumIDList
*
list
,
LPCSTR
lpszPath
,
LPCSTR
lpszPath
,
DWORD
dwFlags
)
DWORD
dwFlags
)
{
{
ICOM_THIS
(
IEnumIDListImpl
,
iface
);
LPITEMIDLIST
pidl
=
NULL
;
LPITEMIDLIST
pidl
=
NULL
;
WIN32_FIND_DATAA
stffile
;
WIN32_FIND_DATAA
stffile
;
HANDLE
hFile
;
HANDLE
hFile
;
CHAR
szPath
[
MAX_PATH
];
CHAR
szPath
[
MAX_PATH
];
BOOL
succeeded
=
TRUE
;
TRACE
(
"(%p)->(path=%s flags=0x%08lx)
\n
"
,
This
,
debugstr_a
(
lpszPath
),
dwFlags
);
TRACE
(
"(%p)->(path=%s flags=0x%08lx)
\n
"
,
list
,
debugstr_a
(
lpszPath
),
dwFlags
);
if
(
!
lpszPath
||
!
lpszPath
[
0
])
return
FALSE
;
if
(
!
lpszPath
||
!
lpszPath
[
0
])
return
FALSE
;
...
@@ -122,172 +121,44 @@ static BOOL CreateFolderEnumList(
...
@@ -122,172 +121,44 @@ static BOOL CreateFolderEnumList(
PathAddBackslashA
(
szPath
);
PathAddBackslashA
(
szPath
);
strcat
(
szPath
,
"*.*"
);
strcat
(
szPath
,
"*.*"
);
/*enumerate the folders*/
if
(
dwFlags
&
SHCONTF_FOLDERS
)
{
TRACE
(
"-- (%p)-> enumerate SHCONTF_FOLDERS of %s
\n
"
,
This
,
debugstr_a
(
szPath
));
hFile
=
FindFirstFileA
(
szPath
,
&
stffile
);
hFile
=
FindFirstFileA
(
szPath
,
&
stffile
);
if
(
hFile
!=
INVALID_HANDLE_VALUE
)
if
(
hFile
!=
INVALID_HANDLE_VALUE
)
{
{
do
BOOL
findFinished
=
FALSE
;
{
if
(
!
(
dwFlags
&
SHCONTF_INCLUDEHIDDEN
)
&&
(
stffile
.
dwFileAttributes
&
FILE_ATTRIBUTE_HIDDEN
)
)
continue
;
if
(
(
stffile
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
&&
strcmp
(
stffile
.
cFileName
,
"."
)
&&
strcmp
(
stffile
.
cFileName
,
".."
))
{
pidl
=
_ILCreateFromFindDataA
(
&
stffile
);
if
(
pidl
&&
AddToEnumList
((
IEnumIDList
*
)
This
,
pidl
))
{
continue
;
}
return
FALSE
;
}
}
while
(
FindNextFileA
(
hFile
,
&
stffile
));
FindClose
(
hFile
);
}
}
/*enumerate the non-folder items (values) */
if
(
dwFlags
&
SHCONTF_NONFOLDERS
)
{
TRACE
(
"-- (%p)-> enumerate SHCONTF_NONFOLDERS of %s
\n
"
,
This
,
debugstr_a
(
szPath
));
hFile
=
FindFirstFileA
(
szPath
,
&
stffile
);
if
(
hFile
!=
INVALID_HANDLE_VALUE
)
{
do
do
{
{
if
(
!
(
dwFlags
&
SHCONTF_INCLUDEHIDDEN
)
&&
(
stffile
.
dwFileAttributes
&
FILE_ATTRIBUTE_HIDDEN
)
)
continue
;
if
(
!
(
stffile
.
dwFileAttributes
&
FILE_ATTRIBUTE_HIDDEN
)
if
(
!
(
stffile
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
)
||
(
dwFlags
&
SHCONTF_INCLUDEHIDDEN
)
)
{
pidl
=
_ILCreateFromFindDataA
(
&
stffile
);
if
(
pidl
&&
AddToEnumList
((
IEnumIDList
*
)
This
,
pidl
))
{
continue
;
}
return
FALSE
;
}
}
while
(
FindNextFileA
(
hFile
,
&
stffile
));
FindClose
(
hFile
);
}
}
return
TRUE
;
}
/**************************************************************************
* CreateDesktopEnumList()
*/
static
BOOL
CreateDesktopEnumList
(
IEnumIDList
*
iface
,
DWORD
dwFlags
)
{
ICOM_THIS
(
IEnumIDListImpl
,
iface
);
LPITEMIDLIST
pidl
=
NULL
;
HKEY
hkey
;
char
szPath
[
MAX_PATH
];
TRACE
(
"(%p)->(flags=0x%08lx)
\n
"
,
This
,
dwFlags
);
/*enumerate the root folders */
if
(
dwFlags
&
SHCONTF_FOLDERS
)
{
/*create the pidl for This item */
pidl
=
_ILCreateMyComputer
();
if
(
pidl
)
{
{
if
(
!
AddToEnumList
((
IEnumIDList
*
)
This
,
pidl
))
if
(
(
stffile
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
&&
return
FALSE
;
dwFlags
&
SHCONTF_FOLDERS
&&
}
strcmp
(
stffile
.
cFileName
,
"."
)
&&
strcmp
(
stffile
.
cFileName
,
".."
))
if
(
!
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
"SOFTWARE
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
explorer
\\
desktop
\\
NameSpace"
,
0
,
KEY_READ
,
&
hkey
))
{
{
char
iid
[
50
];
pidl
=
_ILCreateFromFindDataA
(
&
stffile
);
int
i
=
0
;
succeeded
=
succeeded
&&
AddToEnumList
(
list
,
pidl
);
while
(
1
)
{
DWORD
size
=
sizeof
(
iid
);
if
(
ERROR_SUCCESS
!=
RegEnumKeyExA
(
hkey
,
i
,
iid
,
&
size
,
0
,
NULL
,
NULL
,
NULL
))
break
;
pidl
=
_ILCreateGuidFromStrA
(
iid
);
if
(
pidl
)
AddToEnumList
((
IEnumIDList
*
)
This
,
pidl
);
i
++
;
}
RegCloseKey
(
hkey
);
}
}
}
else
if
(
!
(
stffile
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
/*enumerate the elements in %windir%\desktop */
&&
dwFlags
&
SHCONTF_NONFOLDERS
)
SHGetSpecialFolderPathA
(
0
,
szPath
,
CSIDL_DESKTOPDIRECTORY
,
FALSE
);
CreateFolderEnumList
(
(
IEnumIDList
*
)
This
,
szPath
,
dwFlags
);
return
TRUE
;
}
/**************************************************************************
* CreateMyCompEnumList()
*/
static
BOOL
CreateMyCompEnumList
(
IEnumIDList
*
iface
,
DWORD
dwFlags
)
{
ICOM_THIS
(
IEnumIDListImpl
,
iface
);
LPITEMIDLIST
pidl
=
NULL
;
DWORD
dwDrivemap
;
CHAR
szDriveName
[
4
];
HKEY
hkey
;
TRACE
(
"(%p)->(flags=0x%08lx)
\n
"
,
This
,
dwFlags
);
/*enumerate the folders*/
if
(
dwFlags
&
SHCONTF_FOLDERS
)
{
dwDrivemap
=
GetLogicalDrives
();
strcpy
(
szDriveName
,
"A:
\\
"
);
while
(
szDriveName
[
0
]
<=
'Z'
)
{
if
(
dwDrivemap
&
0x00000001L
)
{
{
pidl
=
_ILCreateDrive
(
szDriveName
);
pidl
=
_ILCreateFromFindDataA
(
&
stffile
);
if
(
pidl
)
succeeded
=
succeeded
&&
AddToEnumList
(
list
,
pidl
);
{
if
(
!
AddToEnumList
((
IEnumIDList
*
)
This
,
pidl
))
return
FALSE
;
}
}
}
szDriveName
[
0
]
++
;
dwDrivemap
=
dwDrivemap
>>
1
;
}
}
if
(
succeeded
)
TRACE
(
"-- (%p)-> enumerate (mycomputer shell extensions)
\n
"
,
This
);
if
(
!
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
"SOFTWARE
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
explorer
\\
mycomputer
\\
NameSpace"
,
0
,
KEY_READ
,
&
hkey
))
{
{
char
iid
[
50
];
if
(
!
FindNextFileA
(
hFile
,
&
stffile
))
int
i
=
0
;
while
(
1
)
{
{
DWORD
size
=
sizeof
(
iid
);
if
(
GetLastError
()
==
ERROR_NO_MORE_FILES
)
findFinished
=
TRUE
;
if
(
ERROR_SUCCESS
!=
RegEnumKeyExA
(
hkey
,
i
,
iid
,
&
size
,
0
,
NULL
,
NULL
,
NULL
))
else
break
;
succeeded
=
FALSE
;
pidl
=
_ILCreateGuidFromStrA
(
iid
);
if
(
pidl
)
AddToEnumList
((
IEnumIDList
*
)
This
,
pidl
);
i
++
;
}
}
RegCloseKey
(
hkey
);
}
}
}
while
(
succeeded
&&
!
findFinished
);
FindClose
(
hFile
);
}
}
return
TRUE
;
return
succeeded
;
}
}
/**************************************************************************
/**************************************************************************
...
@@ -332,46 +203,6 @@ IEnumIDList * IEnumIDList_Constructor(void)
...
@@ -332,46 +203,6 @@ IEnumIDList * IEnumIDList_Constructor(void)
return
(
IEnumIDList
*
)
lpeidl
;
return
(
IEnumIDList
*
)
lpeidl
;
}
}
IEnumIDList
*
IEnumIDList_BadConstructor
(
LPCSTR
lpszPath
,
DWORD
dwFlags
,
DWORD
dwKind
)
{
IEnumIDListImpl
*
lpeidl
;
BOOL
ret
=
FALSE
;
TRACE
(
"()->(%s flags=0x%08lx kind=0x%08lx)
\n
"
,
debugstr_a
(
lpszPath
),
dwFlags
,
dwKind
);
lpeidl
=
(
IEnumIDListImpl
*
)
IEnumIDList_Constructor
();
if
(
lpeidl
)
{
switch
(
dwKind
)
{
case
EIDL_DESK
:
ret
=
CreateDesktopEnumList
((
IEnumIDList
*
)
lpeidl
,
dwFlags
);
break
;
case
EIDL_MYCOMP
:
ret
=
CreateMyCompEnumList
((
IEnumIDList
*
)
lpeidl
,
dwFlags
);
break
;
case
EIDL_FILE
:
ret
=
CreateFolderEnumList
((
IEnumIDList
*
)
lpeidl
,
lpszPath
,
dwFlags
);
break
;
}
if
(
!
ret
)
{
HeapFree
(
GetProcessHeap
(),
0
,
lpeidl
);
lpeidl
=
NULL
;
}
}
TRACE
(
"-- (%p)->()
\n
"
,
lpeidl
);
return
(
IEnumIDList
*
)
lpeidl
;
}
/**************************************************************************
/**************************************************************************
* EnumIDList_QueryInterface
* EnumIDList_QueryInterface
*/
*/
...
...
dlls/shell32/enumidlist.h
View file @
19b1a95e
...
@@ -18,16 +18,13 @@
...
@@ -18,16 +18,13 @@
#include "shlobj.h"
#include "shlobj.h"
/* Creates an IEnumIDList; add LPITEMIDLISTs to it with AddToEnumList. */
LPENUMIDLIST
IEnumIDList_Constructor
(
void
);
LPENUMIDLIST
IEnumIDList_Constructor
(
void
);
BOOL
AddToEnumList
(
IEnumIDList
*
iface
,
LPITEMIDLIST
pidl
);
BOOL
AddToEnumList
(
IEnumIDList
*
list
,
LPITEMIDLIST
pidl
);
/* old interface that's going away soon: */
/* Enumerates the folders and/or files (depending on dwFlags) in lpszPath and
/* kind of enumidlist */
* adds them to the already-created list.
#define EIDL_DESK 0
*/
#define EIDL_MYCOMP 1
BOOL
CreateFolderEnumList
(
IEnumIDList
*
list
,
LPCSTR
lpszPath
,
DWORD
dwFlags
);
#define EIDL_FILE 2
IEnumIDList
*
IEnumIDList_BadConstructor
(
LPCSTR
lpszPath
,
DWORD
dwFlags
,
DWORD
dwKind
);
#endif
/* ndef __ENUMIDLIST_H__ */
#endif
/* ndef __ENUMIDLIST_H__ */
dlls/shell32/shfldr_desktop.c
View file @
19b1a95e
...
@@ -261,6 +261,59 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
...
@@ -261,6 +261,59 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
}
}
/**************************************************************************
/**************************************************************************
* CreateDesktopEnumList()
*/
static
BOOL
CreateDesktopEnumList
(
IEnumIDList
*
list
,
DWORD
dwFlags
)
{
BOOL
ret
=
TRUE
;
char
szPath
[
MAX_PATH
];
TRACE
(
"(%p)->(flags=0x%08lx)
\n
"
,
list
,
dwFlags
);
/*enumerate the root folders */
if
(
dwFlags
&
SHCONTF_FOLDERS
)
{
HKEY
hkey
;
/*create the pidl for This item */
ret
=
AddToEnumList
(
list
,
_ILCreateMyComputer
());
if
(
ret
&&
!
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
"SOFTWARE
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
explorer
\\
desktop
\\
NameSpace"
,
0
,
KEY_READ
,
&
hkey
))
{
char
iid
[
50
];
int
i
=
0
;
BOOL
moreKeys
=
TRUE
;
while
(
ret
&&
moreKeys
)
{
DWORD
size
=
sizeof
(
iid
);
LONG
apiRet
=
RegEnumKeyExA
(
hkey
,
i
,
iid
,
&
size
,
0
,
NULL
,
NULL
,
NULL
);
if
(
ERROR_SUCCESS
==
apiRet
)
{
ret
=
AddToEnumList
(
list
,
_ILCreateGuidFromStrA
(
iid
));
i
++
;
}
else
if
(
ERROR_NO_MORE_ITEMS
==
apiRet
)
moreKeys
=
FALSE
;
else
ret
=
FALSE
;
}
RegCloseKey
(
hkey
);
}
}
/*enumerate the elements in %windir%\desktop */
SHGetSpecialFolderPathA
(
0
,
szPath
,
CSIDL_DESKTOPDIRECTORY
,
FALSE
);
ret
=
ret
&&
CreateFolderEnumList
(
list
,
szPath
,
dwFlags
);
return
ret
;
}
/**************************************************************************
* ISF_Desktop_fnEnumObjects
* ISF_Desktop_fnEnumObjects
*/
*/
static
HRESULT
WINAPI
ISF_Desktop_fnEnumObjects
(
IShellFolder2
*
iface
,
static
HRESULT
WINAPI
ISF_Desktop_fnEnumObjects
(
IShellFolder2
*
iface
,
...
@@ -270,7 +323,9 @@ static HRESULT WINAPI ISF_Desktop_fnEnumObjects (IShellFolder2 * iface,
...
@@ -270,7 +323,9 @@ static HRESULT WINAPI ISF_Desktop_fnEnumObjects (IShellFolder2 * iface,
TRACE
(
"(%p)->(HWND=%p flags=0x%08lx pplist=%p)
\n
"
,
This
,
hwndOwner
,
dwFlags
,
ppEnumIDList
);
TRACE
(
"(%p)->(HWND=%p flags=0x%08lx pplist=%p)
\n
"
,
This
,
hwndOwner
,
dwFlags
,
ppEnumIDList
);
*
ppEnumIDList
=
IEnumIDList_BadConstructor
(
NULL
,
dwFlags
,
EIDL_DESK
);
*
ppEnumIDList
=
IEnumIDList_Constructor
();
if
(
*
ppEnumIDList
)
CreateDesktopEnumList
(
*
ppEnumIDList
,
dwFlags
);
TRACE
(
"-- (%p)->(new ID List: %p)
\n
"
,
This
,
*
ppEnumIDList
);
TRACE
(
"-- (%p)->(new ID List: %p)
\n
"
,
This
,
*
ppEnumIDList
);
...
...
dlls/shell32/shfldr_fs.c
View file @
19b1a95e
...
@@ -392,7 +392,9 @@ IShellFolder_fnEnumObjects (IShellFolder2 * iface, HWND hwndOwner, DWORD dwFlags
...
@@ -392,7 +392,9 @@ IShellFolder_fnEnumObjects (IShellFolder2 * iface, HWND hwndOwner, DWORD dwFlags
TRACE
(
"(%p)->(HWND=%p flags=0x%08lx pplist=%p)
\n
"
,
This
,
hwndOwner
,
dwFlags
,
ppEnumIDList
);
TRACE
(
"(%p)->(HWND=%p flags=0x%08lx pplist=%p)
\n
"
,
This
,
hwndOwner
,
dwFlags
,
ppEnumIDList
);
*
ppEnumIDList
=
IEnumIDList_BadConstructor
(
This
->
sPathTarget
,
dwFlags
,
EIDL_FILE
);
*
ppEnumIDList
=
IEnumIDList_Constructor
();
if
(
*
ppEnumIDList
)
CreateFolderEnumList
(
*
ppEnumIDList
,
This
->
sPathTarget
,
dwFlags
);
TRACE
(
"-- (%p)->(new ID List: %p)
\n
"
,
This
,
*
ppEnumIDList
);
TRACE
(
"-- (%p)->(new ID List: %p)
\n
"
,
This
,
*
ppEnumIDList
);
...
...
dlls/shell32/shfldr_mycomp.c
View file @
19b1a95e
...
@@ -238,6 +238,62 @@ ISF_MyComputer_fnParseDisplayName (IShellFolder2 * iface,
...
@@ -238,6 +238,62 @@ ISF_MyComputer_fnParseDisplayName (IShellFolder2 * iface,
}
}
/**************************************************************************
/**************************************************************************
* CreateMyCompEnumList()
*/
static
BOOL
CreateMyCompEnumList
(
IEnumIDList
*
list
,
DWORD
dwFlags
)
{
BOOL
ret
=
TRUE
;
TRACE
(
"(%p)->(flags=0x%08lx)
\n
"
,
list
,
dwFlags
);
/*enumerate the folders*/
if
(
dwFlags
&
SHCONTF_FOLDERS
)
{
CHAR
szDriveName
[]
=
"A:
\\
"
;
DWORD
dwDrivemap
=
GetLogicalDrives
();
HKEY
hkey
;
while
(
ret
&&
szDriveName
[
0
]
<=
'Z'
)
{
if
(
dwDrivemap
&
0x00000001L
)
ret
=
AddToEnumList
(
list
,
_ILCreateDrive
(
szDriveName
));
szDriveName
[
0
]
++
;
dwDrivemap
=
dwDrivemap
>>
1
;
}
TRACE
(
"-- (%p)-> enumerate (mycomputer shell extensions)
\n
"
,
list
);
if
(
ret
&&
!
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
"SOFTWARE
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
explorer
\\
mycomputer
\\
NameSpace"
,
0
,
KEY_READ
,
&
hkey
))
{
char
iid
[
50
];
int
i
=
0
;
while
(
ret
)
{
DWORD
size
=
sizeof
(
iid
);
LONG
apiRet
=
RegEnumKeyExA
(
hkey
,
i
,
iid
,
&
size
,
0
,
NULL
,
NULL
,
NULL
);
if
(
ERROR_SUCCESS
==
apiRet
)
{
/* FIXME: shell extensions, shouldn't the type be
* PT_SHELLEXT? */
ret
=
AddToEnumList
(
list
,
_ILCreateGuidFromStrA
(
iid
));
i
++
;
}
else
if
(
ERROR_NO_MORE_ITEMS
==
apiRet
)
break
;
else
ret
=
FALSE
;
}
RegCloseKey
(
hkey
);
}
}
return
ret
;
}
/**************************************************************************
* ISF_MyComputer_fnEnumObjects
* ISF_MyComputer_fnEnumObjects
*/
*/
static
HRESULT
WINAPI
static
HRESULT
WINAPI
...
@@ -247,7 +303,9 @@ ISF_MyComputer_fnEnumObjects (IShellFolder2 * iface, HWND hwndOwner, DWORD dwFla
...
@@ -247,7 +303,9 @@ ISF_MyComputer_fnEnumObjects (IShellFolder2 * iface, HWND hwndOwner, DWORD dwFla
TRACE
(
"(%p)->(HWND=%p flags=0x%08lx pplist=%p)
\n
"
,
This
,
hwndOwner
,
dwFlags
,
ppEnumIDList
);
TRACE
(
"(%p)->(HWND=%p flags=0x%08lx pplist=%p)
\n
"
,
This
,
hwndOwner
,
dwFlags
,
ppEnumIDList
);
*
ppEnumIDList
=
IEnumIDList_BadConstructor
(
NULL
,
dwFlags
,
EIDL_MYCOMP
);
*
ppEnumIDList
=
IEnumIDList_Constructor
();
if
(
*
ppEnumIDList
)
CreateMyCompEnumList
(
*
ppEnumIDList
,
dwFlags
);
TRACE
(
"-- (%p)->(new ID List: %p)
\n
"
,
This
,
*
ppEnumIDList
);
TRACE
(
"-- (%p)->(new ID List: %p)
\n
"
,
This
,
*
ppEnumIDList
);
...
...
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