Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jason Beetham
wine
Commits
05043584
Commit
05043584
authored
25 years ago
by
Juergen Schmied
Committed by
Alexandre Julliard
25 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Protect cache with critical section.
Removed hack to load icons from external shell32.dll.
parent
c50ef5af
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/shell32/iconcache.c
+64
-51
64 additions, 51 deletions
dlls/shell32/iconcache.c
with
64 additions
and
51 deletions
dlls/shell32/iconcache.c
+
64
−
51
View file @
05043584
...
...
@@ -457,6 +457,9 @@ typedef struct
DWORD
dwAccessTime
;
}
SIC_ENTRY
,
*
LPSIC_ENTRY
;
static
HDPA
sic_hdpa
=
0
;
static
CRITICAL_SECTION
SHELL32_SicCS
;
/*****************************************************************************
* SIC_CompareEntrys [called by comctl32.dll]
*
...
...
@@ -482,7 +485,7 @@ INT CALLBACK SIC_CompareEntrys( LPVOID p1, LPVOID p2, LPARAM lparam)
*/
static
INT
SIC_IconAppend
(
LPCSTR
sSourceFile
,
INT
dwSourceIndex
,
HICON
hSmallIcon
,
HICON
hBigIcon
)
{
LPSIC_ENTRY
lpsice
;
INT
index
,
index1
;
INT
ret
,
index
,
index1
;
TRACE
(
"%s %i %x %x
\n
"
,
sSourceFile
,
dwSourceIndex
,
hSmallIcon
,
hBigIcon
);
...
...
@@ -491,22 +494,29 @@ static INT SIC_IconAppend (LPCSTR sSourceFile, INT dwSourceIndex, HICON hSmallIc
lpsice
->
sSourceFile
=
HEAP_strdupA
(
GetProcessHeap
(),
0
,
PathFindFilenameA
(
sSourceFile
));
lpsice
->
dwSourceIndex
=
dwSourceIndex
;
EnterCriticalSection
(
&
SHELL32_SicCS
);
index
=
pDPA_InsertPtr
(
sic_hdpa
,
0x7fff
,
lpsice
);
if
(
INVALID_INDEX
==
index
)
{
SHFree
(
lpsice
);
return
INVALID_INDEX
;
{
SHFree
(
lpsice
);
ret
=
INVALID_INDEX
;
}
else
{
index
=
pImageList_AddIcon
(
ShellSmallIconList
,
hSmallIcon
);
index1
=
pImageList_AddIcon
(
ShellBigIconList
,
hBigIcon
);
index
=
pImageList_AddIcon
(
ShellSmallIconList
,
hSmallIcon
);
index1
=
pImageList_AddIcon
(
ShellBigIconList
,
hBigIcon
);
if
(
index
!=
index1
)
{
FIXME
(
"iconlists out of sync 0x%x 0x%x
\n
"
,
index
,
index1
);
if
(
index
!=
index1
)
{
FIXME
(
"iconlists out of sync 0x%x 0x%x
\n
"
,
index
,
index1
);
}
lpsice
->
dwListIndex
=
index
;
ret
=
lpsice
->
dwListIndex
;
}
lpsice
->
dwListIndex
=
index
;
return
lpsice
->
dwListIndex
;
LeaveCriticalSection
(
&
SHELL32_SicCS
);
return
ret
;
}
/****************************************************************************
* SIC_LoadIcon [internal]
...
...
@@ -523,7 +533,8 @@ static INT SIC_LoadIcon (LPCSTR sSourceFile, INT dwSourceIndex)
if
(
!
hiconLarge
||
!
hiconSmall
)
{
WARN
(
"failure loading icon %i from %s (%x %x)
\n
"
,
dwSourceIndex
,
sSourceFile
,
hiconLarge
,
hiconSmall
);
{
WARN
(
"failure loading icon %i from %s (%x %x)
\n
"
,
dwSourceIndex
,
sSourceFile
,
hiconLarge
,
hiconSmall
);
return
-
1
;
}
return
SIC_IconAppend
(
sSourceFile
,
dwSourceIndex
,
hiconSmall
,
hiconLarge
);
...
...
@@ -541,23 +552,32 @@ static INT SIC_LoadIcon (LPCSTR sSourceFile, INT dwSourceIndex)
*/
INT
SIC_GetIconIndex
(
LPCSTR
sSourceFile
,
INT
dwSourceIndex
)
{
SIC_ENTRY
sice
;
INT
index
=
INVALID_INDEX
;
INT
ret
,
index
=
INVALID_INDEX
;
TRACE
(
"%s %i
\n
"
,
sSourceFile
,
dwSourceIndex
);
sice
.
sSourceFile
=
PathFindFilenameA
(
sSourceFile
);
sice
.
dwSourceIndex
=
dwSourceIndex
;
EnterCriticalSection
(
&
SHELL32_SicCS
);
if
(
NULL
!=
pDPA_GetPtr
(
sic_hdpa
,
0
))
{
index
=
pDPA_Search
(
sic_hdpa
,
&
sice
,
-
1L
,
SIC_CompareEntrys
,
0
,
0
);
{
index
=
pDPA_Search
(
sic_hdpa
,
&
sice
,
-
1L
,
SIC_CompareEntrys
,
0
,
0
);
}
if
(
INVALID_INDEX
==
index
)
{
return
SIC_LoadIcon
(
sSourceFile
,
dwSourceIndex
);
{
ret
=
SIC_LoadIcon
(
sSourceFile
,
dwSourceIndex
);
}
TRACE
(
"-- found
\n
"
);
return
((
LPSIC_ENTRY
)
pDPA_GetPtr
(
sic_hdpa
,
index
))
->
dwListIndex
;
else
{
TRACE
(
"-- found
\n
"
);
ret
=
((
LPSIC_ENTRY
)
pDPA_GetPtr
(
sic_hdpa
,
index
))
->
dwListIndex
;
}
LeaveCriticalSection
(
&
SHELL32_SicCS
);
return
ret
;
}
/****************************************************************************
* SIC_LoadIcon [internal]
...
...
@@ -571,8 +591,10 @@ static HICON WINE_UNUSED SIC_GetIcon (LPCSTR sSourceFile, INT dwSourceIndex, BOO
TRACE
(
"%s %i
\n
"
,
sSourceFile
,
dwSourceIndex
);
index
=
SIC_GetIconIndex
(
sSourceFile
,
dwSourceIndex
);
if
(
INVALID_INDEX
==
index
)
{
return
INVALID_INDEX
;
{
return
INVALID_INDEX
;
}
if
(
bSmallIcon
)
...
...
@@ -588,9 +610,8 @@ static HICON WINE_UNUSED SIC_GetIcon (LPCSTR sSourceFile, INT dwSourceIndex, BOO
* will be removed when the resource-compiler is ready
*/
BOOL
SIC_Initialize
(
void
)
{
CHAR
szShellPath
[
MAX_PATH
];
HGLOBAL
hSmRet
,
hLgRet
;
HICON
*
pSmRet
,
*
pLgRet
;
{
HICON
hSm
,
hLg
;
UINT
index
;
TRACE
(
"
\n
"
);
...
...
@@ -598,45 +619,33 @@ BOOL SIC_Initialize(void)
if
(
sic_hdpa
)
/* already initialized?*/
return
TRUE
;
sic_hdpa
=
pDPA_Create
(
16
);
InitializeCriticalSection
(
&
SHELL32_SicCS
);
sic_hdpa
=
pDPA_Create
(
16
);
if
(
!
sic_hdpa
)
{
return
(
FALSE
);
{
return
(
FALSE
);
}
GetSystemDirectoryA
(
szShellPath
,
MAX_PATH
);
PathAddBackslashA
(
szShellPath
);
strcat
(
szShellPath
,
"shell32.dll"
);
hSmRet
=
GlobalAlloc
(
GMEM_FIXED
|
GMEM_ZEROINIT
,
sizeof
(
HICON
)
*
40
);
hLgRet
=
GlobalAlloc
(
GMEM_FIXED
|
GMEM_ZEROINIT
,
sizeof
(
HICON
)
*
40
);
pSmRet
=
(
HICON
*
)
GlobalLock
(
hSmRet
);
pLgRet
=
(
HICON
*
)
GlobalLock
(
hLgRet
);
ExtractIconExA
(
szShellPath
,
0
,
pLgRet
,
pSmRet
,
40
);
ShellSmallIconList
=
pImageList_Create
(
16
,
16
,
ILC_COLORDDB
|
ILC_MASK
,
0
,
0x20
);
ShellBigIconList
=
pImageList_Create
(
32
,
32
,
ILC_COLORDDB
|
ILC_MASK
,
0
,
0x20
);
pImageList_SetBkColor
(
ShellSmallIconList
,
GetSysColor
(
COLOR_WINDOW
));
pImageList_SetBkColor
(
ShellBigIconList
,
GetSysColor
(
COLOR_WINDOW
));
for
(
index
=
0
;
index
<
40
;
index
++
)
{
if
(
!
pSmRet
[
index
]
)
{
MESSAGE
(
"*** failure loading resources from %s
\n
"
,
szShellPath
);
MESSAGE
(
"*** this is a hack for loading the internal and external dll at the same time
\n
"
);
MESSAGE
(
"*** you can ignore it but you will miss some icons in win95 dialogs
\n\n
"
);
break
;
for
(
index
=
1
;
index
<
39
;
index
++
)
{
hSm
=
LoadImageA
(
shell32_hInstance
,
MAKEINTRESOURCEA
(
index
),
IMAGE_ICON
,
16
,
16
,
LR_SHARED
);
hLg
=
LoadImageA
(
shell32_hInstance
,
MAKEINTRESOURCEA
(
index
),
IMAGE_ICON
,
32
,
32
,
LR_SHARED
);
if
(
!
hSm
)
{
hSm
=
LoadImageA
(
shell32_hInstance
,
MAKEINTRESOURCEA
(
0
),
IMAGE_ICON
,
16
,
16
,
LR_SHARED
);
hLg
=
LoadImageA
(
shell32_hInstance
,
MAKEINTRESOURCEA
(
0
),
IMAGE_ICON
,
32
,
32
,
LR_SHARED
);
}
SIC_IconAppend
(
s
zS
hell
Path
,
index
,
p
Sm
Ret
[
index
]
,
p
Lg
Ret
[
index
]
);
SIC_IconAppend
(
"
shell
32.dll"
,
index
,
h
Sm
,
h
Lg
);
}
GlobalUnlock
(
hLgRet
);
GlobalFree
(
hLgRet
);
GlobalUnlock
(
hSmRet
);
GlobalFree
(
hSmRet
);
TRACE
(
"hIconSmall=%p hIconBig=%p
\n
"
,
ShellSmallIconList
,
ShellBigIconList
);
...
...
@@ -654,6 +663,8 @@ void SIC_Destroy(void)
TRACE
(
"
\n
"
);
EnterCriticalSection
(
&
SHELL32_SicCS
);
if
(
sic_hdpa
&&
NULL
!=
pDPA_GetPtr
(
sic_hdpa
,
0
))
{
for
(
i
=
0
;
i
<
pDPA_GetPtrCount
(
sic_hdpa
);
++
i
)
...
...
@@ -665,6 +676,8 @@ void SIC_Destroy(void)
}
sic_hdpa
=
NULL
;
LeaveCriticalSection
(
&
SHELL32_SicCS
);
}
/*************************************************************************
* Shell_GetImageList [SHELL32.71]
...
...
@@ -733,7 +746,7 @@ UINT WINAPI SHMapPIDLToSystemImageListIndex(LPSHELLFOLDER sh, LPITEMIDLIST pidl,
{
UINT
Index
;
WARN
(
"(SF=%p,pidl=%p,%p)
\n
"
,
sh
,
pidl
,
pIndex
);
TRACE
(
"(SF=%p,pidl=%p,%p)
\n
"
,
sh
,
pidl
,
pIndex
);
pdump
(
pidl
);
if
(
pIndex
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment