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
1ab301d7
Commit
1ab301d7
authored
Apr 12, 2004
by
Martin Fuchs
Committed by
Alexandre Julliard
Apr 12, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- eliminate MSVC type conversion warning
- IShellLink::GetIconLocation(): get icons for shell links if not already set
parent
a1f01d35
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
124 additions
and
13 deletions
+124
-13
shelllink.c
dlls/shell32/shelllink.c
+124
-13
No files found.
dlls/shell32/shelllink.c
View file @
1ab301d7
...
@@ -289,7 +289,7 @@ static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFile
...
@@ -289,7 +289,7 @@ static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFile
TRACE
(
"(%p)->(%s)
\n
"
,
This
,
debugstr_w
(
pszFileName
));
TRACE
(
"(%p)->(%s)
\n
"
,
This
,
debugstr_w
(
pszFileName
));
if
(
!
pszFileName
||
!
This
->
sPath
)
if
(
!
pszFileName
||
!
This
->
sPath
)
return
E
RROR_UNKNOWN
;
return
E
_FAIL
;
r
=
CreateStreamOnFile
(
pszFileName
,
STGM_READWRITE
|
STGM_CREATE
,
&
stm
);
r
=
CreateStreamOnFile
(
pszFileName
,
STGM_READWRITE
|
STGM_CREATE
,
&
stm
);
if
(
SUCCEEDED
(
r
)
)
if
(
SUCCEEDED
(
r
)
)
...
@@ -546,7 +546,7 @@ static HRESULT WINAPI IPersistStream_fnLoad(
...
@@ -546,7 +546,7 @@ static HRESULT WINAPI IPersistStream_fnLoad(
if
(
FAILED
(
r
)
)
if
(
FAILED
(
r
)
)
return
r
;
return
r
;
}
}
This
->
wHotKey
=
hdr
.
wHotKey
;
This
->
wHotKey
=
(
WORD
)
hdr
.
wHotKey
;
This
->
iIcoNdx
=
hdr
.
nIcon
;
This
->
iIcoNdx
=
hdr
.
nIcon
;
FileTimeToSystemTime
(
&
hdr
.
Time1
,
&
This
->
time1
);
FileTimeToSystemTime
(
&
hdr
.
Time1
,
&
This
->
time1
);
FileTimeToSystemTime
(
&
hdr
.
Time2
,
&
This
->
time2
);
FileTimeToSystemTime
(
&
hdr
.
Time2
,
&
This
->
time2
);
...
@@ -1195,20 +1195,75 @@ static HRESULT WINAPI IShellLinkA_fnSetShowCmd(IShellLinkA * iface, INT iShowCmd
...
@@ -1195,20 +1195,75 @@ static HRESULT WINAPI IShellLinkA_fnSetShowCmd(IShellLinkA * iface, INT iShowCmd
return
NOERROR
;
return
NOERROR
;
}
}
static
HRESULT
SHELL_PidlGeticonLocationA
(
IShellFolder
*
psf
,
LPITEMIDLIST
pidl
,
LPSTR
pszIconPath
,
int
cchIconPath
,
int
*
piIcon
)
{
LPCITEMIDLIST
pidlLast
;
HRESULT
hr
=
SHBindToParent
(
pidl
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
psf
,
&
pidlLast
);
if
(
SUCCEEDED
(
hr
))
{
IExtractIconA
*
pei
;
hr
=
IShellFolder_GetUIObjectOf
(
psf
,
0
,
1
,
(
LPCITEMIDLIST
*
)
&
pidlLast
,
&
IID_IExtractIconA
,
NULL
,
(
LPVOID
*
)
&
pei
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IExtractIconA_GetIconLocation
(
pei
,
0
,
pszIconPath
,
MAX_PATH
,
piIcon
,
NULL
);
IExtractIconA_Release
(
pei
);
}
IShellFolder_Release
(
psf
);
}
return
hr
;
}
static
HRESULT
WINAPI
IShellLinkA_fnGetIconLocation
(
IShellLinkA
*
iface
,
LPSTR
pszIconPath
,
INT
cchIconPath
,
INT
*
piIcon
)
static
HRESULT
WINAPI
IShellLinkA_fnGetIconLocation
(
IShellLinkA
*
iface
,
LPSTR
pszIconPath
,
INT
cchIconPath
,
INT
*
piIcon
)
{
{
ICOM_THIS
(
IShellLinkImpl
,
iface
);
ICOM_THIS
(
IShellLinkImpl
,
iface
);
TRACE
(
"(%p)->(%p len=%u iicon=%p)
\n
"
,
This
,
pszIconPath
,
cchIconPath
,
piIcon
);
TRACE
(
"(%p)->(%p len=%u iicon=%p)
\n
"
,
This
,
pszIconPath
,
cchIconPath
,
piIcon
);
if
(
cchIconPath
)
if
(
cchIconPath
)
pszIconPath
[
0
]
=
0
;
pszIconPath
[
0
]
=
0
;
if
(
This
->
sIcoPath
)
WideCharToMultiByte
(
CP_ACP
,
0
,
This
->
sIcoPath
,
-
1
,
pszIconPath
,
cchIconPath
,
NULL
,
NULL
);
*
piIcon
=
This
->
iIcoNdx
;
return
NOERROR
;
if
(
This
->
sIcoPath
)
{
WideCharToMultiByte
(
CP_ACP
,
0
,
This
->
sIcoPath
,
-
1
,
pszIconPath
,
cchIconPath
,
NULL
,
NULL
);
*
piIcon
=
This
->
iIcoNdx
;
return
S_OK
;
}
if
(
This
->
pPidl
||
This
->
sPath
)
{
IShellFolder
*
pdsk
;
HRESULT
hr
=
SHGetDesktopFolder
(
&
pdsk
);
if
(
SUCCEEDED
(
hr
))
{
/* first look for an icon using the PIDL (if present) */
if
(
This
->
pPidl
)
hr
=
SHELL_PidlGeticonLocationA
(
pdsk
,
This
->
pPidl
,
pszIconPath
,
cchIconPath
,
piIcon
);
else
hr
=
E_FAIL
;
/* if we couldn't find an icon yet, look for it using the file system path */
if
(
FAILED
(
hr
)
&&
This
->
sPath
)
{
LPITEMIDLIST
pidl
;
hr
=
IShellFolder_ParseDisplayName
(
pdsk
,
0
,
NULL
,
This
->
sPath
,
NULL
,
&
pidl
,
NULL
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
SHELL_PidlGeticonLocationA
(
pdsk
,
pidl
,
pszIconPath
,
cchIconPath
,
piIcon
);
SHFree
(
pidl
);
}
}
IShellFolder_Release
(
pdsk
);
}
return
hr
;
}
else
return
E_FAIL
;
}
}
static
HRESULT
WINAPI
IShellLinkA_fnSetIconLocation
(
IShellLinkA
*
iface
,
LPCSTR
pszIconPath
,
INT
iIcon
)
static
HRESULT
WINAPI
IShellLinkA_fnSetIconLocation
(
IShellLinkA
*
iface
,
LPCSTR
pszIconPath
,
INT
iIcon
)
...
@@ -1519,19 +1574,75 @@ static HRESULT WINAPI IShellLinkW_fnSetShowCmd(IShellLinkW * iface, INT iShowCmd
...
@@ -1519,19 +1574,75 @@ static HRESULT WINAPI IShellLinkW_fnSetShowCmd(IShellLinkW * iface, INT iShowCmd
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
SHELL_PidlGeticonLocationW
(
IShellFolder
*
psf
,
LPITEMIDLIST
pidl
,
LPWSTR
pszIconPath
,
int
cchIconPath
,
int
*
piIcon
)
{
LPCITEMIDLIST
pidlLast
;
HRESULT
hr
=
SHBindToParent
(
pidl
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
psf
,
&
pidlLast
);
if
(
SUCCEEDED
(
hr
))
{
IExtractIconW
*
pei
;
hr
=
IShellFolder_GetUIObjectOf
(
psf
,
0
,
1
,
(
LPCITEMIDLIST
*
)
&
pidlLast
,
&
IID_IExtractIconW
,
NULL
,
(
LPVOID
*
)
&
pei
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IExtractIconW_GetIconLocation
(
pei
,
0
,
pszIconPath
,
MAX_PATH
,
piIcon
,
NULL
);
IExtractIconW_Release
(
pei
);
}
IShellFolder_Release
(
psf
);
}
return
hr
;
}
static
HRESULT
WINAPI
IShellLinkW_fnGetIconLocation
(
IShellLinkW
*
iface
,
LPWSTR
pszIconPath
,
INT
cchIconPath
,
INT
*
piIcon
)
static
HRESULT
WINAPI
IShellLinkW_fnGetIconLocation
(
IShellLinkW
*
iface
,
LPWSTR
pszIconPath
,
INT
cchIconPath
,
INT
*
piIcon
)
{
{
_ICOM_THIS_From_IShellLinkW
(
IShellLinkImpl
,
iface
);
_ICOM_THIS_From_IShellLinkW
(
IShellLinkImpl
,
iface
);
TRACE
(
"(%p)->(%p len=%u iicon=%p)
\n
"
,
This
,
pszIconPath
,
cchIconPath
,
piIcon
);
TRACE
(
"(%p)->(%p len=%u iicon=%p)
\n
"
,
This
,
pszIconPath
,
cchIconPath
,
piIcon
);
if
(
cchIconPath
)
if
(
cchIconPath
)
pszIconPath
[
0
]
=
0
;
pszIconPath
[
0
]
=
0
;
if
(
This
->
sIcoPath
)
lstrcpynW
(
pszIconPath
,
This
->
sIcoPath
,
cchIconPath
);
*
piIcon
=
This
->
iIcoNdx
;
return
S_OK
;
if
(
This
->
sIcoPath
)
{
lstrcpynW
(
pszIconPath
,
This
->
sIcoPath
,
cchIconPath
);
*
piIcon
=
This
->
iIcoNdx
;
return
S_OK
;
}
if
(
This
->
pPidl
||
This
->
sPath
)
{
IShellFolder
*
pdsk
;
HRESULT
hr
=
SHGetDesktopFolder
(
&
pdsk
);
if
(
SUCCEEDED
(
hr
))
{
/* first look for an icon using the PIDL (if present) */
if
(
This
->
pPidl
)
hr
=
SHELL_PidlGeticonLocationW
(
pdsk
,
This
->
pPidl
,
pszIconPath
,
cchIconPath
,
piIcon
);
else
hr
=
E_FAIL
;
/* if we couldn't find an icon yet, look for it using the file system path */
if
(
FAILED
(
hr
)
&&
This
->
sPath
)
{
LPITEMIDLIST
pidl
;
hr
=
IShellFolder_ParseDisplayName
(
pdsk
,
0
,
NULL
,
This
->
sPath
,
NULL
,
&
pidl
,
NULL
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
SHELL_PidlGeticonLocationW
(
pdsk
,
pidl
,
pszIconPath
,
cchIconPath
,
piIcon
);
SHFree
(
pidl
);
}
}
IShellFolder_Release
(
pdsk
);
}
return
hr
;
}
else
return
E_FAIL
;
}
}
static
HRESULT
WINAPI
IShellLinkW_fnSetIconLocation
(
IShellLinkW
*
iface
,
LPCWSTR
pszIconPath
,
INT
iIcon
)
static
HRESULT
WINAPI
IShellLinkW_fnSetIconLocation
(
IShellLinkW
*
iface
,
LPCWSTR
pszIconPath
,
INT
iIcon
)
...
...
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