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
1b7b3163
Commit
1b7b3163
authored
Dec 12, 2002
by
Rolf Kalbermatter
Committed by
Alexandre Julliard
Dec 12, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement IExtractIconW and inherit IExtractIconA from it.
parent
117d5326
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
181 additions
and
69 deletions
+181
-69
folders.c
dlls/shell32/folders.c
+181
-69
No files found.
dlls/shell32/folders.c
View file @
1b7b3163
...
...
@@ -34,65 +34,78 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
shell
);
/***********************************************************************
* IExtractIcon
A
implementation
* IExtractIcon
W
implementation
*/
typedef
struct
{
ICOM_VFIELD
(
IExtractIconA
);
{
ICOM_VFIELD
(
IExtractIconW
);
DWORD
ref
;
ICOM_VTABLE
(
IPersistFile
)
*
lpvtblPersistFile
;
ICOM_VTABLE
(
IExtractIconA
)
*
lpvtblExtractIconA
;
LPITEMIDLIST
pidl
;
}
IExtractIcon
A
Impl
;
}
IExtractIcon
W
Impl
;
static
struct
ICOM_VTABLE
(
IExtractIconA
)
eivt
;
static
struct
ICOM_VTABLE
(
IExtractIconA
)
eiavt
;
static
struct
ICOM_VTABLE
(
IExtractIconW
)
eivt
;
static
struct
ICOM_VTABLE
(
IPersistFile
)
pfvt
;
#define _IPersistFile_Offset ((int)(&(((IExtractIcon
A
Impl*)0)->lpvtblPersistFile)))
#define _IPersistFile_Offset ((int)(&(((IExtractIcon
W
Impl*)0)->lpvtblPersistFile)))
#define _ICOM_THIS_From_IPersistFile(class, name) class* This = (class*)(((char*)name)-_IPersistFile_Offset);
#define _IExtractIconA_Offset ((int)(&(((IExtractIconWImpl*)0)->lpvtblExtractIconA)))
#define _ICOM_THIS_From_IExtractIconA(class, name) class* This = (class*)(((char*)name)-_IExtractIconA_Offset);
/**************************************************************************
* IExtractIcon
A
_Constructor
* IExtractIcon
W
_Constructor
*/
IExtractIcon
A
*
IExtractIconA
_Constructor
(
LPCITEMIDLIST
pidl
)
IExtractIcon
W
*
IExtractIconW
_Constructor
(
LPCITEMIDLIST
pidl
)
{
IExtractIcon
A
Impl
*
ei
;
IExtractIcon
W
Impl
*
ei
;
ei
=
(
IExtractIconAImpl
*
)
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
IExtractIconA
Impl
));
ei
=
(
IExtractIconWImpl
*
)
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
IExtractIconW
Impl
));
ei
->
ref
=
1
;
ICOM_VTBL
(
ei
)
=
&
eivt
;
ei
->
lpvtblPersistFile
=
&
pfvt
;
ei
->
lpvtblExtractIconA
=
&
eiavt
;
ei
->
pidl
=
ILClone
(
pidl
);
pdump
(
pidl
);
TRACE
(
"(%p)
\n
"
,
ei
);
return
(
IExtractIcon
A
*
)
ei
;
TRACE
(
"(%p)
\n
"
,
ei
);
return
(
IExtractIcon
W
*
)
ei
;
}
/**************************************************************************
* IExtractIcon
A
_QueryInterface
* IExtractIcon
W
_QueryInterface
*/
static
HRESULT
WINAPI
IExtractIcon
A_fnQueryInterface
(
IExtractIconA
*
iface
,
REFIID
riid
,
LPVOID
*
ppvObj
)
static
HRESULT
WINAPI
IExtractIcon
W_fnQueryInterface
(
IExtractIconW
*
iface
,
REFIID
riid
,
LPVOID
*
ppvObj
)
{
ICOM_THIS
(
IExtractIcon
AImpl
,
iface
);
ICOM_THIS
(
IExtractIcon
WImpl
,
iface
);
TRACE
(
"(%p)->(
\n\t
IID:
\t
%s,%p)
\n
"
,
This
,
debugstr_guid
(
riid
),
ppvObj
);
TRACE
(
"(%p)->(
\n\t
IID:
\t
%s,%p)
\n
"
,
This
,
debugstr_guid
(
riid
),
ppvObj
);
*
ppvObj
=
NULL
;
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
))
/*IUnknown*/
{
*
ppvObj
=
This
;
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
))
/*IUnknown*/
{
*
ppvObj
=
This
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IPersistFile
))
/*IExtractIcon*/
{
*
ppvObj
=
(
IPersistFile
*
)
&
(
This
->
lpvtblPersistFile
);
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IPersistFile
))
/*IExtractIcon*/
{
*
ppvObj
=
(
IPersistFile
*
)
&
(
This
->
lpvtblPersistFile
);
else
if
(
IsEqualIID
(
riid
,
&
IID_IExtractIconA
))
/*IExtractIcon*/
{
*
ppvObj
=
(
IExtractIconA
*
)
&
(
This
->
lpvtblExtractIconA
);
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IExtractIconA
))
/*IExtractIcon*/
{
*
ppvObj
=
(
IExtractIconA
*
)
This
;
else
if
(
IsEqualIID
(
riid
,
&
IID_IExtractIconW
))
/*IExtractIcon*/
{
*
ppvObj
=
(
IExtractIconW
*
)
This
;
}
if
(
*
ppvObj
)
{
IExtractIconA_AddRef
((
IExtractIconA
*
)
*
ppvObj
);
{
IExtractIconW_AddRef
((
IExtractIconW
*
)
*
ppvObj
);
TRACE
(
"-- Interface: (%p)->(%p)
\n
"
,
ppvObj
,
*
ppvObj
);
return
S_OK
;
}
...
...
@@ -101,47 +114,51 @@ static HRESULT WINAPI IExtractIconA_fnQueryInterface( IExtractIconA * iface, REF
}
/**************************************************************************
* IExtractIcon
A
_AddRef
* IExtractIcon
W
_AddRef
*/
static
ULONG
WINAPI
IExtractIcon
A_fnAddRef
(
IExtractIconA
*
iface
)
static
ULONG
WINAPI
IExtractIcon
W_fnAddRef
(
IExtractIconW
*
iface
)
{
ICOM_THIS
(
IExtractIcon
AImpl
,
iface
);
ICOM_THIS
(
IExtractIcon
WImpl
,
iface
);
TRACE
(
"(%p)->(count=%lu)
\n
"
,
This
,
This
->
ref
);
return
++
(
This
->
ref
);
}
/**************************************************************************
* IExtractIcon
A
_Release
* IExtractIcon
W
_Release
*/
static
ULONG
WINAPI
IExtractIcon
A_fnRelease
(
IExtractIconA
*
iface
)
static
ULONG
WINAPI
IExtractIcon
W_fnRelease
(
IExtractIconW
*
iface
)
{
ICOM_THIS
(
IExtractIcon
AImpl
,
iface
);
ICOM_THIS
(
IExtractIcon
WImpl
,
iface
);
TRACE
(
"(%p)->()
\n
"
,
This
);
if
(
!--
(
This
->
ref
))
{
TRACE
(
" destroying IExtractIcon(%p)
\n
"
,
This
);
{
TRACE
(
" destroying IExtractIcon(%p)
\n
"
,
This
);
SHFree
(
This
->
pidl
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
0
;
}
return
This
->
ref
;
}
static
WCHAR
swShell32Name
[]
=
{
's'
,
'h'
,
'e'
,
'l'
,
'l'
,
'3'
,
'2'
,
'.'
,
'd'
,
'l'
,
'l'
,
0
};
/**************************************************************************
* IExtractIcon
A
_GetIconLocation
* IExtractIcon
W
_GetIconLocation
*
* mapping filetype to icon
*/
static
HRESULT
WINAPI
IExtractIcon
A
_fnGetIconLocation
(
IExtractIcon
A
*
iface
,
UINT
uFlags
,
LPSTR
szIconFile
,
static
HRESULT
WINAPI
IExtractIcon
W
_fnGetIconLocation
(
IExtractIcon
W
*
iface
,
UINT
uFlags
,
/* GIL_ flags */
LP
W
STR
szIconFile
,
UINT
cchMax
,
int
*
piIndex
,
UINT
*
pwFlags
)
UINT
*
pwFlags
)
/* returned GIL_ flags */
{
ICOM_THIS
(
IExtractIcon
AImpl
,
iface
);
ICOM_THIS
(
IExtractIcon
WImpl
,
iface
);
char
sTemp
[
MAX_PATH
];
DWORD
dwNr
;
...
...
@@ -155,27 +172,28 @@ static HRESULT WINAPI IExtractIconA_fnGetIconLocation(
if
(
_ILIsDesktop
(
pSimplePidl
))
{
lstrcpyn
A
(
szIconFile
,
"shell32.dll"
,
cchMax
);
lstrcpyn
W
(
szIconFile
,
swShell32Name
,
cchMax
);
*
piIndex
=
34
;
}
/* my computer and other shell extensions */
else
if
(
(
riid
=
_ILGetGUIDPointer
(
pSimplePidl
))
)
else
if
(
(
riid
=
_ILGetGUIDPointer
(
pSimplePidl
))
)
{
char
xriid
[
50
];
sprintf
(
xriid
,
"CLSID
\\
{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}"
,
sprintf
(
xriid
,
"CLSID
\\
{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}"
,
riid
->
Data1
,
riid
->
Data2
,
riid
->
Data3
,
riid
->
Data4
[
0
],
riid
->
Data4
[
1
],
riid
->
Data4
[
2
],
riid
->
Data4
[
3
],
riid
->
Data4
[
4
],
riid
->
Data4
[
5
],
riid
->
Data4
[
6
],
riid
->
Data4
[
7
]
);
riid
->
Data4
[
4
],
riid
->
Data4
[
5
],
riid
->
Data4
[
6
],
riid
->
Data4
[
7
]
);
if
(
HCR_GetDefaultIcon
(
xriid
,
sTemp
,
MAX_PATH
,
&
dwNr
))
{
lstrcpynA
(
szIconFile
,
sTemp
,
cchMax
);
MultiByteToWideChar
(
CP_ACP
,
0
,
sTemp
,
MAX_PATH
,
szIconFile
,
cchMax
);
*
piIndex
=
dwNr
;
}
else
{
lstrcpyn
A
(
szIconFile
,
"shell32.dll"
,
cchMax
);
lstrcpyn
W
(
szIconFile
,
swShell32Name
,
cchMax
);
*
piIndex
=
15
;
}
}
...
...
@@ -184,12 +202,12 @@ static HRESULT WINAPI IExtractIconA_fnGetIconLocation(
{
if
(
HCR_GetDefaultIcon
(
"Drive"
,
sTemp
,
MAX_PATH
,
&
dwNr
))
{
lstrcpynA
(
szIconFile
,
sTemp
,
cchMax
);
MultiByteToWideChar
(
CP_ACP
,
0
,
sTemp
,
MAX_PATH
,
szIconFile
,
cchMax
);
*
piIndex
=
dwNr
;
}
else
{
lstrcpyn
A
(
szIconFile
,
"shell32.dll"
,
cchMax
);
lstrcpyn
W
(
szIconFile
,
swShell32Name
,
cchMax
);
*
piIndex
=
8
;
}
}
...
...
@@ -197,47 +215,50 @@ static HRESULT WINAPI IExtractIconA_fnGetIconLocation(
{
if
(
HCR_GetDefaultIcon
(
"Folder"
,
sTemp
,
MAX_PATH
,
&
dwNr
))
{
lstrcpynA
(
szIconFile
,
sTemp
,
cchMax
);
*
piIndex
=
dwNr
;
MultiByteToWideChar
(
CP_ACP
,
0
,
sTemp
,
MAX_PATH
,
szIconFile
,
cchMax
);
}
else
{
lstrcpyn
A
(
szIconFile
,
"shell32.dll"
,
cchMax
);
*
piIndex
=
(
uFlags
&
GIL_OPENICON
)
?
4
:
3
;
lstrcpyn
W
(
szIconFile
,
swShell32Name
,
cchMax
);
dwNr
=
3
;
}
*
piIndex
=
(
uFlags
&
GIL_OPENICON
)
?
dwNr
+
1
:
dwNr
;
}
else
/* object is file */
{
if
(
_ILGetExtension
(
pSimplePidl
,
sTemp
,
MAX_PATH
)
if
(
_ILGetExtension
(
pSimplePidl
,
sTemp
,
MAX_PATH
)
&&
HCR_MapTypeToValue
(
sTemp
,
sTemp
,
MAX_PATH
,
TRUE
)
&&
HCR_GetDefaultIcon
(
sTemp
,
sTemp
,
MAX_PATH
,
&
dwNr
))
{
if
(
!
strcmp
(
"%1"
,
sTemp
))
/* icon is in the file */
if
(
!
lstrcmpA
(
"%1"
,
sTemp
))
/* icon is in the file */
{
SHGetPathFromIDList
A
(
This
->
pidl
,
sTemp
);
dwNr
=
0
;
SHGetPathFromIDList
W
(
This
->
pidl
,
szIconFile
);
*
piIndex
=
0
;
}
lstrcpynA
(
szIconFile
,
sTemp
,
cchMax
);
else
{
MultiByteToWideChar
(
CP_ACP
,
0
,
sTemp
,
MAX_PATH
,
szIconFile
,
cchMax
);
*
piIndex
=
dwNr
;
}
}
else
/* default icon */
{
lstrcpyn
A
(
szIconFile
,
"shell32.dll"
,
cchMax
);
lstrcpyn
W
(
szIconFile
,
swShell32Name
,
cchMax
);
*
piIndex
=
0
;
}
}
TRACE
(
"-- %s %x
\n
"
,
szIconFile
,
*
piIndex
);
TRACE
(
"-- %s %x
\n
"
,
debugstr_w
(
szIconFile
)
,
*
piIndex
);
return
NOERROR
;
}
/**************************************************************************
* IExtractIcon
A
_Extract
* IExtractIcon
W
_Extract
*/
static
HRESULT
WINAPI
IExtractIcon
A_fnExtract
(
IExtractIconA
*
iface
,
LPC
STR
pszFile
,
UINT
nIconIndex
,
HICON
*
phiconLarge
,
HICON
*
phiconSmall
,
UINT
nIconSize
)
static
HRESULT
WINAPI
IExtractIcon
W_fnExtract
(
IExtractIconW
*
iface
,
LPCW
STR
pszFile
,
UINT
nIconIndex
,
HICON
*
phiconLarge
,
HICON
*
phiconSmall
,
UINT
nIconSize
)
{
ICOM_THIS
(
IExtractIcon
AImpl
,
iface
);
ICOM_THIS
(
IExtractIcon
WImpl
,
iface
);
FIXME
(
"(%p) (file=%p index=%u %p %p size=%u) semi-stub
\n
"
,
This
,
pszFile
,
nIconIndex
,
phiconLarge
,
phiconSmall
,
nIconSize
);
FIXME
(
"(%p) (file=%p index=%u %p %p size=%u) semi-stub
\n
"
,
This
,
debugstr_w
(
pszFile
)
,
nIconIndex
,
phiconLarge
,
phiconSmall
,
nIconSize
);
if
(
phiconLarge
)
*
phiconLarge
=
ImageList_GetIcon
(
ShellBigIconList
,
nIconIndex
,
ILD_TRANSPARENT
);
...
...
@@ -248,7 +269,98 @@ static HRESULT WINAPI IExtractIconA_fnExtract(IExtractIconA * iface, LPCSTR pszF
return
S_OK
;
}
static
struct
ICOM_VTABLE
(
IExtractIconA
)
eivt
=
static
struct
ICOM_VTABLE
(
IExtractIconW
)
eivt
=
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IExtractIconW_fnQueryInterface
,
IExtractIconW_fnAddRef
,
IExtractIconW_fnRelease
,
IExtractIconW_fnGetIconLocation
,
IExtractIconW_fnExtract
};
/**************************************************************************
* IExtractIconA_Constructor
*/
IExtractIconA
*
IExtractIconA_Constructor
(
LPCITEMIDLIST
pidl
)
{
ICOM_THIS
(
IExtractIconWImpl
,
IExtractIconW_Constructor
(
pidl
));
return
(
IExtractIconA
*
)
This
->
lpvtblExtractIconA
;
}
/**************************************************************************
* IExtractIconA_QueryInterface
*/
static
HRESULT
WINAPI
IExtractIconA_fnQueryInterface
(
IExtractIconA
*
iface
,
REFIID
riid
,
LPVOID
*
ppvObj
)
{
_ICOM_THIS_From_IExtractIconA
(
IExtractIconW
,
iface
);
return
IExtractIconW_QueryInterface
(
This
,
riid
,
ppvObj
);
}
/**************************************************************************
* IExtractIconA_AddRef
*/
static
ULONG
WINAPI
IExtractIconA_fnAddRef
(
IExtractIconA
*
iface
)
{
_ICOM_THIS_From_IExtractIconA
(
IExtractIconW
,
iface
);
return
IExtractIconW_AddRef
(
This
);
}
/**************************************************************************
* IExtractIconA_Release
*/
static
ULONG
WINAPI
IExtractIconA_fnRelease
(
IExtractIconA
*
iface
)
{
_ICOM_THIS_From_IExtractIconA
(
IExtractIconW
,
iface
);
return
IExtractIconW_AddRef
(
This
);
}
/**************************************************************************
* IExtractIconA_GetIconLocation
*
* mapping filetype to icon
*/
static
HRESULT
WINAPI
IExtractIconA_fnGetIconLocation
(
IExtractIconA
*
iface
,
UINT
uFlags
,
LPSTR
szIconFile
,
UINT
cchMax
,
int
*
piIndex
,
UINT
*
pwFlags
)
{
HRESULT
ret
;
LPWSTR
lpwstrFile
=
HeapAlloc
(
GetProcessHeap
(),
0
,
cchMax
*
sizeof
(
WCHAR
));
_ICOM_THIS_From_IExtractIconA
(
IExtractIconW
,
iface
);
TRACE
(
"(%p) (flags=%u %p %u %p %p)
\n
"
,
This
,
uFlags
,
szIconFile
,
cchMax
,
piIndex
,
pwFlags
);
ret
=
IExtractIconW_GetIconLocation
(
This
,
uFlags
,
lpwstrFile
,
cchMax
,
piIndex
,
pwFlags
);
WideCharToMultiByte
(
CP_ACP
,
0
,
lpwstrFile
,
cchMax
,
szIconFile
,
cchMax
,
NULL
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
lpwstrFile
);
TRACE
(
"-- %s %x
\n
"
,
szIconFile
,
*
piIndex
);
return
ret
;
}
/**************************************************************************
* IExtractIconA_Extract
*/
static
HRESULT
WINAPI
IExtractIconA_fnExtract
(
IExtractIconA
*
iface
,
LPCSTR
pszFile
,
UINT
nIconIndex
,
HICON
*
phiconLarge
,
HICON
*
phiconSmall
,
UINT
nIconSize
)
{
HRESULT
ret
;
INT
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
pszFile
,
-
1
,
NULL
,
0
);
LPWSTR
lpwstrFile
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
_ICOM_THIS_From_IExtractIconA
(
IExtractIconW
,
iface
);
TRACE
(
"(%p) (file=%p index=%u %p %p size=%u)
\n
"
,
This
,
pszFile
,
nIconIndex
,
phiconLarge
,
phiconSmall
,
nIconSize
);
MultiByteToWideChar
(
CP_ACP
,
0
,
pszFile
,
-
1
,
lpwstrFile
,
len
);
ret
=
IExtractIconW_Extract
(
This
,
lpwstrFile
,
nIconIndex
,
phiconLarge
,
phiconSmall
,
nIconSize
);
HeapFree
(
GetProcessHeap
(),
0
,
lpwstrFile
);
return
ret
;
}
static
struct
ICOM_VTABLE
(
IExtractIconA
)
eiavt
=
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IExtractIconA_fnQueryInterface
,
...
...
@@ -266,9 +378,9 @@ static HRESULT WINAPI IEIPersistFile_fnQueryInterface(
REFIID
iid
,
LPVOID
*
ppvObj
)
{
_ICOM_THIS_From_IPersistFile
(
IExtractIcon
A
,
iface
);
_ICOM_THIS_From_IPersistFile
(
IExtractIcon
W
,
iface
);
return
I
ShellFolder_QueryInterface
((
IExtractIconA
*
)
This
,
iid
,
ppvObj
);
return
I
ExtractIconW_QueryInterface
(
This
,
iid
,
ppvObj
);
}
/************************************************************************
...
...
@@ -277,9 +389,9 @@ static HRESULT WINAPI IEIPersistFile_fnQueryInterface(
static
ULONG
WINAPI
IEIPersistFile_fnAddRef
(
IPersistFile
*
iface
)
{
_ICOM_THIS_From_IPersistFile
(
IExtractIcon
A
,
iface
);
_ICOM_THIS_From_IPersistFile
(
IExtractIcon
W
,
iface
);
return
IExtractIcon
A_AddRef
((
IExtractIconA
*
)
This
);
return
IExtractIcon
W_AddRef
(
This
);
}
/************************************************************************
...
...
@@ -288,9 +400,9 @@ static ULONG WINAPI IEIPersistFile_fnAddRef(
static
ULONG
WINAPI
IEIPersistFile_fnRelease
(
IPersistFile
*
iface
)
{
_ICOM_THIS_From_IPersistFile
(
IExtractIcon
A
,
iface
);
_ICOM_THIS_From_IPersistFile
(
IExtractIcon
W
,
iface
);
return
IExtractIcon
A_Release
((
IExtractIconA
*
)
This
);
return
IExtractIcon
W_Release
(
This
);
}
/************************************************************************
...
...
@@ -315,7 +427,7 @@ static HRESULT WINAPI IEIPersistFile_fnGetClassID(
*/
static
HRESULT
WINAPI
IEIPersistFile_fnLoad
(
IPersistFile
*
iface
,
LPCOLESTR
pszFileName
,
DWORD
dwMode
)
{
_ICOM_THIS_From_IPersistFile
(
IExtractIcon
A
,
iface
);
_ICOM_THIS_From_IPersistFile
(
IExtractIcon
W
,
iface
);
FIXME
(
"%p
\n
"
,
This
);
return
E_NOTIMPL
;
...
...
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