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
e56e9c11
Commit
e56e9c11
authored
Feb 27, 2015
by
Andrew Eikum
Committed by
Alexandre Julliard
Mar 02, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Use a helper function to allocate strings from the registry.
parent
b5c12cf9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
13 deletions
+24
-13
shellpath.c
dlls/shell32/shellpath.c
+24
-13
No files found.
dlls/shell32/shellpath.c
View file @
e56e9c11
...
...
@@ -3194,6 +3194,29 @@ static HRESULT get_known_folder_registry_path(
return
hr
;
}
static
HRESULT
get_known_folder_wstr
(
const
WCHAR
*
regpath
,
const
WCHAR
*
value
,
WCHAR
**
out
)
{
DWORD
size
=
0
;
HRESULT
hr
;
size
=
0
;
hr
=
HRESULT_FROM_WIN32
(
RegGetValueW
(
HKEY_LOCAL_MACHINE
,
regpath
,
value
,
RRF_RT_REG_SZ
,
NULL
,
NULL
,
&
size
));
if
(
FAILED
(
hr
))
return
hr
;
*
out
=
CoTaskMemAlloc
(
size
);
if
(
!*
out
)
return
E_OUTOFMEMORY
;
hr
=
HRESULT_FROM_WIN32
(
RegGetValueW
(
HKEY_LOCAL_MACHINE
,
regpath
,
value
,
RRF_RT_REG_SZ
,
NULL
,
*
out
,
&
size
));
if
(
FAILED
(
hr
)){
CoTaskMemFree
(
*
out
);
*
out
=
NULL
;
}
return
hr
;
}
static
HRESULT
get_known_folder_dword
(
const
WCHAR
*
registryPath
,
const
WCHAR
*
value
,
DWORD
*
out
)
{
DWORD
dwSize
=
sizeof
(
DWORD
);
...
...
@@ -3660,7 +3683,6 @@ static HRESULT WINAPI knownfolder_GetFolderDefinition(
{
struct
knownfolder
*
knownfolder
=
impl_from_IKnownFolder
(
iface
);
HRESULT
hr
;
DWORD
dwSize
;
TRACE
(
"(%p, %p)
\n
"
,
knownfolder
,
pKFD
);
if
(
!
pKFD
)
return
E_INVALIDARG
;
...
...
@@ -3671,21 +3693,10 @@ static HRESULT WINAPI knownfolder_GetFolderDefinition(
if
(
FAILED
(
hr
))
return
hr
;
hr
=
HRESULT_FROM_WIN32
(
RegGetValueW
(
HKEY_LOCAL_MACHINE
,
knownfolder
->
registryPath
,
szName
,
RRF_RT_REG_SZ
,
NULL
,
NULL
,
&
dwSize
)
);
hr
=
get_known_folder_wstr
(
knownfolder
->
registryPath
,
szName
,
&
pKFD
->
pszName
);
if
(
FAILED
(
hr
))
return
hr
;
pKFD
->
pszName
=
CoTaskMemAlloc
(
dwSize
);
if
(
!
pKFD
->
pszName
)
return
E_OUTOFMEMORY
;
hr
=
HRESULT_FROM_WIN32
(
RegGetValueW
(
HKEY_LOCAL_MACHINE
,
knownfolder
->
registryPath
,
szName
,
RRF_RT_REG_SZ
,
NULL
,
pKFD
->
pszName
,
&
dwSize
));
if
(
FAILED
(
hr
)){
CoTaskMemFree
(
pKFD
->
pszName
);
pKFD
->
pszName
=
NULL
;
return
hr
;
}
return
S_OK
;
}
...
...
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