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
7114f8c3
Commit
7114f8c3
authored
Jan 11, 2006
by
Martin Fuchs
Committed by
Alexandre Julliard
Jan 11, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Fix folder icon index when read from registry.
Change "DWORD dwNr" into "int icon_idx" at several places.
parent
6d88d5ad
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
57 deletions
+62
-57
classes.c
dlls/shell32/classes.c
+29
-29
folders.c
dlls/shell32/folders.c
+20
-15
iconcache.c
dlls/shell32/iconcache.c
+4
-4
shell32_main.c
dlls/shell32/shell32_main.c
+6
-6
shell32_main.h
dlls/shell32/shell32_main.h
+3
-3
No files found.
dlls/shell32/classes.c
View file @
7114f8c3
...
...
@@ -164,31 +164,31 @@ static BOOL HCR_RegOpenClassIDKey(REFIID riid, HKEY *hkey)
return
!
RegOpenKeyExA
(
HKEY_CLASSES_ROOT
,
xriid
,
0
,
KEY_READ
,
hkey
);
}
static
BOOL
HCR_RegGetDefaultIconW
(
HKEY
hkey
,
LPWSTR
szDest
,
DWORD
len
,
LPDWORD
dwNr
)
static
BOOL
HCR_RegGetDefaultIconW
(
HKEY
hkey
,
LPWSTR
szDest
,
DWORD
len
,
int
*
picon_idx
)
{
DWORD
dwType
;
WCHAR
sTemp
[
MAX_PATH
];
WCHAR
sNum
[
5
];
DWORD
dwType
;
WCHAR
sTemp
[
MAX_PATH
];
WCHAR
sNum
[
5
];
if
(
!
RegQueryValueExW
(
hkey
,
NULL
,
0
,
&
dwType
,
(
LPBYTE
)
szDest
,
&
len
))
{
if
(
!
RegQueryValueExW
(
hkey
,
NULL
,
0
,
&
dwType
,
(
LPBYTE
)
szDest
,
&
len
))
{
if
(
dwType
==
REG_EXPAND_SZ
)
{
ExpandEnvironmentStringsW
(
szDest
,
sTemp
,
MAX_PATH
);
lstrcpynW
(
szDest
,
sTemp
,
len
);
}
if
(
ParseFieldW
(
szDest
,
2
,
sNum
,
5
))
*
dwNr
=
atoiW
(
sNum
);
{
ExpandEnvironmentStringsW
(
szDest
,
sTemp
,
MAX_PATH
);
lstrcpynW
(
szDest
,
sTemp
,
len
);
}
if
(
ParseFieldW
(
szDest
,
2
,
sNum
,
5
))
*
picon_idx
=
atoiW
(
sNum
);
else
*
dwNr
=
0
;
/* sometimes the icon number is missing */
ParseFieldW
(
szDest
,
1
,
szDest
,
len
);
*
picon_idx
=
0
;
/* sometimes the icon number is missing */
ParseFieldW
(
szDest
,
1
,
szDest
,
len
);
PathUnquoteSpacesW
(
szDest
);
return
TRUE
;
}
return
FALSE
;
return
TRUE
;
}
return
FALSE
;
}
static
BOOL
HCR_RegGetDefaultIconA
(
HKEY
hkey
,
LPSTR
szDest
,
DWORD
len
,
LPDWORD
dwNr
)
static
BOOL
HCR_RegGetDefaultIconA
(
HKEY
hkey
,
LPSTR
szDest
,
DWORD
len
,
int
*
picon_idx
)
{
DWORD
dwType
;
char
sTemp
[
MAX_PATH
];
...
...
@@ -202,9 +202,9 @@ static BOOL HCR_RegGetDefaultIconA(HKEY hkey, LPSTR szDest, DWORD len, LPDWORD d
lstrcpynA
(
szDest
,
sTemp
,
len
);
}
if
(
ParseFieldA
(
szDest
,
2
,
sNum
,
5
))
*
dwNr
=
atoi
(
sNum
);
*
picon_idx
=
atoi
(
sNum
);
else
*
dwNr
=
0
;
/* sometimes the icon number is missing */
*
picon_idx
=
0
;
/* sometimes the icon number is missing */
ParseFieldA
(
szDest
,
1
,
szDest
,
len
);
PathUnquoteSpacesA
(
szDest
);
return
TRUE
;
...
...
@@ -212,7 +212,7 @@ static BOOL HCR_RegGetDefaultIconA(HKEY hkey, LPSTR szDest, DWORD len, LPDWORD d
return
FALSE
;
}
BOOL
HCR_GetDefaultIconW
(
LPCWSTR
szClass
,
LPWSTR
szDest
,
DWORD
len
,
LPDWORD
dwNr
)
BOOL
HCR_GetDefaultIconW
(
LPCWSTR
szClass
,
LPWSTR
szDest
,
DWORD
len
,
int
*
picon_idx
)
{
static
const
WCHAR
swDefaultIcon
[]
=
{
'\\'
,
'D'
,
'e'
,
'f'
,
'a'
,
'u'
,
'l'
,
't'
,
'I'
,
'c'
,
'o'
,
'n'
,
0
};
HKEY
hkey
;
...
...
@@ -226,19 +226,19 @@ BOOL HCR_GetDefaultIconW(LPCWSTR szClass, LPWSTR szDest, DWORD len, LPDWORD dwNr
if
(
!
RegOpenKeyExW
(
HKEY_CLASSES_ROOT
,
sTemp
,
0
,
0x02000000
,
&
hkey
))
{
ret
=
HCR_RegGetDefaultIconW
(
hkey
,
szDest
,
len
,
dwNr
);
ret
=
HCR_RegGetDefaultIconW
(
hkey
,
szDest
,
len
,
picon_idx
);
RegCloseKey
(
hkey
);
}
if
(
ret
)
TRACE
(
"-- %s %
li
\n
"
,
debugstr_w
(
szDest
),
*
dwNr
);
TRACE
(
"-- %s %
i
\n
"
,
debugstr_w
(
szDest
),
*
picon_idx
);
else
TRACE
(
"-- not found
\n
"
);
return
ret
;
}
BOOL
HCR_GetDefaultIconA
(
LPCSTR
szClass
,
LPSTR
szDest
,
DWORD
len
,
LPDWORD
dwNr
)
BOOL
HCR_GetDefaultIconA
(
LPCSTR
szClass
,
LPSTR
szDest
,
DWORD
len
,
int
*
picon_idx
)
{
HKEY
hkey
;
char
sTemp
[
MAX_PATH
];
...
...
@@ -250,24 +250,24 @@ BOOL HCR_GetDefaultIconA(LPCSTR szClass, LPSTR szDest, DWORD len, LPDWORD dwNr)
if
(
!
RegOpenKeyExA
(
HKEY_CLASSES_ROOT
,
sTemp
,
0
,
0x02000000
,
&
hkey
))
{
ret
=
HCR_RegGetDefaultIconA
(
hkey
,
szDest
,
len
,
dwNr
);
ret
=
HCR_RegGetDefaultIconA
(
hkey
,
szDest
,
len
,
picon_idx
);
RegCloseKey
(
hkey
);
}
TRACE
(
"-- %s %
li
\n
"
,
szDest
,
*
dwNr
);
TRACE
(
"-- %s %
i
\n
"
,
szDest
,
*
picon_idx
);
return
ret
;
}
BOOL
HCR_GetDefaultIconFromGUIDW
(
REFIID
riid
,
LPWSTR
szDest
,
DWORD
len
,
LPDWORD
dwNr
)
BOOL
HCR_GetDefaultIconFromGUIDW
(
REFIID
riid
,
LPWSTR
szDest
,
DWORD
len
,
int
*
picon_idx
)
{
HKEY
hkey
;
BOOL
ret
=
FALSE
;
if
(
HCR_RegOpenClassIDKey
(
riid
,
&
hkey
))
{
ret
=
HCR_RegGetDefaultIconW
(
hkey
,
szDest
,
len
,
dwNr
);
ret
=
HCR_RegGetDefaultIconW
(
hkey
,
szDest
,
len
,
picon_idx
);
RegCloseKey
(
hkey
);
}
TRACE
(
"-- %s %
li
\n
"
,
debugstr_w
(
szDest
),
*
dwNr
);
TRACE
(
"-- %s %
i
\n
"
,
debugstr_w
(
szDest
),
*
picon_idx
);
return
ret
;
}
...
...
dlls/shell32/folders.c
View file @
7114f8c3
...
...
@@ -166,7 +166,7 @@ static HRESULT getIconLocationForFolder(IExtractIconW *iface, UINT uFlags,
LPWSTR
szIconFile
,
UINT
cchMax
,
int
*
piIndex
,
UINT
*
pwFlags
)
{
IExtractIconWImpl
*
This
=
(
IExtractIconWImpl
*
)
iface
;
DWORD
dwNr
;
int
icon_idx
;
WCHAR
wszPath
[
MAX_PATH
];
WCHAR
wszCLSIDValue
[
CHARS_IN_GUID
];
static
const
WCHAR
shellClassInfo
[]
=
{
'.'
,
'S'
,
'h'
,
'e'
,
'l'
,
'l'
,
'C'
,
'l'
,
'a'
,
's'
,
's'
,
'I'
,
'n'
,
'f'
,
'o'
,
0
};
...
...
@@ -185,27 +185,32 @@ static HRESULT getIconLocationForFolder(IExtractIconW *iface, UINT uFlags,
}
else
if
(
SHELL32_GetCustomFolderAttribute
(
This
->
pidl
,
shellClassInfo
,
clsid
,
wszCLSIDValue
,
CHARS_IN_GUID
)
&&
HCR_GetDefaultIconW
(
wszCLSIDValue
,
szIconFile
,
cchMax
,
&
dwNr
))
HCR_GetDefaultIconW
(
wszCLSIDValue
,
szIconFile
,
cchMax
,
&
icon_idx
))
{
*
piIndex
=
dwNr
;
*
piIndex
=
icon_idx
;
}
else
if
(
SHELL32_GetCustomFolderAttribute
(
This
->
pidl
,
shellClassInfo
,
clsid2
,
wszCLSIDValue
,
CHARS_IN_GUID
)
&&
HCR_GetDefaultIconW
(
wszCLSIDValue
,
szIconFile
,
cchMax
,
&
dwNr
))
HCR_GetDefaultIconW
(
wszCLSIDValue
,
szIconFile
,
cchMax
,
&
icon_idx
))
{
*
piIndex
=
dwNr
;
*
piIndex
=
icon_idx
;
}
else
{
static
const
WCHAR
folder
[]
=
{
'F'
,
'o'
,
'l'
,
'd'
,
'e'
,
'r'
,
0
};
if
(
!
HCR_GetDefaultIconW
(
folder
,
szIconFile
,
cchMax
,
&
dwNr
))
if
(
!
HCR_GetDefaultIconW
(
folder
,
szIconFile
,
cchMax
,
&
icon_idx
))
{
lstrcpynW
(
szIconFile
,
swShell32Name
,
cchMax
);
dwNr
=
IDI_SHELL_FOLDER
;
icon_idx
=
-
IDI_SHELL_FOLDER
;
}
*
piIndex
=
-
((
uFlags
&
GIL_OPENICON
)
?
dwNr
+
1
:
dwNr
);
if
(
uFlags
&
GIL_OPENICON
)
*
piIndex
=
icon_idx
<
0
?
icon_idx
-
1
:
icon_idx
+
1
;
else
*
piIndex
=
icon_idx
;
}
return
S_OK
;
}
...
...
@@ -227,7 +232,7 @@ static HRESULT WINAPI IExtractIconW_fnGetIconLocation(
IExtractIconWImpl
*
This
=
(
IExtractIconWImpl
*
)
iface
;
char
sTemp
[
MAX_PATH
];
DWORD
dwNr
;
int
icon_idx
;
GUID
const
*
riid
;
LPITEMIDLIST
pSimplePidl
=
ILFindLastID
(
This
->
pidl
);
...
...
@@ -256,9 +261,9 @@ static HRESULT WINAPI IExtractIconW_fnGetIconLocation(
riid
->
Data4
[
0
],
riid
->
Data4
[
1
],
riid
->
Data4
[
2
],
riid
->
Data4
[
3
],
riid
->
Data4
[
4
],
riid
->
Data4
[
5
],
riid
->
Data4
[
6
],
riid
->
Data4
[
7
]);
if
(
HCR_GetDefaultIconW
(
xriid
,
szIconFile
,
cchMax
,
&
dwNr
))
if
(
HCR_GetDefaultIconW
(
xriid
,
szIconFile
,
cchMax
,
&
icon_idx
))
{
*
piIndex
=
dwNr
;
*
piIndex
=
icon_idx
;
}
else
{
...
...
@@ -301,9 +306,9 @@ static HRESULT WINAPI IExtractIconW_fnGetIconLocation(
}
else
{
if
(
HCR_GetDefaultIconW
(
drive
,
szIconFile
,
cchMax
,
&
dwNr
))
if
(
HCR_GetDefaultIconW
(
drive
,
szIconFile
,
cchMax
,
&
icon_idx
))
{
*
piIndex
=
dwNr
;
*
piIndex
=
icon_idx
;
}
else
{
...
...
@@ -329,7 +334,7 @@ static HRESULT WINAPI IExtractIconW_fnGetIconLocation(
else
if
(
_ILGetExtension
(
pSimplePidl
,
sTemp
,
MAX_PATH
))
{
if
(
HCR_MapTypeToValueA
(
sTemp
,
sTemp
,
MAX_PATH
,
TRUE
)
&&
HCR_GetDefaultIconA
(
sTemp
,
sTemp
,
MAX_PATH
,
&
dwNr
))
&&
HCR_GetDefaultIconA
(
sTemp
,
sTemp
,
MAX_PATH
,
&
icon_idx
))
{
if
(
!
lstrcmpA
(
"%1"
,
sTemp
))
/* icon is in the file */
{
...
...
@@ -339,7 +344,7 @@ static HRESULT WINAPI IExtractIconW_fnGetIconLocation(
else
{
MultiByteToWideChar
(
CP_ACP
,
0
,
sTemp
,
-
1
,
szIconFile
,
cchMax
);
*
piIndex
=
dwNr
;
*
piIndex
=
icon_idx
;
}
found
=
TRUE
;
...
...
dlls/shell32/iconcache.c
View file @
7114f8c3
...
...
@@ -97,7 +97,7 @@ static INT CALLBACK SIC_CompareEntries( LPVOID p1, LPVOID p2, LPARAM lparam)
}
/* declare SIC_LoadOverlayIcon() */
static
int
SIC_LoadOverlayIcon
(
int
idx
);
static
int
SIC_LoadOverlayIcon
(
int
i
con_i
dx
);
/*****************************************************************************
* SIC_OverlayShortcutImage [internal]
...
...
@@ -467,7 +467,7 @@ void SIC_Destroy(void)
*
* Load a shell overlay icon and return its icon cache index.
*/
static
int
SIC_LoadOverlayIcon
(
int
idx
)
static
int
SIC_LoadOverlayIcon
(
int
i
con_i
dx
)
{
WCHAR
buffer
[
1024
],
wszIdx
[
8
];
HKEY
hKeyShellIcons
;
...
...
@@ -482,13 +482,13 @@ static int SIC_LoadOverlayIcon(int idx)
static
const
WCHAR
wszNumFmt
[]
=
{
'%'
,
'd'
,
0
};
iconPath
=
swShell32Name
;
/* default: load icon from shell32.dll */
iconIdx
=
idx
;
iconIdx
=
i
con_i
dx
;
if
(
RegOpenKeyExW
(
HKEY_LOCAL_MACHINE
,
wszShellIcons
,
0
,
KEY_READ
,
&
hKeyShellIcons
)
==
ERROR_SUCCESS
)
{
DWORD
count
=
sizeof
(
buffer
);
sprintfW
(
wszIdx
,
wszNumFmt
,
idx
);
sprintfW
(
wszIdx
,
wszNumFmt
,
i
con_i
dx
);
/* read icon path and index */
if
(
RegQueryValueExW
(
hKeyShellIcons
,
wszIdx
,
NULL
,
NULL
,
(
LPBYTE
)
buffer
,
&
count
)
==
ERROR_SUCCESS
)
...
...
dlls/shell32/shell32_main.c
View file @
7114f8c3
...
...
@@ -536,7 +536,7 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
{
WCHAR
sTemp
[
MAX_PATH
];
WCHAR
*
szExt
;
DWORD
dwNr
=
0
;
int
icon_idx
=
0
;
lstrcpynW
(
sTemp
,
szFullPath
,
MAX_PATH
);
...
...
@@ -550,14 +550,14 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
szExt
=
(
LPWSTR
)
PathFindExtensionW
(
sTemp
);
if
(
szExt
&&
HCR_MapTypeToValueW
(
szExt
,
sTemp
,
MAX_PATH
,
TRUE
)
&&
HCR_GetDefaultIconW
(
sTemp
,
sTemp
,
MAX_PATH
,
&
dwNr
))
HCR_GetDefaultIconW
(
sTemp
,
sTemp
,
MAX_PATH
,
&
icon_idx
))
{
if
(
!
lstrcmpW
(
p1W
,
sTemp
))
/* icon is in the file */
strcpyW
(
sTemp
,
szFullPath
);
if
(
flags
&
SHGFI_SYSICONINDEX
)
{
psfi
->
iIcon
=
SIC_GetIconIndex
(
sTemp
,
dwNr
,
0
);
psfi
->
iIcon
=
SIC_GetIconIndex
(
sTemp
,
icon_idx
,
0
);
if
(
psfi
->
iIcon
==
-
1
)
psfi
->
iIcon
=
0
;
}
...
...
@@ -565,16 +565,16 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
{
IconNotYetLoaded
=
FALSE
;
if
(
flags
&
SHGFI_SMALLICON
)
PrivateExtractIconsW
(
sTemp
,
dwNr
,
PrivateExtractIconsW
(
sTemp
,
icon_idx
,
GetSystemMetrics
(
SM_CXSMICON
),
GetSystemMetrics
(
SM_CYSMICON
),
&
psfi
->
hIcon
,
0
,
1
,
0
);
else
PrivateExtractIconsW
(
sTemp
,
dwNr
,
PrivateExtractIconsW
(
sTemp
,
icon_idx
,
GetSystemMetrics
(
SM_CXICON
),
GetSystemMetrics
(
SM_CYICON
),
&
psfi
->
hIcon
,
0
,
1
,
0
);
psfi
->
iIcon
=
dwNr
;
psfi
->
iIcon
=
icon_idx
;
}
}
}
...
...
dlls/shell32/shell32_main.h
View file @
7114f8c3
...
...
@@ -58,13 +58,13 @@ INT SIC_GetIconIndex (LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags );
/* Classes Root */
BOOL
HCR_MapTypeToValueW
(
LPCWSTR
szExtension
,
LPWSTR
szFileType
,
LONG
len
,
BOOL
bPrependDot
);
BOOL
HCR_GetExecuteCommandW
(
HKEY
hkeyClass
,
LPCWSTR
szClass
,
LPCWSTR
szVerb
,
LPWSTR
szDest
,
DWORD
len
);
BOOL
HCR_GetDefaultIconW
(
LPCWSTR
szClass
,
LPWSTR
szDest
,
DWORD
len
,
LPDWORD
dwNr
);
BOOL
HCR_GetDefaultIconFromGUIDW
(
REFIID
riid
,
LPWSTR
szDest
,
DWORD
len
,
LPDWORD
dwNr
);
BOOL
HCR_GetDefaultIconW
(
LPCWSTR
szClass
,
LPWSTR
szDest
,
DWORD
len
,
int
*
picon_idx
);
BOOL
HCR_GetDefaultIconFromGUIDW
(
REFIID
riid
,
LPWSTR
szDest
,
DWORD
len
,
int
*
picon_idx
);
BOOL
HCR_GetClassNameW
(
REFIID
riid
,
LPWSTR
szDest
,
DWORD
len
);
/* ANSI versions of above functions, supposed to go away as soon as they are not used anymore */
BOOL
HCR_MapTypeToValueA
(
LPCSTR
szExtension
,
LPSTR
szFileType
,
LONG
len
,
BOOL
bPrependDot
);
BOOL
HCR_GetDefaultIconA
(
LPCSTR
szClass
,
LPSTR
szDest
,
DWORD
len
,
LPDWORD
dwNr
);
BOOL
HCR_GetDefaultIconA
(
LPCSTR
szClass
,
LPSTR
szDest
,
DWORD
len
,
int
*
picon_idx
);
BOOL
HCR_GetClassNameA
(
REFIID
riid
,
LPSTR
szDest
,
DWORD
len
);
BOOL
HCR_GetFolderAttributes
(
LPCITEMIDLIST
pidlFolder
,
LPDWORD
dwAttributes
);
...
...
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