Bluetooth (Windows): adds a string variant helper; removes propsys dependency

This commit is contained in:
李通洲
2026-03-03 10:45:11 +08:00
parent 75f4a3d92d
commit b86c0880b9
5 changed files with 40 additions and 26 deletions
+21
View File
@@ -0,0 +1,21 @@
#include "variant.hpp"
#include <oleauto.h>
FFWmiVariant::FFWmiVariant(std::initializer_list<PCWSTR> strings): FFWmiVariant()
{
SAFEARRAYBOUND bound = {
.cElements = (ULONG) strings.size(),
.lLbound = 0,
};
SAFEARRAY* psa = SafeArrayCreate(VT_BSTR, 1, &bound);
LONG i = 0;
for (PCWSTR str : strings) {
SafeArrayPutElement(psa, &i, bstr_t(str));
++i;
}
this->vt = VT_ARRAY | VT_BSTR;
this->parray = psa;
}