Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
3a1146d8
Commit
3a1146d8
authored
Dec 10, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 26, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
propsys: Add InitPropVariantFromStringVector().
parent
de6c2f9c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
5 deletions
+69
-5
propsys.spec
dlls/propsys/propsys.spec
+1
-1
propvar.c
dlls/propsys/propvar.c
+32
-0
propsys.c
dlls/propsys/tests/propsys.c
+35
-4
propvarutil.h
include/propvarutil.h
+1
-0
No files found.
dlls/propsys/propsys.spec
View file @
3a1146d8
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
@ stub InitPropVariantFromResource
@ stub InitPropVariantFromResource
@ stub InitPropVariantFromStrRet
@ stub InitPropVariantFromStrRet
@ stub InitPropVariantFromStringAsVector
@ stub InitPropVariantFromStringAsVector
@ st
ub InitPropVariantFromStringVector
@ st
dcall InitPropVariantFromStringVector(ptr long ptr)
@ stub InitPropVariantFromUInt16Vector
@ stub InitPropVariantFromUInt16Vector
@ stub InitPropVariantFromUInt32Vector
@ stub InitPropVariantFromUInt32Vector
@ stub InitPropVariantFromUInt64Vector
@ stub InitPropVariantFromUInt64Vector
...
...
dlls/propsys/propvar.c
View file @
3a1146d8
...
@@ -657,6 +657,38 @@ HRESULT WINAPI InitPropVariantFromCLSID(REFCLSID clsid, PROPVARIANT *ppropvar)
...
@@ -657,6 +657,38 @@ HRESULT WINAPI InitPropVariantFromCLSID(REFCLSID clsid, PROPVARIANT *ppropvar)
return
S_OK
;
return
S_OK
;
}
}
HRESULT
WINAPI
InitPropVariantFromStringVector
(
PCWSTR
*
strs
,
ULONG
count
,
PROPVARIANT
*
ppropvar
)
{
unsigned
int
i
;
TRACE
(
"(%p %lu %p)
\n
"
,
strs
,
count
,
ppropvar
);
ppropvar
->
calpwstr
.
pElems
=
CoTaskMemAlloc
(
count
*
sizeof
(
*
ppropvar
->
calpwstr
.
pElems
));
if
(
!
ppropvar
->
calpwstr
.
pElems
)
return
E_OUTOFMEMORY
;
ppropvar
->
vt
=
VT_LPWSTR
|
VT_VECTOR
;
ppropvar
->
calpwstr
.
cElems
=
0
;
if
(
count
)
memset
(
ppropvar
->
calpwstr
.
pElems
,
0
,
count
*
sizeof
(
*
ppropvar
->
calpwstr
.
pElems
));
for
(
i
=
0
;
i
<
count
;
++
i
)
{
if
(
strs
[
i
])
{
if
(
!
(
ppropvar
->
calpwstr
.
pElems
[
i
]
=
CoTaskMemAlloc
((
wcslen
(
strs
[
i
])
+
1
)
*
sizeof
(
**
strs
))))
{
PropVariantClear
(
ppropvar
);
return
E_OUTOFMEMORY
;
}
}
wcscpy
(
ppropvar
->
calpwstr
.
pElems
[
i
],
strs
[
i
]);
ppropvar
->
calpwstr
.
cElems
++
;
}
return
S_OK
;
}
HRESULT
WINAPI
InitVariantFromBuffer
(
const
VOID
*
pv
,
UINT
cb
,
VARIANT
*
pvar
)
HRESULT
WINAPI
InitVariantFromBuffer
(
const
VOID
*
pv
,
UINT
cb
,
VARIANT
*
pvar
)
{
{
SAFEARRAY
*
arr
;
SAFEARRAY
*
arr
;
...
...
dlls/propsys/tests/propsys.c
View file @
3a1146d8
...
@@ -1419,6 +1419,35 @@ static void test_InitPropVariantFromCLSID(void)
...
@@ -1419,6 +1419,35 @@ static void test_InitPropVariantFromCLSID(void)
PropVariantClear
(
&
propvar
);
PropVariantClear
(
&
propvar
);
}
}
static
void
test_InitPropVariantFromStringVector
(
void
)
{
static
const
WCHAR
*
strs
[
2
]
=
{
L"abc"
,
L"def"
};
PROPVARIANT
propvar
;
HRESULT
hr
;
memset
(
&
propvar
,
0
,
sizeof
(
propvar
));
propvar
.
vt
=
VT_I4
;
propvar
.
lVal
=
15
;
hr
=
InitPropVariantFromStringVector
(
NULL
,
0
,
&
propvar
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
propvar
.
vt
==
(
VT_LPWSTR
|
VT_VECTOR
),
"Unexpected type %#x.
\n
"
,
propvar
.
vt
);
ok
(
!
propvar
.
calpwstr
.
cElems
,
"Unexpected number of elements.
\n
"
);
ok
(
!!
propvar
.
calpwstr
.
pElems
,
"Unexpected vector pointer.
\n
"
);
PropVariantClear
(
&
propvar
);
hr
=
InitPropVariantFromStringVector
(
strs
,
2
,
&
propvar
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
propvar
.
vt
==
(
VT_LPWSTR
|
VT_VECTOR
),
"Unexpected type %#x.
\n
"
,
propvar
.
vt
);
ok
(
propvar
.
calpwstr
.
cElems
==
2
,
"Unexpected number of elements.
\n
"
);
ok
(
!!
propvar
.
calpwstr
.
pElems
,
"Unexpected vector pointer.
\n
"
);
ok
(
propvar
.
calpwstr
.
pElems
[
0
]
!=
strs
[
0
],
"Unexpected string pointer.
\n
"
);
ok
(
!
wcscmp
(
propvar
.
calpwstr
.
pElems
[
0
],
strs
[
0
]),
"Unexpected string %s.
\n
"
,
debugstr_w
(
propvar
.
calpwstr
.
pElems
[
0
]));
ok
(
propvar
.
calpwstr
.
pElems
[
1
]
!=
strs
[
1
],
"Unexpected string pointer.
\n
"
);
ok
(
!
wcscmp
(
propvar
.
calpwstr
.
pElems
[
1
],
strs
[
1
]),
"Unexpected string %s.
\n
"
,
debugstr_w
(
propvar
.
calpwstr
.
pElems
[
1
]));
PropVariantClear
(
&
propvar
);
}
static
void
test_PropVariantToDouble
(
void
)
static
void
test_PropVariantToDouble
(
void
)
{
{
PROPVARIANT
propvar
;
PROPVARIANT
propvar
;
...
@@ -2252,11 +2281,15 @@ static void test_VariantToStringWithDefault(void)
...
@@ -2252,11 +2281,15 @@ static void test_VariantToStringWithDefault(void)
START_TEST
(
propsys
)
START_TEST
(
propsys
)
{
{
test_InitPropVariantFromGUIDAsString
();
test_InitPropVariantFromBuffer
();
test_InitPropVariantFromCLSID
();
test_InitPropVariantFromStringVector
();
test_InitVariantFromFileTime
();
test_PSStringFromPropertyKey
();
test_PSStringFromPropertyKey
();
test_PSPropertyKeyFromString
();
test_PSPropertyKeyFromString
();
test_PSRefreshPropertySchema
();
test_PSRefreshPropertySchema
();
test_InitPropVariantFromGUIDAsString
();
test_InitPropVariantFromBuffer
();
test_PropVariantToGUID
();
test_PropVariantToGUID
();
test_PropVariantToStringAlloc
();
test_PropVariantToStringAlloc
();
test_PropVariantCompareEx
();
test_PropVariantCompareEx
();
...
@@ -2264,7 +2297,6 @@ START_TEST(propsys)
...
@@ -2264,7 +2297,6 @@ START_TEST(propsys)
test_PropVariantChangeType_LPWSTR
();
test_PropVariantChangeType_LPWSTR
();
test_PropVariantToBoolean
();
test_PropVariantToBoolean
();
test_PropVariantToStringWithDefault
();
test_PropVariantToStringWithDefault
();
test_InitPropVariantFromCLSID
();
test_PropVariantToDouble
();
test_PropVariantToDouble
();
test_PropVariantToString
();
test_PropVariantToString
();
test_PropVariantToBuffer
();
test_PropVariantToBuffer
();
...
@@ -2273,6 +2305,5 @@ START_TEST(propsys)
...
@@ -2273,6 +2305,5 @@ START_TEST(propsys)
test_PSCreateMemoryPropertyStore
();
test_PSCreateMemoryPropertyStore
();
test_propertystore
();
test_propertystore
();
test_PSCreatePropertyStoreFromObject
();
test_PSCreatePropertyStoreFromObject
();
test_InitVariantFromFileTime
();
test_VariantToStringWithDefault
();
test_VariantToStringWithDefault
();
}
}
include/propvarutil.h
View file @
3a1146d8
...
@@ -81,6 +81,7 @@ HRESULT WINAPI VariantToGUID(const VARIANT *pvar, GUID *guid);
...
@@ -81,6 +81,7 @@ HRESULT WINAPI VariantToGUID(const VARIANT *pvar, GUID *guid);
INT
WINAPI
PropVariantCompareEx
(
REFPROPVARIANT
propvar1
,
REFPROPVARIANT
propvar2
,
INT
WINAPI
PropVariantCompareEx
(
REFPROPVARIANT
propvar1
,
REFPROPVARIANT
propvar2
,
PROPVAR_COMPARE_UNIT
uint
,
PROPVAR_COMPARE_FLAGS
flags
);
PROPVAR_COMPARE_UNIT
uint
,
PROPVAR_COMPARE_FLAGS
flags
);
HRESULT
WINAPI
InitPropVariantFromFileTime
(
const
FILETIME
*
pftIn
,
PROPVARIANT
*
ppropvar
);
HRESULT
WINAPI
InitPropVariantFromFileTime
(
const
FILETIME
*
pftIn
,
PROPVARIANT
*
ppropvar
);
HRESULT
WINAPI
InitPropVariantFromStringVector
(
PCWSTR
*
strs
,
ULONG
count
,
PROPVARIANT
*
ppropvar
);
HRESULT
WINAPI
PropVariantToDouble
(
REFPROPVARIANT
propvarIn
,
double
*
ret
);
HRESULT
WINAPI
PropVariantToDouble
(
REFPROPVARIANT
propvarIn
,
double
*
ret
);
HRESULT
WINAPI
PropVariantToInt16
(
REFPROPVARIANT
propvarIn
,
SHORT
*
ret
);
HRESULT
WINAPI
PropVariantToInt16
(
REFPROPVARIANT
propvarIn
,
SHORT
*
ret
);
...
...
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