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
c4155c52
Commit
c4155c52
authored
Apr 21, 2017
by
Huw Davies
Committed by
Alexandre Julliard
Apr 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Take a reference on the imagelist returned with SHGFI_SYSICONINDEX.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5f0d1a00
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
15 deletions
+46
-15
shell32_main.c
dlls/shell32/shell32_main.c
+2
-0
shlfileop.c
dlls/shell32/tests/shlfileop.c
+44
-15
No files found.
dlls/shell32/shell32_main.c
View file @
c4155c52
...
...
@@ -40,6 +40,7 @@
#include "rpcproxy.h"
#include "shlwapi.h"
#include "propsys.h"
#include "commoncontrols.h"
#include "undocshell.h"
#include "pidl.h"
...
...
@@ -730,6 +731,7 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
ret
=
(
DWORD_PTR
)
small_icons
;
else
ret
=
(
DWORD_PTR
)
big_icons
;
IImageList_AddRef
((
IImageList
*
)
ret
);
}
}
...
...
dlls/shell32/tests/shlfileop.c
View file @
c4155c52
...
...
@@ -21,10 +21,12 @@
#include <stdarg.h>
#include <stdio.h>
#define COBJMACROS
#define WINE_NOWINSOCK
#include <windows.h>
#include "shellapi.h"
#include "shlobj.h"
#include "commoncontrols.h"
#include "wine/test.h"
...
...
@@ -325,6 +327,8 @@ static void test_get_file_info_iconlist(void)
LPITEMIDLIST
pidList
;
SHFILEINFOA
shInfoa
;
SHFILEINFOW
shInfow
;
IImageList
*
small_list
,
*
large_list
;
ULONG
start_refs
,
refs
;
hr
=
SHGetSpecialFolderLocation
(
NULL
,
CSIDL_DESKTOP
,
&
pidList
);
if
(
FAILED
(
hr
))
{
...
...
@@ -332,11 +336,22 @@ static void test_get_file_info_iconlist(void)
return
;
}
SHGetImageList
(
SHIL_LARGE
,
&
IID_IImageList
,
(
void
**
)
&
large_list
);
SHGetImageList
(
SHIL_SMALL
,
&
IID_IImageList
,
(
void
**
)
&
small_list
);
start_refs
=
IImageList_AddRef
(
small_list
);
IImageList_Release
(
small_list
);
memset
(
&
shInfoa
,
0xcf
,
sizeof
(
shInfoa
));
hSysImageList
=
(
HIMAGELIST
)
SHGetFileInfoA
((
const
char
*
)
pidList
,
0
,
&
shInfoa
,
sizeof
(
shInfoa
),
SHGFI_SYSICONINDEX
|
SHGFI_SMALLICON
|
SHGFI_PIDL
);
ok
((
hSysImageList
!=
INVALID_HANDLE_VALUE
)
&&
(
hSysImageList
>
(
HIMAGELIST
)
0xffff
),
"Can't get handle for CSIDL_DESKTOP imagelist
\n
"
);
ok
(
hSysImageList
==
(
HIMAGELIST
)
small_list
,
"got %p expect %p
\n
"
,
hSysImageList
,
small_list
);
refs
=
IImageList_AddRef
(
small_list
);
IImageList_Release
(
small_list
);
ok
(
refs
==
start_refs
+
1
||
broken
(
refs
==
start_refs
),
/* XP and 2003 */
"got %d, start_refs %d
\n
"
,
refs
,
start_refs
);
todo_wine
ok
(
shInfoa
.
hIcon
==
0
,
"SHGetFileInfoA(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL) did not clear hIcon
\n
"
);
todo_wine
ok
(
shInfoa
.
szTypeName
[
0
]
==
0
,
"SHGetFileInfoA(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL) did not clear szTypeName[0]
\n
"
);
ok
(
shInfoa
.
iIcon
!=
0xcfcfcfcf
,
"SHGetFileInfoA(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL) should set iIcon
\n
"
);
...
...
@@ -344,7 +359,7 @@ static void test_get_file_info_iconlist(void)
shInfoa
.
dwAttributes
==
0
||
/* Vista */
broken
(
shInfoa
.
dwAttributes
!=
0xcfcfcfcf
),
/* NT4 doesn't clear but sets this field */
"SHGetFileInfoA(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL), unexpected dwAttributes
\n
"
);
CloseHandle
(
hSysImageList
);
/* Don't release hSysImageList here (and in similar places below) because of the broken reference behaviour of XP and 2003. */
if
(
!
pSHGetFileInfoW
)
{
...
...
@@ -362,20 +377,19 @@ static void test_get_file_info_iconlist(void)
win_skip
(
"SHGetFileInfoW is not implemented
\n
"
);
return
;
}
ok
(
(
hSysImageList
!=
INVALID_HANDLE_VALUE
)
&&
(
hSysImageList
>
(
HIMAGELIST
)
0xffff
),
"Can't get handle for CSIDL_DESKTOP imagelist
\n
"
);
ok
(
hSysImageList
==
(
HIMAGELIST
)
small_list
,
"got %p expect %p
\n
"
,
hSysImageList
,
small_list
);
todo_wine
ok
(
shInfow
.
hIcon
==
0
,
"SHGetFileInfoW(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL) did not clear hIcon
\n
"
);
ok
(
shInfow
.
szTypeName
[
0
]
==
0
,
"SHGetFileInfoW(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL) did not clear szTypeName[0]
\n
"
);
ok
(
shInfow
.
iIcon
!=
0xcfcfcfcf
,
"SHGetFileInfoW(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL) should set iIcon
\n
"
);
ok
(
shInfow
.
dwAttributes
==
0xcfcfcfcf
||
shInfoa
.
dwAttributes
==
0
,
/* Vista */
"SHGetFileInfoW(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL) unexpected dwAttributes
\n
"
);
CloseHandle
(
hSysImageList
);
/* Various suposidly invalid flag testing */
memset
(
&
shInfow
,
0xcf
,
sizeof
(
shInfow
));
h
r
=
pSHGetFileInfoW
((
const
WCHAR
*
)
pidList
,
0
,
&
shInfow
,
sizeof
(
shInfow
),
h
SysImageList
=
(
HIMAGELIST
)
pSHGetFileInfoW
((
const
WCHAR
*
)
pidList
,
0
,
&
shInfow
,
sizeof
(
shInfow
),
SHGFI_SYSICONINDEX
|
SHGFI_USEFILEATTRIBUTES
|
SHGFI_PIDL
|
SHGFI_SMALLICON
);
ok
(
h
r
!=
0
,
"SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_SMALLICON Failed
\n
"
);
ok
(
h
SysImageList
==
(
HIMAGELIST
)
small_list
,
"got %p expect %p
\n
"
,
hSysImageList
,
small_list
);
ok
(
shInfow
.
iIcon
!=
0xcfcfcfcf
,
"Icon Index Missing
\n
"
);
ok
(
shInfow
.
dwAttributes
==
0xcfcfcfcf
||
shInfoa
.
dwAttributes
==
0
,
/* Vista */
...
...
@@ -400,9 +414,9 @@ static void test_get_file_info_iconlist(void)
todo_wine
ok
(
shInfow
.
dwAttributes
==
0
,
"dwAttributes not set
\n
"
);
memset
(
&
shInfow
,
0xcf
,
sizeof
(
shInfow
));
h
r
=
pSHGetFileInfoW
((
const
WCHAR
*
)
pidList
,
0
,
&
shInfow
,
sizeof
(
shInfow
),
h
SysImageList
=
(
HIMAGELIST
)
pSHGetFileInfoW
((
const
WCHAR
*
)
pidList
,
0
,
&
shInfow
,
sizeof
(
shInfow
),
SHGFI_SYSICONINDEX
|
SHGFI_USEFILEATTRIBUTES
|
SHGFI_PIDL
|
SHGFI_LARGEICON
);
ok
(
h
r
!=
0
,
"SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_LARGEICON Failed
\n
"
);
ok
(
h
SysImageList
==
(
HIMAGELIST
)
large_list
,
"got %p expect %p
\n
"
,
hSysImageList
,
small_list
);
ok
(
shInfow
.
iIcon
!=
0xcfcfcfcf
,
"Icon Index Missing
\n
"
);
ok
(
shInfow
.
dwAttributes
==
0xcfcfcfcf
||
shInfoa
.
dwAttributes
==
0
,
/* Vista */
...
...
@@ -430,18 +444,18 @@ static void test_get_file_info_iconlist(void)
ok
(
shInfow
.
dwAttributes
==
0xcfcfcfcf
,
"dwAttributes modified
\n
"
);
memset
(
&
shInfow
,
0xcf
,
sizeof
(
shInfow
));
h
r
=
pSHGetFileInfoW
((
const
WCHAR
*
)
pidList
,
0
,
&
shInfow
,
sizeof
(
shInfow
),
h
SysImageList
=
(
HIMAGELIST
)
pSHGetFileInfoW
((
const
WCHAR
*
)
pidList
,
0
,
&
shInfow
,
sizeof
(
shInfow
),
SHGFI_SYSICONINDEX
|
SHGFI_USEFILEATTRIBUTES
|
SHGFI_PIDL
|
SHGFI_SMALLICON
|
SHGFI_ATTRIBUTES
);
ok
(
h
r
!=
0
,
"SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_SMALLICON|SHGFI_ATTRIBUTES Failed
\n
"
);
ok
(
h
SysImageList
==
(
HIMAGELIST
)
small_list
,
"got %p expect %p
\n
"
,
hSysImageList
,
small_list
);
ok
(
shInfow
.
iIcon
!=
0xcfcfcfcf
,
"Icon Index Missing
\n
"
);
ok
(
shInfow
.
dwAttributes
!=
0xcfcfcfcf
,
"dwAttributes not set
\n
"
);
memset
(
&
shInfow
,
0xcf
,
sizeof
(
shInfow
));
h
r
=
pSHGetFileInfoW
((
const
WCHAR
*
)
pidList
,
0
,
&
shInfow
,
sizeof
(
shInfow
),
h
SysImageList
=
(
HIMAGELIST
)
pSHGetFileInfoW
((
const
WCHAR
*
)
pidList
,
0
,
&
shInfow
,
sizeof
(
shInfow
),
SHGFI_SYSICONINDEX
|
SHGFI_USEFILEATTRIBUTES
|
SHGFI_PIDL
|
SHGFI_SMALLICON
|
SHGFI_EXETYPE
);
todo_wine
ok
(
h
r
!=
0
,
"SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_SMALLICON|SHGFI_EXETYPE Failed
\n
"
);
todo_wine
ok
(
h
SysImageList
==
(
HIMAGELIST
)
small_list
,
"got %p expect %p
\n
"
,
hSysImageList
,
small_list
);
ok
(
shInfow
.
iIcon
!=
0xcfcfcfcf
,
"Icon Index Missing
\n
"
);
ok
(
shInfow
.
dwAttributes
==
0xcfcfcfcf
||
shInfoa
.
dwAttributes
==
0
,
/* Vista */
...
...
@@ -462,17 +476,18 @@ static void test_get_file_info_iconlist(void)
ok
(
shInfow
.
dwAttributes
!=
0xcfcfcfcf
,
"dwAttributes not set
\n
"
);
memset
(
&
shInfow
,
0xcf
,
sizeof
(
shInfow
));
h
r
=
pSHGetFileInfoW
((
const
WCHAR
*
)
pidList
,
0
,
&
shInfow
,
sizeof
(
shInfow
),
h
SysImageList
=
(
HIMAGELIST
)
pSHGetFileInfoW
((
const
WCHAR
*
)
pidList
,
0
,
&
shInfow
,
sizeof
(
shInfow
),
SHGFI_SYSICONINDEX
|
SHGFI_USEFILEATTRIBUTES
|
SHGFI_PIDL
|
SHGFI_ATTRIBUTES
);
ok
(
hSysImageList
==
(
HIMAGELIST
)
large_list
,
"got %p expect %p
\n
"
,
hSysImageList
,
large_list
);
ok
(
hr
!=
0
,
"SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_ATTRIBUTES Failed
\n
"
);
ok
(
shInfow
.
iIcon
!=
0xcfcfcfcf
,
"Icon Index Missing
\n
"
);
ok
(
shInfow
.
dwAttributes
!=
0xcfcfcfcf
,
"dwAttributes not set
\n
"
);
memset
(
&
shInfow
,
0xcf
,
sizeof
(
shInfow
));
h
r
=
pSHGetFileInfoW
((
const
WCHAR
*
)
pidList
,
0
,
&
shInfow
,
sizeof
(
shInfow
),
h
SysImageList
=
(
HIMAGELIST
)
pSHGetFileInfoW
((
const
WCHAR
*
)
pidList
,
0
,
&
shInfow
,
sizeof
(
shInfow
),
SHGFI_SYSICONINDEX
|
SHGFI_USEFILEATTRIBUTES
|
SHGFI_PIDL
|
SHGFI_EXETYPE
);
todo_wine
ok
(
h
r
!=
0
,
"SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_EXETYPE Failed
\n
"
);
todo_wine
ok
(
h
SysImageList
==
(
HIMAGELIST
)
large_list
,
"got %p expect %p
\n
"
,
hSysImageList
,
large_list
);
ok
(
shInfow
.
iIcon
!=
0xcfcfcfcf
,
"Icon Index Missing
\n
"
);
ok
(
shInfow
.
dwAttributes
==
0xcfcfcfcf
||
shInfoa
.
dwAttributes
==
0
,
/* Vista */
...
...
@@ -492,7 +507,21 @@ static void test_get_file_info_iconlist(void)
todo_wine
ok
(
shInfow
.
iIcon
==
0xcfcfcfcf
,
"Icon Index Modified
\n
"
);
ok
(
shInfow
.
dwAttributes
!=
0xcfcfcfcf
,
"dwAttributes not set
\n
"
);
memset
(
&
shInfow
,
0xcf
,
sizeof
(
shInfow
));
hSysImageList
=
(
HIMAGELIST
)
pSHGetFileInfoW
((
const
WCHAR
*
)
pidList
,
0
,
&
shInfow
,
sizeof
(
shInfow
),
SHGFI_SYSICONINDEX
|
SHGFI_PIDL
|
SHGFI_SMALLICON
|
SHGFI_SHELLICONSIZE
);
ok
(
hSysImageList
==
(
HIMAGELIST
)
small_list
,
"got %p expect %p
\n
"
,
hSysImageList
,
small_list
);
ok
(
shInfow
.
iIcon
!=
0xcfcfcfcf
,
"Icon Index Missing
\n
"
);
memset
(
&
shInfow
,
0xcf
,
sizeof
(
shInfow
));
hSysImageList
=
(
HIMAGELIST
)
pSHGetFileInfoW
((
const
WCHAR
*
)
pidList
,
0
,
&
shInfow
,
sizeof
(
shInfow
),
SHGFI_SYSICONINDEX
|
SHGFI_PIDL
|
SHGFI_SHELLICONSIZE
);
ok
(
hSysImageList
==
(
HIMAGELIST
)
large_list
,
"got %p expect %p
\n
"
,
hSysImageList
,
small_list
);
ok
(
shInfow
.
iIcon
!=
0xcfcfcfcf
,
"Icon Index Missing
\n
"
);
ILFree
(
pidList
);
IImageList_Release
(
small_list
);
IImageList_Release
(
large_list
);
}
...
...
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