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
c0a1eff7
Commit
c0a1eff7
authored
Sep 30, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32/shelllink: Fix NULL path handling in SetIconLocation().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d8249c63
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
15 deletions
+50
-15
shelllink.c
dlls/shell32/shelllink.c
+22
-14
shelllink.c
dlls/shell32/tests/shelllink.c
+28
-1
No files found.
dlls/shell32/shelllink.c
View file @
c0a1eff7
...
...
@@ -1464,19 +1464,22 @@ static HRESULT WINAPI IShellLinkA_fnGetIconLocation(IShellLinkA *iface, LPSTR ps
return
S_OK
;
}
static
HRESULT
WINAPI
IShellLinkA_fnSetIconLocation
(
IShellLinkA
*
iface
,
LPCSTR
pszIconPath
,
INT
iIcon
)
static
HRESULT
WINAPI
IShellLinkA_fnSetIconLocation
(
IShellLinkA
*
iface
,
LPCSTR
path
,
INT
icon
)
{
IShellLinkImpl
*
This
=
impl_from_IShellLinkA
(
iface
);
WCHAR
*
pathW
;
WCHAR
*
pathW
=
NULL
;
HRESULT
hr
;
TRACE
(
"(%p)->(path=%s i
icon=%u)
\n
"
,
This
,
pszIconPath
,
iI
con
);
TRACE
(
"(%p)->(path=%s i
con=%u)
\n
"
,
This
,
debugstr_a
(
path
),
i
con
);
pathW
=
heap_strdupAtoW
(
pszIconPath
);
if
(
!
pathW
)
return
E_OUTOFMEMORY
;
if
(
path
)
{
pathW
=
heap_strdupAtoW
(
path
);
if
(
!
pathW
)
return
E_OUTOFMEMORY
;
}
hr
=
IShellLinkW_SetIconLocation
(
&
This
->
IShellLinkW_iface
,
path
W
,
iI
con
);
hr
=
IShellLinkW_SetIconLocation
(
&
This
->
IShellLinkW_iface
,
path
?
pathW
:
NULL
,
i
con
);
heap_free
(
pathW
);
return
hr
;
...
...
@@ -1927,19 +1930,24 @@ static HRESULT WINAPI IShellLinkW_fnGetIconLocation(IShellLinkW * iface, LPWSTR
return
S_OK
;
}
static
HRESULT
WINAPI
IShellLinkW_fnSetIconLocation
(
IShellLinkW
*
iface
,
LPCWSTR
pszIconPath
,
INT
iI
con
)
static
HRESULT
WINAPI
IShellLinkW_fnSetIconLocation
(
IShellLinkW
*
iface
,
const
WCHAR
*
path
,
INT
i
con
)
{
IShellLinkImpl
*
This
=
impl_from_IShellLinkW
(
iface
);
TRACE
(
"(%p)->(path=%s i
icon=%u)
\n
"
,
This
,
debugstr_w
(
pszIconPath
),
iI
con
);
TRACE
(
"(%p)->(path=%s i
con=%u)
\n
"
,
This
,
debugstr_w
(
path
),
i
con
);
heap_free
(
This
->
sIcoPath
);
This
->
sIcoPath
=
heap_alloc
((
lstrlenW
(
pszIconPath
)
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
!
This
->
sIcoPath
)
if
(
path
)
{
size_t
len
=
(
strlenW
(
path
)
+
1
)
*
sizeof
(
WCHAR
);
This
->
sIcoPath
=
heap_alloc
(
len
);
if
(
!
This
->
sIcoPath
)
return
E_OUTOFMEMORY
;
lstrcpyW
(
This
->
sIcoPath
,
pszIconPath
);
This
->
iIcoNdx
=
iIcon
;
memcpy
(
This
->
sIcoPath
,
path
,
len
);
}
else
This
->
sIcoPath
=
NULL
;
This
->
iIcoNdx
=
icon
;
This
->
bDirty
=
TRUE
;
return
S_OK
;
...
...
dlls/shell32/tests/shelllink.c
View file @
c0a1eff7
...
...
@@ -973,6 +973,7 @@ static void test_shdefextracticon(void)
static
void
test_GetIconLocation
(
void
)
{
IShellLinkW
*
slW
;
IShellLinkA
*
sl
;
const
char
*
str
;
char
buffer
[
INFOTIPSIZE
],
mypath
[
MAX_PATH
];
...
...
@@ -1026,8 +1027,34 @@ static void test_GetIconLocation(void)
r
=
IShellLinkA_GetIconLocation
(
sl
,
buffer
,
sizeof
(
buffer
),
&
i
);
ok
(
r
==
S_OK
,
"GetIconLocation failed (0x%08x)
\n
"
,
r
);
ok
(
lstrcmpiA
(
buffer
,
str
)
==
0
,
"GetIconLocation returned '%s'
\n
"
,
buffer
);
ok
(
i
==
0xbabecafe
,
"GetIconLocation returned %
d'
\n
"
,
i
);
ok
(
i
==
0xbabecafe
,
"GetIconLocation returned %
#x.
\n
"
,
i
);
r
=
IShellLinkA_SetIconLocation
(
sl
,
NULL
,
0xcafefe
);
ok
(
r
==
S_OK
,
"SetIconLocation failed (0x%08x)
\n
"
,
r
);
i
=
0xdeadbeef
;
r
=
IShellLinkA_GetIconLocation
(
sl
,
buffer
,
sizeof
(
buffer
),
&
i
);
ok
(
r
==
S_OK
,
"GetIconLocation failed (0x%08x)
\n
"
,
r
);
ok
(
!*
buffer
,
"GetIconLocation returned '%s'
\n
"
,
buffer
);
ok
(
i
==
0xcafefe
,
"GetIconLocation returned %#x.
\n
"
,
i
);
r
=
IShellLinkA_QueryInterface
(
sl
,
&
IID_IShellLinkW
,
(
void
**
)
&
slW
);
ok
(
SUCCEEDED
(
r
),
"Failed to get IShellLinkW, hr %#x.
\n
"
,
r
);
str
=
"c:
\\
nonexistent
\\
file"
;
r
=
IShellLinkA_SetIconLocation
(
sl
,
str
,
0xbabecafe
);
ok
(
r
==
S_OK
,
"SetIconLocation failed (0x%08x)
\n
"
,
r
);
r
=
IShellLinkA_SetIconLocation
(
sl
,
NULL
,
0xcafefe
);
ok
(
r
==
S_OK
,
"SetIconLocation failed (0x%08x)
\n
"
,
r
);
i
=
0xdeadbeef
;
r
=
IShellLinkA_GetIconLocation
(
sl
,
buffer
,
sizeof
(
buffer
),
&
i
);
ok
(
r
==
S_OK
,
"GetIconLocation failed (0x%08x)
\n
"
,
r
);
ok
(
!*
buffer
,
"GetIconLocation returned '%s'
\n
"
,
buffer
);
ok
(
i
==
0xcafefe
,
"GetIconLocation returned %#x.
\n
"
,
i
);
IShellLinkW_Release
(
slW
);
IShellLinkA_Release
(
sl
);
}
...
...
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