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
4a55eb5c
Commit
4a55eb5c
authored
Aug 05, 2003
by
Robert Shearman
Committed by
Alexandre Julliard
Aug 05, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make IPropertBag_Read use a dynamically allocated array rather than a
static one.
parent
d8b2109e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
20 deletions
+38
-20
mediacatenum.c
dlls/devenum/mediacatenum.c
+38
-20
No files found.
dlls/devenum/mediacatenum.c
View file @
4a55eb5c
...
@@ -94,8 +94,8 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Read(
...
@@ -94,8 +94,8 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Read(
VARIANT
*
pVar
,
VARIANT
*
pVar
,
IErrorLog
*
pErrorLog
)
IErrorLog
*
pErrorLog
)
{
{
WCHAR
wszData
[
MAX_PATH
+
1
]
;
LPVOID
pData
=
NULL
;
LONG
received
=
MAX_PATH
+
1
;
LONG
received
;
DWORD
type
=
0
;
DWORD
type
=
0
;
ICOM_THIS
(
RegPropBagImpl
,
iface
);
ICOM_THIS
(
RegPropBagImpl
,
iface
);
HRESULT
res
=
S_OK
;
HRESULT
res
=
S_OK
;
...
@@ -106,13 +106,24 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Read(
...
@@ -106,13 +106,24 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Read(
if
(
!
pszPropName
||
!
pVar
)
if
(
!
pszPropName
||
!
pVar
)
return
E_POINTER
;
return
E_POINTER
;
reswin32
=
RegQueryValueExW
(
This
->
hkey
,
pszPropName
,
NULL
,
NULL
,
NULL
,
&
received
);
res
=
HRESULT_FROM_WIN32
(
reswin32
);
if
(
SUCCEEDED
(
res
))
{
pData
=
HeapAlloc
(
GetProcessHeap
(),
0
,
received
);
/* work around a GCC bug that occurs here unless we use the reswin32 variable as well */
/* work around a GCC bug that occurs here unless we use the reswin32 variable as well */
reswin32
=
RegQueryValueExW
(
This
->
hkey
,
pszPropName
,
NULL
,
&
type
,
(
LPVOID
)
wsz
Data
,
&
received
);
reswin32
=
RegQueryValueExW
(
This
->
hkey
,
pszPropName
,
NULL
,
&
type
,
p
Data
,
&
received
);
res
=
HRESULT_FROM_WIN32
(
reswin32
);
res
=
HRESULT_FROM_WIN32
(
reswin32
);
}
if
(
SUCCEEDED
(
res
))
if
(
SUCCEEDED
(
res
))
{
{
TRACE
(
"%ld, %s
\n
"
,
received
,
debugstr_w
(
wszData
));
res
=
E_INVALIDARG
;
/* assume we cannot coerce into right type */
TRACE
(
"Read %ld bytes (%s)
\n
"
,
received
,
type
==
REG_SZ
?
debugstr_w
((
LPWSTR
)
pData
)
:
"binary data"
);
switch
(
type
)
switch
(
type
)
{
{
case
REG_SZ
:
case
REG_SZ
:
...
@@ -120,18 +131,20 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Read(
...
@@ -120,18 +131,20 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Read(
{
{
case
VT_LPWSTR
:
case
VT_LPWSTR
:
V_UNION
(
pVar
,
bstrVal
)
=
CoTaskMemAlloc
(
received
*
sizeof
(
WCHAR
));
V_UNION
(
pVar
,
bstrVal
)
=
CoTaskMemAlloc
(
received
*
sizeof
(
WCHAR
));
strcpyW
(
V_UNION
(
pVar
,
bstrVal
),
wszData
);
strcpyW
(
V_UNION
(
pVar
,
bstrVal
),
(
LPWSTR
)
pData
);
return
S_OK
;
res
=
S_OK
;
break
;
case
VT_EMPTY
:
case
VT_EMPTY
:
V_VT
(
pVar
)
=
VT_BSTR
;
V_VT
(
pVar
)
=
VT_BSTR
;
/* fall through */
/* fall through */
case
VT_BSTR
:
case
VT_BSTR
:
V_UNION
(
pVar
,
bstrVal
)
=
SysAllocStringLen
(
wszData
,
received
-
1
);
V_UNION
(
pVar
,
bstrVal
)
=
SysAllocStringLen
((
LPWSTR
)
pData
,
received
-
1
);
return
S_OK
;
res
=
S_OK
;
break
;
}
}
break
;
break
;
case
REG_DWORD
:
case
REG_DWORD
:
TRACE
(
"REG_DWORD: %lx
\n
"
,
*
(
DWORD
*
)
wsz
Data
);
TRACE
(
"REG_DWORD: %lx
\n
"
,
*
(
DWORD
*
)
p
Data
);
switch
(
V_VT
(
pVar
))
switch
(
V_VT
(
pVar
))
{
{
case
VT_EMPTY
:
case
VT_EMPTY
:
...
@@ -139,8 +152,9 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Read(
...
@@ -139,8 +152,9 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Read(
/* fall through */
/* fall through */
case
VT_I4
:
case
VT_I4
:
case
VT_UI4
:
case
VT_UI4
:
V_UNION
(
pVar
,
ulVal
)
=
*
(
DWORD
*
)
wszData
;
V_UNION
(
pVar
,
ulVal
)
=
*
(
DWORD
*
)
pData
;
return
S_OK
;
res
=
S_OK
;
break
;
}
}
break
;
break
;
case
REG_BINARY
:
case
REG_BINARY
:
...
@@ -155,26 +169,30 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Read(
...
@@ -155,26 +169,30 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Read(
case
VT_EMPTY
:
case
VT_EMPTY
:
case
VT_ARRAY
|
VT_UI1
:
case
VT_ARRAY
|
VT_UI1
:
if
(
!
(
V_UNION
(
pVar
,
parray
)
=
SafeArrayCreate
(
VT_UI1
,
1
,
&
bound
)))
if
(
!
(
V_UNION
(
pVar
,
parray
)
=
SafeArrayCreate
(
VT_UI1
,
1
,
&
bound
)))
return
E_OUTOFMEMORY
;
res
=
E_OUTOFMEMORY
;
res
=
S_OK
;
break
;
break
;
}
}
if
(
res
==
E_INVALIDARG
)
break
;
res
=
SafeArrayAccessData
(
V_UNION
(
pVar
,
parray
),
&
pArrayElements
);
res
=
SafeArrayAccessData
(
V_UNION
(
pVar
,
parray
),
&
pArrayElements
);
if
(
FAILED
(
res
))
if
(
FAILED
(
res
))
{
break
;
TRACE
(
" <- %lx
\n
"
,
res
);
return
res
;
CopyMemory
(
pArrayElements
,
pData
,
received
);
}
CopyMemory
(
pArrayElements
,
wszData
,
received
);
res
=
SafeArrayUnaccessData
(
V_UNION
(
pVar
,
parray
));
res
=
SafeArrayUnaccessData
(
V_UNION
(
pVar
,
parray
));
TRACE
(
" <- %lx
\n
"
,
res
);
break
;
return
res
;
}
}
}
}
if
(
res
==
E_INVALIDARG
)
FIXME
(
"Variant type %x not supported for regtype %lx
\n
"
,
V_VT
(
pVar
),
type
);
FIXME
(
"Variant type %x not supported for regtype %lx
\n
"
,
V_VT
(
pVar
),
type
);
return
E_FAIL
;
}
}
if
(
pData
)
HeapFree
(
GetProcessHeap
(),
0
,
pData
);
TRACE
(
"<- %lx
\n
"
,
res
);
TRACE
(
"<- %lx
\n
"
,
res
);
return
res
;
return
res
;
}
}
...
...
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