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
52cde9b3
Commit
52cde9b3
authored
Feb 10, 2004
by
Jon Griffiths
Committed by
Alexandre Julliard
Feb 10, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
StrRetToStrN returns BOOL and shouldn't crash on NULL dest.
parent
2eee7670
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
44 deletions
+28
-44
shellstring.c
dlls/shell32/shellstring.c
+24
-26
shlview.c
dlls/shell32/shlview.c
+1
-1
undocshell.h
dlls/shell32/undocshell.h
+3
-17
No files found.
dlls/shell32/shellstring.c
View file @
52cde9b3
...
@@ -44,16 +44,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell);
...
@@ -44,16 +44,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell);
/************************* STRRET functions ****************************/
/************************* STRRET functions ****************************/
/*
BOOL
WINAPI
StrRetToStrNA
(
LPSTR
dest
,
DWORD
len
,
LPSTRRET
src
,
const
ITEMIDLIST
*
pidl
)
* ***** NOTE *****
* These routines are identical to StrRetToBuf[AW] in dlls/shlwapi/string.c.
* They were duplicated here because not every version of Shlwapi.dll exports
* StrRetToBuf[AW]. If you change one routine, change them both. YOU HAVE BEEN
* WARNED.
* ***** NOTE *****
*/
HRESULT
WINAPI
StrRetToStrNA
(
LPVOID
dest
,
DWORD
len
,
LPSTRRET
src
,
const
ITEMIDLIST
*
pidl
)
{
{
TRACE
(
"dest=%p len=0x%lx strret=%p(%s) pidl=%p
\n
"
,
TRACE
(
"dest=%p len=0x%lx strret=%p(%s) pidl=%p
\n
"
,
dest
,
len
,
src
,
dest
,
len
,
src
,
...
@@ -62,33 +53,36 @@ HRESULT WINAPI StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, const ITEMID
...
@@ -62,33 +53,36 @@ HRESULT WINAPI StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, const ITEMID
(
src
->
uType
==
STRRET_OFFSET
)
?
"STRRET_OFFSET"
:
"STRRET_???"
,
(
src
->
uType
==
STRRET_OFFSET
)
?
"STRRET_OFFSET"
:
"STRRET_???"
,
pidl
);
pidl
);
if
(
!
dest
)
return
FALSE
;
switch
(
src
->
uType
)
switch
(
src
->
uType
)
{
{
case
STRRET_WSTR
:
case
STRRET_WSTR
:
WideCharToMultiByte
(
CP_ACP
,
0
,
src
->
u
.
pOleStr
,
-
1
,
(
LPSTR
)
dest
,
len
,
NULL
,
NULL
);
WideCharToMultiByte
(
CP_ACP
,
0
,
src
->
u
.
pOleStr
,
-
1
,
dest
,
len
,
NULL
,
NULL
);
CoTaskMemFree
(
src
->
u
.
pOleStr
);
CoTaskMemFree
(
src
->
u
.
pOleStr
);
break
;
break
;
case
STRRET_CSTR
:
case
STRRET_CSTR
:
lstrcpynA
(
(
LPSTR
)
dest
,
src
->
u
.
cStr
,
len
);
lstrcpynA
(
dest
,
src
->
u
.
cStr
,
len
);
break
;
break
;
case
STRRET_OFFSET
:
case
STRRET_OFFSET
:
lstrcpynA
(
(
LPSTR
)
dest
,
((
LPCSTR
)
&
pidl
->
mkid
)
+
src
->
u
.
uOffset
,
len
);
lstrcpynA
(
dest
,
((
LPCSTR
)
&
pidl
->
mkid
)
+
src
->
u
.
uOffset
,
len
);
break
;
break
;
default:
default:
FIXME
(
"unknown type!
\n
"
);
FIXME
(
"unknown type!
\n
"
);
if
(
len
)
*
(
LPSTR
)
dest
=
'\0'
;
if
(
len
)
*
dest
=
'\0'
;
return
(
FALSE
)
;
return
FALSE
;
}
}
TRACE
(
"-- %s
\n
"
,
debugstr_a
(
dest
)
);
TRACE
(
"-- %s
\n
"
,
debugstr_a
(
dest
)
);
return
S_OK
;
return
TRUE
;
}
}
/************************************************************************/
/************************************************************************/
HRESULT
WINAPI
StrRetToStrNW
(
LPVOID
dest
,
DWORD
len
,
LPSTRRET
src
,
const
ITEMIDLIST
*
pidl
)
BOOL
WINAPI
StrRetToStrNW
(
LPWSTR
dest
,
DWORD
len
,
LPSTRRET
src
,
const
ITEMIDLIST
*
pidl
)
{
{
TRACE
(
"dest=%p len=0x%lx strret=%p(%s) pidl=%p
\n
"
,
TRACE
(
"dest=%p len=0x%lx strret=%p(%s) pidl=%p
\n
"
,
dest
,
len
,
src
,
dest
,
len
,
src
,
...
@@ -97,29 +91,32 @@ HRESULT WINAPI StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, const ITEMID
...
@@ -97,29 +91,32 @@ HRESULT WINAPI StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, const ITEMID
(
src
->
uType
==
STRRET_OFFSET
)
?
"STRRET_OFFSET"
:
"STRRET_???"
,
(
src
->
uType
==
STRRET_OFFSET
)
?
"STRRET_OFFSET"
:
"STRRET_???"
,
pidl
);
pidl
);
if
(
!
dest
)
return
FALSE
;
switch
(
src
->
uType
)
switch
(
src
->
uType
)
{
{
case
STRRET_WSTR
:
case
STRRET_WSTR
:
lstrcpynW
(
(
LPWSTR
)
dest
,
src
->
u
.
pOleStr
,
len
);
lstrcpynW
(
dest
,
src
->
u
.
pOleStr
,
len
);
CoTaskMemFree
(
src
->
u
.
pOleStr
);
CoTaskMemFree
(
src
->
u
.
pOleStr
);
break
;
break
;
case
STRRET_CSTR
:
case
STRRET_CSTR
:
if
(
!
MultiByteToWideChar
(
CP_ACP
,
0
,
src
->
u
.
cStr
,
-
1
,
dest
,
len
)
&&
len
)
if
(
!
MultiByteToWideChar
(
CP_ACP
,
0
,
src
->
u
.
cStr
,
-
1
,
dest
,
len
)
&&
len
)
((
LPWSTR
)
dest
)
[
len
-
1
]
=
0
;
dest
[
len
-
1
]
=
0
;
break
;
break
;
case
STRRET_OFFSET
:
case
STRRET_OFFSET
:
if
(
!
MultiByteToWideChar
(
CP_ACP
,
0
,
((
LPCSTR
)
&
pidl
->
mkid
)
+
src
->
u
.
uOffset
,
-
1
,
dest
,
len
)
&&
len
)
if
(
!
MultiByteToWideChar
(
CP_ACP
,
0
,
((
LPCSTR
)
&
pidl
->
mkid
)
+
src
->
u
.
uOffset
,
-
1
,
dest
,
len
)
&&
len
)
((
LPWSTR
)
dest
)
[
len
-
1
]
=
0
;
dest
[
len
-
1
]
=
0
;
break
;
break
;
default:
default:
FIXME
(
"unknown type!
\n
"
);
FIXME
(
"unknown type!
\n
"
);
if
(
len
)
*
(
LPWSTR
)
dest
=
'\0'
;
if
(
len
)
*
dest
=
'\0'
;
return
(
FALSE
)
;
return
FALSE
;
}
}
return
S_OK
;
return
TRUE
;
}
}
...
@@ -131,11 +128,12 @@ HRESULT WINAPI StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, const ITEMID
...
@@ -131,11 +128,12 @@ HRESULT WINAPI StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, const ITEMID
* NOTES
* NOTES
* the pidl is for STRRET OFFSET
* the pidl is for STRRET OFFSET
*/
*/
HRESULT
WINAPI
StrRetToStrNAW
(
LPVOID
dest
,
DWORD
len
,
LPSTRRET
src
,
const
ITEMIDLIST
*
pidl
)
BOOL
WINAPI
StrRetToStrNAW
(
LPVOID
dest
,
DWORD
len
,
LPSTRRET
src
,
const
ITEMIDLIST
*
pidl
)
{
{
if
(
SHELL_OsIsUnicode
())
if
(
SHELL_OsIsUnicode
())
return
StrRetToStrNW
(
dest
,
len
,
src
,
pidl
);
return
StrRetToStrNW
(
dest
,
len
,
src
,
pidl
);
return
StrRetToStrNA
(
dest
,
len
,
src
,
pidl
);
else
return
StrRetToStrNA
(
dest
,
len
,
src
,
pidl
);
}
}
/************************* OLESTR functions ****************************/
/************************* OLESTR functions ****************************/
...
...
dlls/shell32/shlview.c
View file @
52cde9b3
...
@@ -1201,7 +1201,7 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
...
@@ -1201,7 +1201,7 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
}
}
else
/* LVN_GETDISPINFOW */
else
/* LVN_GETDISPINFOW */
{
{
StrRetToStrNW
(
lpdi
->
item
.
pszText
,
lpdi
->
item
.
cchTextMax
,
&
sd
.
str
,
NULL
);
StrRetToStrNW
(
((
NMLVDISPINFOW
*
)
lpdi
)
->
item
.
pszText
,
lpdi
->
item
.
cchTextMax
,
&
sd
.
str
,
NULL
);
TRACE
(
"-- text=%s
\n
"
,
debugstr_w
((
WCHAR
*
)(
lpdi
->
item
.
pszText
)));
TRACE
(
"-- text=%s
\n
"
,
debugstr_w
((
WCHAR
*
)(
lpdi
->
item
.
pszText
)));
}
}
}
}
...
...
dlls/shell32/undocshell.h
View file @
52cde9b3
...
@@ -119,23 +119,9 @@ LPITEMIDLIST WINAPI ILCreateFromPathAW(LPCVOID path);
...
@@ -119,23 +119,9 @@ LPITEMIDLIST WINAPI ILCreateFromPathAW(LPCVOID path);
/*
/*
string functions
string functions
*/
*/
HRESULT
WINAPI
StrRetToStrNA
(
BOOL
WINAPI
StrRetToStrNA
(
LPSTR
,
DWORD
,
LPSTRRET
,
const
ITEMIDLIST
*
);
LPVOID
dest
,
BOOL
WINAPI
StrRetToStrNW
(
LPWSTR
,
DWORD
,
LPSTRRET
,
const
ITEMIDLIST
*
);
DWORD
len
,
BOOL
WINAPI
StrRetToStrNAW
(
LPVOID
,
DWORD
,
LPSTRRET
,
const
ITEMIDLIST
*
);
LPSTRRET
src
,
const
ITEMIDLIST
*
pidl
);
HRESULT
WINAPI
StrRetToStrNW
(
LPVOID
dest
,
DWORD
len
,
LPSTRRET
src
,
const
ITEMIDLIST
*
pidl
);
HRESULT
WINAPI
StrRetToStrNAW
(
LPVOID
dest
,
DWORD
len
,
LPSTRRET
src
,
const
ITEMIDLIST
*
pidl
);
/****************************************************************************
/****************************************************************************
...
...
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