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
09389c4b
Commit
09389c4b
authored
Mar 21, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 21, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Pass handle arrays between icon cache helpers.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ff5cfaab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
79 deletions
+83
-79
iconcache.c
dlls/shell32/iconcache.c
+83
-79
No files found.
dlls/shell32/iconcache.c
View file @
09389c4b
...
...
@@ -298,50 +298,51 @@ fail:
/*****************************************************************************
* SIC_IconAppend [internal]
*
* NOTES
* appends an icon pair to the end of the cache
*/
static
INT
SIC_IconAppend
(
LPCWSTR
sSourceFile
,
INT
dwSourceIndex
,
HICON
hSmallIcon
,
HICON
hBigIcon
,
DWORD
dwF
lags
)
static
INT
SIC_IconAppend
(
const
WCHAR
*
sourcefile
,
INT
src_index
,
HICON
*
hicons
,
DWORD
f
lags
)
{
LPSIC_ENTRY
lpsice
;
INT
ret
,
index
,
index1
;
WCHAR
path
[
MAX_PATH
]
;
TRACE
(
"%s %i %p %p
\n
"
,
debugstr_w
(
sSourceFile
),
dwSourceIndex
,
hSmallIcon
,
hBigIcon
)
;
INT
ret
,
index
,
index1
;
WCHAR
path
[
MAX_PATH
]
;
SIC_ENTRY
*
entry
;
unsigned
int
i
;
lpsice
=
SHAlloc
(
sizeof
(
SIC_ENTRY
)
);
TRACE
(
"%s %i %p %#x
\n
"
,
debugstr_w
(
sourcefile
),
src_index
,
hicons
,
flags
);
GetFullPathNameW
(
sSourceFile
,
MAX_PATH
,
path
,
NULL
);
lpsice
->
sSourceFile
=
heap_alloc
(
(
strlenW
(
path
)
+
1
)
*
sizeof
(
WCHAR
)
);
strcpyW
(
lpsice
->
sSourceFile
,
path
);
entry
=
SHAlloc
(
sizeof
(
*
entry
));
lpsice
->
dwSourceIndex
=
dwSourceIndex
;
lpsice
->
dwFlags
=
dwFlags
;
GetFullPathNameW
(
sourcefile
,
MAX_PATH
,
path
,
NULL
);
entry
->
sSourceFile
=
heap_alloc
(
(
strlenW
(
path
)
+
1
)
*
sizeof
(
WCHAR
)
);
strcpyW
(
entry
->
sSourceFile
,
path
);
EnterCriticalSection
(
&
SHELL32_SicCS
);
entry
->
dwSourceIndex
=
src_index
;
entry
->
dwFlags
=
flags
;
index
=
DPA_InsertPtr
(
sic_hdpa
,
0x7fff
,
lpsice
);
if
(
INVALID_INDEX
==
index
)
{
heap_free
(
lpsice
->
sSourceFile
);
SHFree
(
lpsice
);
ret
=
INVALID_INDEX
;
}
else
{
index
=
ImageList_AddIcon
(
shell_imagelists
[
SHIL_SMALL
],
hSmallIcon
);
index1
=
ImageList_AddIcon
(
shell_imagelists
[
SHIL_LARGE
],
hBigIcon
);
EnterCriticalSection
(
&
SHELL32_SicCS
);
if
(
index
!=
index1
)
{
FIXME
(
"iconlists out of sync 0x%x 0x%x
\n
"
,
index
,
index1
);
}
lpsice
->
dwListIndex
=
index
;
ret
=
lpsice
->
dwListIndex
;
}
index
=
DPA_InsertPtr
(
sic_hdpa
,
0x7fff
,
entry
);
if
(
INVALID_INDEX
==
index
)
{
heap_free
(
entry
->
sSourceFile
);
SHFree
(
entry
);
ret
=
INVALID_INDEX
;
}
else
{
index
=
-
1
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
shell_imagelists
);
i
++
)
{
index1
=
ImageList_AddIcon
(
shell_imagelists
[
i
],
hicons
[
i
]);
if
(
index
!=
-
1
&&
index1
!=
index
)
WARN
(
"Imagelists out of sync, list %d.
\n
"
,
i
);
index
=
index1
;
}
LeaveCriticalSection
(
&
SHELL32_SicCS
);
return
ret
;
entry
->
dwListIndex
=
index
;
ret
=
entry
->
dwListIndex
;
}
LeaveCriticalSection
(
&
SHELL32_SicCS
);
return
ret
;
}
static
BOOL
get_imagelist_icon_size
(
int
list
,
SIZE
*
size
)
...
...
@@ -355,52 +356,55 @@ static BOOL get_imagelist_icon_size(int list, SIZE *size)
* SIC_LoadIcon [internal]
*
* NOTES
* gets
small/big icon by number from a
file
* gets
icons by index from the
file
*/
static
INT
SIC_LoadIcon
(
LPCWSTR
sSourceFile
,
INT
dwSourceI
ndex
,
DWORD
flags
)
static
INT
SIC_LoadIcon
(
const
WCHAR
*
sourcefile
,
INT
i
ndex
,
DWORD
flags
)
{
HICON
hiconLarge
=
0
;
HICON
hiconSmall
=
0
;
HICON
hiconLargeShortcut
;
HICON
hiconSmallShortcut
;
int
ret
;
SIZE
size
;
get_imagelist_icon_size
(
SHIL_LARGE
,
&
size
);
PrivateExtractIconsW
(
sSourceFile
,
dwSourceIndex
,
size
.
cx
,
size
.
cy
,
&
hiconLarge
,
0
,
1
,
0
);
get_imagelist_icon_size
(
SHIL_SMALL
,
&
size
);
PrivateExtractIconsW
(
sSourceFile
,
dwSourceIndex
,
size
.
cx
,
size
.
cy
,
&
hiconSmall
,
0
,
1
,
0
);
if
(
!
hiconLarge
||
!
hiconSmall
)
{
WARN
(
"failure loading icon %i from %s (%p %p)
\n
"
,
dwSourceIndex
,
debugstr_w
(
sSourceFile
),
hiconLarge
,
hiconSmall
);
return
-
1
;
}
HICON
hicons
[
SHIL_SMALL
+
1
]
=
{
0
};
HICON
hshortcuts
[
ARRAY_SIZE
(
hicons
)]
=
{
0
};
unsigned
int
i
;
SIZE
size
;
int
ret
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
hicons
);
i
++
)
{
get_imagelist_icon_size
(
i
,
&
size
);
if
(
!
PrivateExtractIconsW
(
sourcefile
,
index
,
size
.
cx
,
size
.
cy
,
&
hicons
[
i
],
0
,
1
,
0
))
WARN
(
"Failed to load icon %d from %s.
\n
"
,
index
,
debugstr_w
(
sourcefile
));
}
if
(
flags
&
GIL_FORSHORTCUT
)
{
hiconLargeShortcut
=
SIC_OverlayShortcutImage
(
hiconLarge
,
SHIL_LARGE
);
hiconSmallShortcut
=
SIC_OverlayShortcutImage
(
hiconSmall
,
SHIL_SMALL
);
BOOL
failed
=
FALSE
;
if
(
NULL
!=
hiconLargeShortcut
&&
NULL
!=
hiconSmallShortcut
)
{
DestroyIcon
(
hiconLarge
);
DestroyIcon
(
hiconSmall
);
hiconLarge
=
hiconLargeShortcut
;
hiconSmall
=
hiconSmallShortcut
;
}
else
{
WARN
(
"Failed to create shortcut overlaid icons
\n
"
);
if
(
NULL
!=
hiconLargeShortcut
)
DestroyIcon
(
hiconLargeShortcut
);
if
(
NULL
!=
hiconSmallShortcut
)
DestroyIcon
(
hiconSmallShortcut
);
flags
&=
~
GIL_FORSHORTCUT
;
}
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
hshortcuts
);
i
++
)
{
if
(
!
(
hshortcuts
[
i
]
=
SIC_OverlayShortcutImage
(
hicons
[
i
],
i
)))
{
WARN
(
"Failed to create shortcut overlaid icons.
\n
"
);
failed
=
TRUE
;
}
}
if
(
failed
)
{
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
hshortcuts
);
i
++
)
DestroyIcon
(
hshortcuts
[
i
]);
flags
&=
~
GIL_FORSHORTCUT
;
}
else
{
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
hicons
);
i
++
)
{
DestroyIcon
(
hicons
[
i
]);
hicons
[
i
]
=
hshortcuts
[
i
];
}
}
}
ret
=
SIC_IconAppend
(
s
SourceFile
,
dwSourceIndex
,
hiconSmall
,
hiconLarge
,
flags
);
DestroyIcon
(
hiconLarge
);
DestroyIcon
(
hiconSmall
);
ret
=
SIC_IconAppend
(
s
ourcefile
,
index
,
hicons
,
flags
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
hicons
);
i
++
)
DestroyIcon
(
hicons
[
i
]
);
return
ret
;
}
...
...
@@ -427,7 +431,7 @@ static int get_shell_icon_size(void)
*/
static
BOOL
WINAPI
SIC_Initialize
(
INIT_ONCE
*
once
,
void
*
param
,
void
**
context
)
{
HICON
hSm
,
hLg
;
HICON
hicons
[
SHIL_SMALL
+
1
]
;
int
cx_small
,
cy_small
;
int
cx_large
,
cy_large
;
unsigned
int
i
;
...
...
@@ -462,19 +466,19 @@ static BOOL WINAPI SIC_Initialize( INIT_ONCE *once, void *param, void **context
ImageList_SetBkColor
(
shell_imagelists
[
i
],
CLR_NONE
);
/* Load the document icon, which is used as the default if an icon isn't found. */
h
Sm
=
LoadImageA
(
shell32_hInstance
,
MAKEINTRESOURCEA
(
IDI_SHELL_DOCUMENT
),
h
icons
[
SHIL_SMALL
]
=
LoadImageA
(
shell32_hInstance
,
MAKEINTRESOURCEA
(
IDI_SHELL_DOCUMENT
),
IMAGE_ICON
,
cx_small
,
cy_small
,
LR_SHARED
);
h
Lg
=
LoadImageA
(
shell32_hInstance
,
MAKEINTRESOURCEA
(
IDI_SHELL_DOCUMENT
),
h
icons
[
SHIL_LARGE
]
=
LoadImageA
(
shell32_hInstance
,
MAKEINTRESOURCEA
(
IDI_SHELL_DOCUMENT
),
IMAGE_ICON
,
cx_large
,
cy_large
,
LR_SHARED
);
if
(
!
h
Sm
||
!
hLg
)
if
(
!
h
icons
[
SHIL_SMALL
]
||
!
hicons
[
SHIL_LARGE
])
{
FIXME
(
"Failed to load IDI_SHELL_DOCUMENT icon!
\n
"
);
return
FALSE
;
}
SIC_IconAppend
(
swShell32Name
,
IDI_SHELL_DOCUMENT
-
1
,
h
Sm
,
hLg
,
0
);
SIC_IconAppend
(
swShell32Name
,
-
IDI_SHELL_DOCUMENT
,
h
Sm
,
hLg
,
0
);
SIC_IconAppend
(
swShell32Name
,
IDI_SHELL_DOCUMENT
-
1
,
h
icons
,
0
);
SIC_IconAppend
(
swShell32Name
,
-
IDI_SHELL_DOCUMENT
,
h
icons
,
0
);
TRACE
(
"small list=%p, large list=%p
\n
"
,
shell_imagelists
[
SHIL_SMALL
],
shell_imagelists
[
SHIL_LARGE
]);
...
...
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