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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
16 deletions
+51
-16
shelllink.c
dlls/shell32/shelllink.c
+23
-15
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
...
@@ -1464,19 +1464,22 @@ static HRESULT WINAPI IShellLinkA_fnGetIconLocation(IShellLinkA *iface, LPSTR ps
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
WINAPI
IShellLinkA_fnSetIconLocation
(
IShellLinkA
*
iface
,
LPCSTR
pszIconPath
,
static
HRESULT
WINAPI
IShellLinkA_fnSetIconLocation
(
IShellLinkA
*
iface
,
LPCSTR
path
,
INT
icon
)
INT
iIcon
)
{
{
IShellLinkImpl
*
This
=
impl_from_IShellLinkA
(
iface
);
IShellLinkImpl
*
This
=
impl_from_IShellLinkA
(
iface
);
WCHAR
*
pathW
;
WCHAR
*
pathW
=
NULL
;
HRESULT
hr
;
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
(
path
)
if
(
!
pathW
)
return
E_OUTOFMEMORY
;
{
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
);
heap_free
(
pathW
);
return
hr
;
return
hr
;
...
@@ -1927,19 +1930,24 @@ static HRESULT WINAPI IShellLinkW_fnGetIconLocation(IShellLinkW * iface, LPWSTR
...
@@ -1927,19 +1930,24 @@ static HRESULT WINAPI IShellLinkW_fnGetIconLocation(IShellLinkW * iface, LPWSTR
return
S_OK
;
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
);
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
);
heap_free
(
This
->
sIcoPath
);
This
->
sIcoPath
=
heap_alloc
((
lstrlenW
(
pszIconPath
)
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
path
)
if
(
!
This
->
sIcoPath
)
{
return
E_OUTOFMEMORY
;
size_t
len
=
(
strlenW
(
path
)
+
1
)
*
sizeof
(
WCHAR
);
lstrcpyW
(
This
->
sIcoPath
,
pszIconPath
);
This
->
sIcoPath
=
heap_alloc
(
len
);
if
(
!
This
->
sIcoPath
)
This
->
iIcoNdx
=
iIcon
;
return
E_OUTOFMEMORY
;
memcpy
(
This
->
sIcoPath
,
path
,
len
);
}
else
This
->
sIcoPath
=
NULL
;
This
->
iIcoNdx
=
icon
;
This
->
bDirty
=
TRUE
;
This
->
bDirty
=
TRUE
;
return
S_OK
;
return
S_OK
;
...
...
dlls/shell32/tests/shelllink.c
View file @
c0a1eff7
...
@@ -973,6 +973,7 @@ static void test_shdefextracticon(void)
...
@@ -973,6 +973,7 @@ static void test_shdefextracticon(void)
static
void
test_GetIconLocation
(
void
)
static
void
test_GetIconLocation
(
void
)
{
{
IShellLinkW
*
slW
;
IShellLinkA
*
sl
;
IShellLinkA
*
sl
;
const
char
*
str
;
const
char
*
str
;
char
buffer
[
INFOTIPSIZE
],
mypath
[
MAX_PATH
];
char
buffer
[
INFOTIPSIZE
],
mypath
[
MAX_PATH
];
...
@@ -1026,8 +1027,34 @@ static void test_GetIconLocation(void)
...
@@ -1026,8 +1027,34 @@ static void test_GetIconLocation(void)
r
=
IShellLinkA_GetIconLocation
(
sl
,
buffer
,
sizeof
(
buffer
),
&
i
);
r
=
IShellLinkA_GetIconLocation
(
sl
,
buffer
,
sizeof
(
buffer
),
&
i
);
ok
(
r
==
S_OK
,
"GetIconLocation failed (0x%08x)
\n
"
,
r
);
ok
(
r
==
S_OK
,
"GetIconLocation failed (0x%08x)
\n
"
,
r
);
ok
(
lstrcmpiA
(
buffer
,
str
)
==
0
,
"GetIconLocation returned '%s'
\n
"
,
buffer
);
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
);
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