mirror of
https://github.com/reactos/reactos.git
synced 2025-08-01 19:33:23 +00:00
[PROPSYS] Sync to wine-10.0 (#7677)
[WINESYNC] propsys/tests: Merge test files. wine commit id d189b55d2ffb038474cb6656dc8743eb34c35a3d by Nikolay Sivov <nsivov@codeweavers.com> [WINESYNC] propsys: Add a semi-stub for PSCreatePropertyStoreFromObject(). Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47958 wine commit id acb2e4fc7a4242c74ac91657edb97bf1e402656a by Nikolay Sivov <nsivov@codeweavers.com> [WINESYNC] propsys: Allow only ASCII digits in PSPropertyKeyFromString. wine commit id 6e8c2d836e637e1fbd83c231cfd846ecb9333964 by Jacek Caban <jacek@codeweavers.com> [WINESYNC] propsys/tests: Get rid of strcmp_wa(). wine commit id 2340212ee9c48c731c85bbad8c81ed833458bf15 by Michael Stefaniuc <mstefani@winehq.org> [WINESYNC] propsys: Use wide-char string literals. wine commit id b72440fa2e1016681cbfcebcdc4792b6ced3eb53 by Michael Stefaniuc <mstefani@winehq.org> reduce wine diff and add stuff from previous commit [WINESYNC] propsys: Use --prefer_native instead of DLL_WINE_PREATTACH. wine commit id f99113192ffac37506a905827415d3d21d0ebbf8 by Alexandre Julliard <julliard@winehq.org> [WINESYNC] propsys: Use nameless unions. wine commit id 1d8e5079f0e53a767a783e5107f57f04c1897951 by Jacek Caban <jacek@codeweavers.com> [WINESYNC] propsys/tests: Use nameless unions. wine commit id 497de3cc19f971808ca4105f52038e61dc818db1 by Jacek Caban <jacek@codeweavers.com> [WINESYNC] winecrt0: Add a default implementation for DllCanUnloadNow(). wine commit id bd6b53740c28c6974300e15f965c12feb0252085 by Alexandre Julliard <julliard@winehq.org> [WINESYNC] winecrt0: Add a default implementation DllRegisterServer()/DllUnregisterServer(). wine commit id 5d82baf9747b7b133cad3be77c0cc9e24cc09582 by Alexandre Julliard <julliard@winehq.org> [WINESYNC] propsys: Add support for VT_VECTOR|VT_UI1 type in PropVariantCompareEx(). wine commit id e91b05bb5be6fd70a767bea9991e818a49cc5547 by Nikolay Sivov <nsivov@codeweavers.com> [WINESYNC] propsys: Fix VT_UI4 comparison, use ulVal instead of uiVal. wine commit id 58eeb1a86433db1104d3a9ccf9ad7435ec81443a by Rémi Bernon <rbernon@codeweavers.com> [WINESYNC] propsys/tests: Add a VT_UI4 test for PropVariantCompareEx(). A test for 58eeb1a86433db1104d3a9ccf9ad7435ec81443a. wine commit id 10359e17ce64f39461a7b7b54f73857e6458d1fb by Nikolay Sivov <nsivov@codeweavers.com> [WINESYNC] propsys/tests: Avoid "misleading indentation" warnings. wine commit id 7cd6681b3be35cf6c02f056cb5131c90c0674c16 by Fabian Maurer <dark.shadow4@web.de> [WINESYNC] propsys: Enable compilation with long types. wine commit id a9c797e4538a37716e62bb81c3fed3de39561b41 by Eric Pouech <eric.pouech@gmail.com> [WINESYNC] propsys/tests: Enable compilation with long types. wine commit id c1c393595d43bd95390d3ddf86dcbc46bc4f52ba by Eric Pouech <eric.pouech@gmail.com> [WINESYNC] propsys: Implement InitVariantFromFileTime. wine commit id f2b8ccb7b0b22b7b5d661d908f8f8ee02f22647d by Daniel Lehman <dlehman@esri.com> [WINESYNC] propsys/tests: Add some InitVariantFromFileTime tests. wine commit id 083dea7fce4372840ac18176496a7d05dadd5ad8 by Daniel Lehman <dlehman@esri.com> [WINESYNC] propsys: Implement VariantToStringWithDefault. wine commit id bf0f1fdcf80657a42116b79a0953181191cf9221 by Mohamad Al-Jaf <mohamadaljaf@gmail.com> [WINESYNC] propsys/tests: Add VariantToStringWithDefault tests. wine commit id 89aba13dc381dbbda62d1019e1af2af5a589b0cf by Mohamad Al-Jaf <mohamadaljaf@gmail.com> [WINESYNC] include: Add Stg functions declaration in propvarutil.h. wine commit id 0d294ad26544913414277daa164004d731ae6e33 by Biswapriyo Nath <nathbappai@gmail.com> [WINESYNC] propsys: Add InitPropVariantFromStringVector(). wine commit id 3a1146d8e63d7ceff38441fee08f7f7080527020 by Nikolay Sivov <nsivov@codeweavers.com> [WINESYNC] Remove unused NONAMELESS defines. wine commit id 20afe438320f77d103a96d1d8cd562d0899ebac7 by Alexandre Julliard <julliard@winehq.org> [WINESYNC] propsys: Partially implement VariantToString(). Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55708 wine commit id f7ef02bd8f74ea052d61e48cd84b226d8a5867a8 by Nikolay Sivov <nsivov@codeweavers.com> [WINESYNC] propsys: Handle VT_I4 type in VariantToString(). Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55708 wine commit id 001e0543bfd5aea060053af0c76233bb90fbb43b by Nikolay Sivov <nsivov@codeweavers.com> [WINESYNC] propsys: Implement PropVariantToUInt32WithDefault. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55713 wine commit id d177709b10ce07ddd234b0e8e00764ae4b1d8488 by Fabian Maurer <dark.shadow4@web.de> [WINESYNC] include: Use proper dllimports for propsys functions. wine commit id f0b2e0d00c86fb04d47467f39e49c587250ffec5 by Alexandre Julliard <julliard@winehq.org> [WINESYNC] propsys: Remove DECLSPEC_HIDDEN usage. wine commit id e9ff53e098ef3871d692c7b907151cfbb2f0673f by Alistair Leslie-Hughes <leslie_alistair@hotmail.com> Update propsys_private.h [WINESYNC] propsys: Force debug info in critical sections. wine commit id 67bea281cc851eda6a08430c70f6c9e848d3fbe1 by Paul Gofman <pgofman@codeweavers.com> [WINESYNC] include: Fix typos in IID_IPropertyEnumType2 and CLSID_PropertySystem. wine commit id 66e6b61705a66459ed3a9e0cf9457d8b180e4564 by Alfred Agrell <floating@muncher.se> [WINESYNC] propsys: Add stubs for variant conversion functions. wine commit id c21f04f7adaa4a8d0ca2d2659bf9a6facdc168c3 by Ziqing Hui <zhui@codeweavers.com> [WINESYNC] propsys/tests: Add tests for VariantToPropVariant. wine commit id 8877889f2a8e36d22dcad061e6da84476efb3750 by Ziqing Hui <zhui@codeweavers.com> [WINESYNC] propsys: Initially implement VariantToPropVariant. wine commit id 6985637ed59e81e7d1716095a343cc5681082306 by Ziqing Hui <zhui@codeweavers.com> [WINESYNC] propsys/tests: Add tests for PropVariantToVariant. wine commit id 3277de5572b7f6c41ebeeb89f781e378a6a2c2d3 by Ziqing Hui <zhui@codeweavers.com> [WINESYNC] propsys/tests: Test converting clsid to string. wine commit id 7a4f9f83c51883f41ae1363e27700452472ec18f by Ziqing Hui <zhui@codeweavers.com> [WINESYNC] propsys: Support converting clsid to string for PropVariant. wine commit id 67b097ff46c65d525de6a7f560f019de6828320c by Ziqing Hui <zhui@codeweavers.com> [WINESYNC] propsys: Initially implement PropVariantToVariant. wine commit id 808b398549350fffc9fc023d637ef8de9e4bba37 by Ziqing Hui <zhui@codeweavers.com> [WINESYNC] propsys: Add PropVariantToBSTR stub. wine commit id 86558a4b83ebf9a0c6e76888a3d0f3fe3e36bf57 by Ziqing Hui <zhui@codeweavers.com> [WINESYNC] propsys/tests: Test PropVariantToBSTR. wine commit id b4ac03f1f622120906a8b6e691caa05f6539c2dd by Ziqing Hui <zhui@codeweavers.com> [WINESYNC] propsys/tests: Test truncating for PropVariantToString. wine commit id df16802582a56f8076ebbcf9cb6178f65bb8b9b6 by Ziqing Hui <zhui@codeweavers.com> [WINESYNC] propsys: Implement PropVariantToBSTR. wine commit id 66220be403ce5c3634c13da3546f0c19f04059cc by Ziqing Hui <zhui@codeweavers.com> [WINESYNC] propsys: Use debugstr_variant for the trace in VariantToPropVariant. wine commit id 3517aded4090229dbb11e413bde8349d1eca0be3 by Ziqing Hui <zhui@codeweavers.com> [WINESYNC] propsys: Support converting to BSTR for PropVariantToVariant. wine commit id c33fdc27650045a754a05a8f25e250e6e72c8072 by Ziqing Hui <zhui@codeweavers.com> [WINESYNC] propsys/tests: Fix a test that fails on some Windows versions. wine commit id c09f828f43101cf2dfe11d7e13f1fc6ef4b19853 by Alexandre Julliard <julliard@winehq.org> [WINESYNC]: propsys is now in sync with wine-staging wine-10.0 Co-authored-by: winesync <ros-dev@reactos.org> [PROPSYS] Remove duplicate uuid [PROPSYS] Fix headers/idl file
This commit is contained in:
parent
5bc6d59142
commit
2d1144a5cd
16 changed files with 1937 additions and 843 deletions
|
@ -1,6 +1,7 @@
|
|||
|
||||
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
|
||||
add_definitions(-D__WINESRC__)
|
||||
remove_definitions(-D_CRT_NON_CONFORMING_SWPRINTFS -D__ROS_LONG64__)
|
||||
add_definitions(-D__WINESRC__ -D_PROPSYS_)
|
||||
spec2def(propsys.dll propsys.spec ADD_IMPORTLIB)
|
||||
|
||||
list(APPEND SOURCE
|
||||
|
@ -16,7 +17,7 @@ add_library(propsys MODULE
|
|||
${CMAKE_CURRENT_BINARY_DIR}/propsys.def)
|
||||
|
||||
set_module_type(propsys win32dll)
|
||||
target_link_libraries(propsys uuid wine)
|
||||
target_link_libraries(propsys uuid wine wine_dll_register)
|
||||
add_importlibs(propsys ole32 oleaut32 msvcrt kernel32 ntdll)
|
||||
add_pch(propsys precomp.h SOURCE)
|
||||
add_cd_file(TARGET propsys DESTINATION reactos/system32 FOR all)
|
||||
|
|
|
@ -9,13 +9,14 @@
|
|||
#define COM_NO_WINDOWS_H
|
||||
|
||||
#define COBJMACROS
|
||||
#define NONAMELESSUNION
|
||||
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <winnls.h>
|
||||
#include <objbase.h>
|
||||
#include <propsys.h>
|
||||
#include <oleauto.h>
|
||||
#include <oaidl.h>
|
||||
|
||||
#include <wine/debug.h>
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ static ULONG WINAPI PropertyStore_AddRef(IPropertyStoreCache *iface)
|
|||
PropertyStore *This = impl_from_IPropertyStoreCache(iface);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p) refcount=%u\n", iface, ref);
|
||||
TRACE("(%p) refcount=%lu\n", iface, ref);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ static ULONG WINAPI PropertyStore_Release(IPropertyStoreCache *iface)
|
|||
PropertyStore *This = impl_from_IPropertyStoreCache(iface);
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p) refcount=%u\n", iface, ref);
|
||||
TRACE("(%p) refcount=%lu\n", iface, ref);
|
||||
|
||||
if (ref == 0)
|
||||
{
|
||||
|
@ -159,7 +159,7 @@ static HRESULT WINAPI PropertyStore_GetAt(IPropertyStoreCache *iface,
|
|||
propstore_value *value;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("%p,%d,%p\n", iface, iProp, pkey);
|
||||
TRACE("%p,%ld,%p\n", iface, iProp, pkey);
|
||||
|
||||
if (!pkey)
|
||||
return E_POINTER;
|
||||
|
@ -464,7 +464,11 @@ HRESULT PropertyStore_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv
|
|||
|
||||
This->IPropertyStoreCache_iface.lpVtbl = &PropertyStore_Vtbl;
|
||||
This->ref = 1;
|
||||
#ifdef __REACTOS__
|
||||
InitializeCriticalSection(&This->lock);
|
||||
#else
|
||||
InitializeCriticalSectionEx(&This->lock, 0, RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO);
|
||||
#endif
|
||||
This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": PropertyStore.lock");
|
||||
list_init(&This->formats);
|
||||
|
||||
|
@ -473,3 +477,19 @@ HRESULT PropertyStore_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
HRESULT WINAPI PSCreatePropertyStoreFromObject(IUnknown *obj, DWORD access, REFIID riid, void **ret)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p, %ld, %s, %p)\n", obj, access, debugstr_guid(riid), ret);
|
||||
|
||||
if (!obj || !ret)
|
||||
return E_POINTER;
|
||||
|
||||
if (IsEqualIID(riid, &IID_IPropertyStore) && SUCCEEDED(hr = IUnknown_QueryInterface(obj, riid, ret)))
|
||||
return hr;
|
||||
|
||||
FIXME("Unimplemented for %s.\n", debugstr_guid(riid));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
@ stub InitPropVariantFromResource
|
||||
@ stub InitPropVariantFromStrRet
|
||||
@ stub InitPropVariantFromStringAsVector
|
||||
@ stub InitPropVariantFromStringVector
|
||||
@ stdcall InitPropVariantFromStringVector(ptr long ptr)
|
||||
@ stub InitPropVariantFromUInt16Vector
|
||||
@ stub InitPropVariantFromUInt32Vector
|
||||
@ stub InitPropVariantFromUInt64Vector
|
||||
|
@ -50,7 +50,7 @@
|
|||
@ stub InitVariantFromBooleanArray
|
||||
@ stdcall InitVariantFromBuffer(ptr long ptr)
|
||||
@ stub InitVariantFromDoubleArray
|
||||
@ stub InitVariantFromFileTime
|
||||
@ stdcall InitVariantFromFileTime(ptr ptr)
|
||||
@ stub InitVariantFromFileTimeArray
|
||||
@ stdcall InitVariantFromGUIDAsString(ptr ptr)
|
||||
@ stub InitVariantFromInt16Array
|
||||
|
@ -69,7 +69,7 @@
|
|||
@ stdcall PSCreateMemoryPropertyStore(ptr ptr)
|
||||
@ stub PSCreateMultiplexPropertyStore
|
||||
@ stub PSCreatePropertyChangeArray
|
||||
@ stub PSCreatePropertyStoreFromObject
|
||||
@ stdcall PSCreatePropertyStoreFromObject(ptr long ptr ptr)
|
||||
@ stub PSCreatePropertyStoreFromPropertySetStorage
|
||||
@ stub PSCreateSimplePropertyChange
|
||||
@ stub PSEnumeratePropertyDescriptions
|
||||
|
@ -107,7 +107,7 @@
|
|||
@ stub PropVariantGetUInt16Elem
|
||||
@ stub PropVariantGetUInt32Elem
|
||||
@ stub PropVariantGetUInt64Elem
|
||||
@ stub PropVariantToBSTR
|
||||
@ stdcall PropVariantToBSTR(ptr ptr)
|
||||
@ stdcall PropVariantToBoolean(ptr ptr)
|
||||
@ stub PropVariantToBooleanVector
|
||||
@ stub PropVariantToBooleanVectorAlloc
|
||||
|
@ -146,12 +146,12 @@
|
|||
@ stdcall PropVariantToUInt32(ptr ptr)
|
||||
@ stub PropVariantToUInt32Vector
|
||||
@ stub PropVariantToUInt32VectorAlloc
|
||||
@ stub PropVariantToUInt32WithDefault
|
||||
@ stdcall PropVariantToUInt32WithDefault(ptr long)
|
||||
@ stdcall PropVariantToUInt64(ptr ptr)
|
||||
@ stub PropVariantToUInt64Vector
|
||||
@ stub PropVariantToUInt64VectorAlloc
|
||||
@ stub PropVariantToUInt64WithDefault
|
||||
@ stub PropVariantToVariant
|
||||
@ stdcall PropVariantToVariant(ptr ptr)
|
||||
@ stub StgDeserializePropVariant
|
||||
@ stub StgSerializePropVariant
|
||||
@ stub VariantCompare
|
||||
|
@ -189,13 +189,13 @@
|
|||
@ stub VariantToInt64Array
|
||||
@ stub VariantToInt64ArrayAlloc
|
||||
@ stub VariantToInt64WithDefault
|
||||
@ stub VariantToPropVariant
|
||||
@ stdcall VariantToPropVariant(ptr ptr)
|
||||
@ stub VariantToStrRet
|
||||
@ stub VariantToString
|
||||
@ stdcall VariantToString(ptr ptr long)
|
||||
@ stub VariantToStringAlloc
|
||||
@ stub VariantToStringArray
|
||||
@ stub VariantToStringArrayAlloc
|
||||
@ stub VariantToStringWithDefault
|
||||
@ stdcall VariantToStringWithDefault(ptr wstr)
|
||||
@ stub VariantToUInt16
|
||||
@ stub VariantToUInt16Array
|
||||
@ stub VariantToUInt16ArrayAlloc
|
||||
|
|
|
@ -22,9 +22,6 @@
|
|||
#define COBJMACROS
|
||||
|
||||
#include <stdarg.h>
|
||||
#ifdef __REACTOS__
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
|
@ -37,35 +34,6 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(propsys);
|
||||
|
||||
static HINSTANCE propsys_hInstance;
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
|
||||
|
||||
switch (fdwReason)
|
||||
{
|
||||
case DLL_WINE_PREATTACH:
|
||||
return FALSE; /* prefer native version */
|
||||
case DLL_PROCESS_ATTACH:
|
||||
propsys_hInstance = hinstDLL;
|
||||
DisableThreadLibraryCalls(hinstDLL);
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HRESULT WINAPI DllRegisterServer(void)
|
||||
{
|
||||
return __wine_register_resources( propsys_hInstance );
|
||||
}
|
||||
|
||||
HRESULT WINAPI DllUnregisterServer(void)
|
||||
{
|
||||
return __wine_unregister_resources( propsys_hInstance );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
*ppv = NULL;
|
||||
|
@ -135,11 +103,6 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
|||
return CLASS_E_CLASSNOTAVAILABLE;
|
||||
}
|
||||
|
||||
HRESULT WINAPI DllCanUnloadNow(void)
|
||||
{
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI propsys_QueryInterface(IPropertySystem *iface, REFIID riid, void **obj)
|
||||
{
|
||||
*obj = NULL;
|
||||
|
@ -194,7 +157,7 @@ static HRESULT WINAPI propsys_FormatForDisplay(IPropertySystem *iface,
|
|||
REFPROPERTYKEY key, REFPROPVARIANT propvar, PROPDESC_FORMAT_FLAGS flags,
|
||||
LPWSTR dest, DWORD destlen)
|
||||
{
|
||||
FIXME("%p %p %x %p %d: stub\n", key, propvar, flags, dest, destlen);
|
||||
FIXME("%p %p %x %p %ld: stub\n", key, propvar, flags, dest, destlen);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -283,12 +246,6 @@ HRESULT WINAPI PSRefreshPropertySchema(void)
|
|||
|
||||
HRESULT WINAPI PSStringFromPropertyKey(REFPROPERTYKEY pkey, LPWSTR psz, UINT cch)
|
||||
{
|
||||
static const WCHAR guid_fmtW[] = {'{','%','0','8','X','-','%','0','4','X','-',
|
||||
'%','0','4','X','-','%','0','2','X','%','0','2','X','-',
|
||||
'%','0','2','X','%','0','2','X','%','0','2','X',
|
||||
'%','0','2','X','%','0','2','X','%','0','2','X','}',0};
|
||||
static const WCHAR pid_fmtW[] = {'%','u',0};
|
||||
|
||||
WCHAR pidW[PKEY_PIDSTR_MAX + 1];
|
||||
LPWSTR p = psz;
|
||||
int len;
|
||||
|
@ -308,8 +265,8 @@ HRESULT WINAPI PSStringFromPropertyKey(REFPROPERTYKEY pkey, LPWSTR psz, UINT cch
|
|||
return E_NOT_SUFFICIENT_BUFFER;
|
||||
}
|
||||
|
||||
swprintf(psz, guid_fmtW, pkey->fmtid.Data1, pkey->fmtid.Data2,
|
||||
pkey->fmtid.Data3, pkey->fmtid.Data4[0], pkey->fmtid.Data4[1],
|
||||
swprintf(psz, cch, L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}", pkey->fmtid.Data1,
|
||||
pkey->fmtid.Data2, pkey->fmtid.Data3, pkey->fmtid.Data4[0], pkey->fmtid.Data4[1],
|
||||
pkey->fmtid.Data4[2], pkey->fmtid.Data4[3], pkey->fmtid.Data4[4],
|
||||
pkey->fmtid.Data4[5], pkey->fmtid.Data4[6], pkey->fmtid.Data4[7]);
|
||||
|
||||
|
@ -318,7 +275,7 @@ HRESULT WINAPI PSStringFromPropertyKey(REFPROPERTYKEY pkey, LPWSTR psz, UINT cch
|
|||
*p++ = ' ';
|
||||
cch -= GUIDSTRING_MAX - 1 + 1;
|
||||
|
||||
len = swprintf(pidW, pid_fmtW, pkey->pid);
|
||||
len = swprintf(pidW, ARRAY_SIZE(pidW), L"%u", pkey->pid);
|
||||
|
||||
if (cch >= len + 1)
|
||||
{
|
||||
|
@ -498,7 +455,7 @@ HRESULT WINAPI PSPropertyKeyFromString(LPCWSTR pszString, PROPERTYKEY *pkey)
|
|||
}
|
||||
|
||||
/* Overflow is not checked. */
|
||||
while (iswdigit(*pszString))
|
||||
while ('0' <= *pszString && *pszString <= '9')
|
||||
{
|
||||
pkey->pid *= 10;
|
||||
pkey->pid += (*pszString - '0');
|
||||
|
@ -517,3 +474,10 @@ HRESULT WINAPI PSCreateMemoryPropertyStore(REFIID riid, void **ppv)
|
|||
|
||||
return PropertyStore_CreateInstance(NULL, riid, ppv);
|
||||
}
|
||||
|
||||
#ifdef __REACTOS__
|
||||
HRESULT WINAPI DllCanUnloadNow(void)
|
||||
{
|
||||
return S_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -20,4 +20,4 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
HRESULT PropertyStore_CreateInstance(IUnknown *outer, REFIID riid, void **ppv) DECLSPEC_HIDDEN;
|
||||
HRESULT PropertyStore_CreateInstance(IUnknown *outer, REFIID riid, void **ppv);
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define NONAMELESSUNION
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
|
@ -33,11 +31,31 @@
|
|||
#include "shlobj.h"
|
||||
#include "propvarutil.h"
|
||||
#include "strsafe.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(propsys);
|
||||
|
||||
#define GUID_STR_LEN 38
|
||||
static HRESULT VARIANT_ValidateType(VARTYPE vt)
|
||||
{
|
||||
VARTYPE vtExtra = vt & (VT_VECTOR | VT_ARRAY | VT_BYREF | VT_RESERVED);
|
||||
|
||||
vt &= VT_TYPEMASK;
|
||||
|
||||
if (!(vtExtra & (VT_VECTOR | VT_RESERVED)))
|
||||
{
|
||||
if (vt < VT_VOID || vt == VT_RECORD || vt == VT_CLSID)
|
||||
{
|
||||
if ((vtExtra & (VT_BYREF | VT_ARRAY)) && vt <= VT_NULL)
|
||||
return DISP_E_BADVARTYPE;
|
||||
if (vt != (VARTYPE)15)
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return DISP_E_BADVARTYPE;
|
||||
}
|
||||
|
||||
static HRESULT PROPVAR_ConvertFILETIME(const FILETIME *ft, PROPVARIANT *ppropvarDest, VARTYPE vt)
|
||||
{
|
||||
SYSTEMTIME time;
|
||||
|
@ -47,11 +65,11 @@ static HRESULT PROPVAR_ConvertFILETIME(const FILETIME *ft, PROPVARIANT *ppropvar
|
|||
switch (vt)
|
||||
{
|
||||
case VT_LPSTR:
|
||||
ppropvarDest->u.pszVal = HeapAlloc(GetProcessHeap(), 0, 64);
|
||||
if (!ppropvarDest->u.pszVal)
|
||||
ppropvarDest->pszVal = HeapAlloc(GetProcessHeap(), 0, 64);
|
||||
if (!ppropvarDest->pszVal)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
sprintf( ppropvarDest->u.pszVal, "%04d/%02d/%02d:%02d:%02d:%02d.%03d",
|
||||
sprintf( ppropvarDest->pszVal, "%04d/%02d/%02d:%02d:%02d:%02d.%03d",
|
||||
time.wYear, time.wMonth, time.wDay,
|
||||
time.wHour, time.wMinute, time.wSecond,
|
||||
time.wMilliseconds );
|
||||
|
@ -74,35 +92,35 @@ static HRESULT PROPVAR_ConvertNumber(REFPROPVARIANT pv, int dest_bits,
|
|||
{
|
||||
case VT_I1:
|
||||
src_signed = TRUE;
|
||||
*res = pv->u.cVal;
|
||||
*res = pv->cVal;
|
||||
break;
|
||||
case VT_UI1:
|
||||
src_signed = FALSE;
|
||||
*res = pv->u.bVal;
|
||||
*res = pv->bVal;
|
||||
break;
|
||||
case VT_I2:
|
||||
src_signed = TRUE;
|
||||
*res = pv->u.iVal;
|
||||
*res = pv->iVal;
|
||||
break;
|
||||
case VT_UI2:
|
||||
src_signed = FALSE;
|
||||
*res = pv->u.uiVal;
|
||||
*res = pv->uiVal;
|
||||
break;
|
||||
case VT_I4:
|
||||
src_signed = TRUE;
|
||||
*res = pv->u.lVal;
|
||||
*res = pv->lVal;
|
||||
break;
|
||||
case VT_UI4:
|
||||
src_signed = FALSE;
|
||||
*res = pv->u.ulVal;
|
||||
*res = pv->ulVal;
|
||||
break;
|
||||
case VT_I8:
|
||||
src_signed = TRUE;
|
||||
*res = pv->u.hVal.QuadPart;
|
||||
*res = pv->hVal.QuadPart;
|
||||
break;
|
||||
case VT_UI8:
|
||||
src_signed = FALSE;
|
||||
*res = pv->u.uhVal.QuadPart;
|
||||
*res = pv->uhVal.QuadPart;
|
||||
break;
|
||||
case VT_EMPTY:
|
||||
src_signed = FALSE;
|
||||
|
@ -111,8 +129,12 @@ static HRESULT PROPVAR_ConvertNumber(REFPROPVARIANT pv, int dest_bits,
|
|||
case VT_LPSTR:
|
||||
{
|
||||
char *end;
|
||||
*res = _strtoi64(pv->u.pszVal, &end, 0);
|
||||
if (pv->u.pszVal == end)
|
||||
#ifdef __REACTOS__
|
||||
*res = _strtoi64(pv->pszVal, &end, 0);
|
||||
#else
|
||||
*res = strtoll(pv->pszVal, &end, 0);
|
||||
#endif
|
||||
if (pv->pszVal == end)
|
||||
return DISP_E_TYPEMISMATCH;
|
||||
src_signed = *res < 0;
|
||||
break;
|
||||
|
@ -121,8 +143,8 @@ static HRESULT PROPVAR_ConvertNumber(REFPROPVARIANT pv, int dest_bits,
|
|||
case VT_BSTR:
|
||||
{
|
||||
WCHAR *end;
|
||||
*res = wcstol(pv->u.pwszVal, &end, 0);
|
||||
if (pv->u.pwszVal == end)
|
||||
*res = wcstol(pv->pwszVal, &end, 0);
|
||||
if (pv->pwszVal == end)
|
||||
return DISP_E_TYPEMISMATCH;
|
||||
src_signed = *res < 0;
|
||||
break;
|
||||
|
@ -130,7 +152,7 @@ static HRESULT PROPVAR_ConvertNumber(REFPROPVARIANT pv, int dest_bits,
|
|||
case VT_R8:
|
||||
{
|
||||
src_signed = TRUE;
|
||||
*res = pv->u.dblVal;
|
||||
*res = pv->dblVal;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -231,6 +253,20 @@ HRESULT WINAPI PropVariantToUInt32(REFPROPVARIANT propvarIn, ULONG *ret)
|
|||
return hr;
|
||||
}
|
||||
|
||||
ULONG WINAPI PropVariantToUInt32WithDefault(REFPROPVARIANT propvarIn, ULONG ulDefault)
|
||||
{
|
||||
LONGLONG res;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("%p,%lu\n", propvarIn, ulDefault);
|
||||
|
||||
hr = PROPVAR_ConvertNumber(propvarIn, 32, FALSE, &res);
|
||||
if (SUCCEEDED(hr))
|
||||
return (ULONG)res;
|
||||
|
||||
return ulDefault;
|
||||
}
|
||||
|
||||
HRESULT WINAPI PropVariantToUInt64(REFPROPVARIANT propvarIn, ULONGLONG *ret)
|
||||
{
|
||||
LONGLONG res;
|
||||
|
@ -245,10 +281,6 @@ HRESULT WINAPI PropVariantToUInt64(REFPROPVARIANT propvarIn, ULONGLONG *ret)
|
|||
|
||||
HRESULT WINAPI PropVariantToBoolean(REFPROPVARIANT propvarIn, BOOL *ret)
|
||||
{
|
||||
static const WCHAR trueW[] = {'t','r','u','e',0};
|
||||
static const WCHAR falseW[] = {'f','a','l','s','e',0};
|
||||
static const WCHAR true2W[] = {'#','T','R','U','E','#',0};
|
||||
static const WCHAR false2W[] = {'#','F','A','L','S','E','#',0};
|
||||
LONGLONG res;
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -259,21 +291,21 @@ HRESULT WINAPI PropVariantToBoolean(REFPROPVARIANT propvarIn, BOOL *ret)
|
|||
switch (propvarIn->vt)
|
||||
{
|
||||
case VT_BOOL:
|
||||
*ret = propvarIn->u.boolVal == VARIANT_TRUE;
|
||||
*ret = propvarIn->boolVal == VARIANT_TRUE;
|
||||
return S_OK;
|
||||
|
||||
case VT_LPWSTR:
|
||||
case VT_BSTR:
|
||||
if (!propvarIn->u.pwszVal)
|
||||
if (!propvarIn->pwszVal)
|
||||
return DISP_E_TYPEMISMATCH;
|
||||
|
||||
if (!lstrcmpiW(propvarIn->u.pwszVal, trueW) || !lstrcmpW(propvarIn->u.pwszVal, true2W))
|
||||
if (!lstrcmpiW(propvarIn->pwszVal, L"true") || !lstrcmpW(propvarIn->pwszVal, L"#TRUE#"))
|
||||
{
|
||||
*ret = TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (!lstrcmpiW(propvarIn->u.pwszVal, falseW) || !lstrcmpW(propvarIn->u.pwszVal, false2W))
|
||||
if (!lstrcmpiW(propvarIn->pwszVal, L"false") || !lstrcmpW(propvarIn->pwszVal, L"#FALSE#"))
|
||||
{
|
||||
*ret = FALSE;
|
||||
return S_OK;
|
||||
|
@ -281,16 +313,16 @@ HRESULT WINAPI PropVariantToBoolean(REFPROPVARIANT propvarIn, BOOL *ret)
|
|||
break;
|
||||
|
||||
case VT_LPSTR:
|
||||
if (!propvarIn->u.pszVal)
|
||||
if (!propvarIn->pszVal)
|
||||
return DISP_E_TYPEMISMATCH;
|
||||
|
||||
if (!lstrcmpiA(propvarIn->u.pszVal, "true") || !lstrcmpA(propvarIn->u.pszVal, "#TRUE#"))
|
||||
if (!lstrcmpiA(propvarIn->pszVal, "true") || !lstrcmpA(propvarIn->pszVal, "#TRUE#"))
|
||||
{
|
||||
*ret = TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (!lstrcmpiA(propvarIn->u.pszVal, "false") || !lstrcmpA(propvarIn->u.pszVal, "#FALSE#"))
|
||||
if (!lstrcmpiA(propvarIn->pszVal, "false") || !lstrcmpA(propvarIn->pszVal, "#FALSE#"))
|
||||
{
|
||||
*ret = FALSE;
|
||||
return S_OK;
|
||||
|
@ -303,6 +335,26 @@ HRESULT WINAPI PropVariantToBoolean(REFPROPVARIANT propvarIn, BOOL *ret)
|
|||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI PropVariantToBSTR(REFPROPVARIANT propvar, BSTR *bstr)
|
||||
{
|
||||
WCHAR *str;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("propvar %p, propvar->vt %#x, bstr %p.\n",
|
||||
propvar, propvar ? propvar->vt : 0, bstr);
|
||||
|
||||
if (FAILED(hr = PropVariantToStringAlloc(propvar, &str)))
|
||||
return hr;
|
||||
|
||||
*bstr = SysAllocString(str);
|
||||
CoTaskMemFree(str);
|
||||
|
||||
if (!*bstr)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI PropVariantToBuffer(REFPROPVARIANT propvarIn, void *ret, UINT cb)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
@ -312,9 +364,9 @@ HRESULT WINAPI PropVariantToBuffer(REFPROPVARIANT propvarIn, void *ret, UINT cb)
|
|||
switch(propvarIn->vt)
|
||||
{
|
||||
case VT_VECTOR|VT_UI1:
|
||||
if(cb > propvarIn->u.caub.cElems)
|
||||
if(cb > propvarIn->caub.cElems)
|
||||
return E_FAIL;
|
||||
memcpy(ret, propvarIn->u.caub.pElems, cb);
|
||||
memcpy(ret, propvarIn->caub.pElems, cb);
|
||||
break;
|
||||
case VT_ARRAY|VT_UI1:
|
||||
FIXME("Unsupported type: VT_ARRAY|VT_UI1\n");
|
||||
|
@ -328,7 +380,6 @@ HRESULT WINAPI PropVariantToBuffer(REFPROPVARIANT propvarIn, void *ret, UINT cb)
|
|||
return hr;
|
||||
}
|
||||
|
||||
|
||||
HRESULT WINAPI PropVariantToString(REFPROPVARIANT propvarIn, PWSTR ret, UINT cch)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
@ -369,27 +420,36 @@ HRESULT WINAPI PropVariantToStringAlloc(REFPROPVARIANT propvarIn, WCHAR **ret)
|
|||
break;
|
||||
|
||||
case VT_LPSTR:
|
||||
if(propvarIn->u.pszVal)
|
||||
if(propvarIn->pszVal)
|
||||
{
|
||||
DWORD len;
|
||||
|
||||
len = MultiByteToWideChar(CP_ACP, 0, propvarIn->u.pszVal, -1, NULL, 0);
|
||||
len = MultiByteToWideChar(CP_ACP, 0, propvarIn->pszVal, -1, NULL, 0);
|
||||
res = CoTaskMemAlloc(len*sizeof(WCHAR));
|
||||
if(!res)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, propvarIn->u.pszVal, -1, res, len);
|
||||
MultiByteToWideChar(CP_ACP, 0, propvarIn->pszVal, -1, res, len);
|
||||
}
|
||||
break;
|
||||
|
||||
case VT_LPWSTR:
|
||||
case VT_BSTR:
|
||||
if (propvarIn->u.pwszVal)
|
||||
if (propvarIn->pwszVal)
|
||||
{
|
||||
DWORD size = (lstrlenW(propvarIn->u.pwszVal) + 1) * sizeof(WCHAR);
|
||||
DWORD size = (lstrlenW(propvarIn->pwszVal) + 1) * sizeof(WCHAR);
|
||||
res = CoTaskMemAlloc(size);
|
||||
if(!res) return E_OUTOFMEMORY;
|
||||
memcpy(res, propvarIn->u.pwszVal, size);
|
||||
memcpy(res, propvarIn->pwszVal, size);
|
||||
}
|
||||
break;
|
||||
|
||||
case VT_CLSID:
|
||||
if (propvarIn->puuid)
|
||||
{
|
||||
if (!(res = CoTaskMemAlloc((GUID_STR_LEN + 1) * sizeof(WCHAR))))
|
||||
return E_OUTOFMEMORY;
|
||||
StringFromGUID2(propvarIn->puuid, res, GUID_STR_LEN + 1);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -406,21 +466,70 @@ HRESULT WINAPI PropVariantToStringAlloc(REFPROPVARIANT propvarIn, WCHAR **ret)
|
|||
|
||||
PCWSTR WINAPI PropVariantToStringWithDefault(REFPROPVARIANT propvarIn, LPCWSTR pszDefault)
|
||||
{
|
||||
static const WCHAR str_empty[] = {0};
|
||||
if (propvarIn->vt == VT_BSTR)
|
||||
{
|
||||
if (propvarIn->u.bstrVal == NULL)
|
||||
return str_empty;
|
||||
if (propvarIn->bstrVal == NULL)
|
||||
return L"";
|
||||
|
||||
return propvarIn->u.bstrVal;
|
||||
return propvarIn->bstrVal;
|
||||
}
|
||||
|
||||
if (propvarIn->vt == VT_LPWSTR && propvarIn->u.pwszVal != NULL)
|
||||
return propvarIn->u.pwszVal;
|
||||
if (propvarIn->vt == VT_LPWSTR && propvarIn->pwszVal != NULL)
|
||||
return propvarIn->pwszVal;
|
||||
|
||||
return pszDefault;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* VariantToStringWithDefault (PROPSYS.@)
|
||||
*/
|
||||
PCWSTR WINAPI VariantToStringWithDefault(const VARIANT *pvar, const WCHAR *default_value)
|
||||
{
|
||||
TRACE("%s, %s.\n", debugstr_variant(pvar), debugstr_w(default_value));
|
||||
|
||||
if (V_VT(pvar) == (VT_BYREF | VT_VARIANT)) pvar = V_VARIANTREF(pvar);
|
||||
if (V_VT(pvar) == (VT_BYREF | VT_BSTR) || V_VT(pvar) == VT_BSTR)
|
||||
{
|
||||
BSTR ret = V_ISBYREF(pvar) ? *V_BSTRREF(pvar) : V_BSTR(pvar);
|
||||
return ret ? ret : L"";
|
||||
}
|
||||
|
||||
return default_value;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* VariantToString (PROPSYS.@)
|
||||
*/
|
||||
HRESULT WINAPI VariantToString(REFVARIANT var, PWSTR ret, UINT cch)
|
||||
{
|
||||
WCHAR buffer[64], *str = buffer;
|
||||
|
||||
TRACE("%p, %p, %u.\n", var, ret, cch);
|
||||
|
||||
*ret = 0;
|
||||
|
||||
if (!cch)
|
||||
return E_INVALIDARG;
|
||||
|
||||
switch (V_VT(var))
|
||||
{
|
||||
case VT_BSTR:
|
||||
str = V_BSTR(var);
|
||||
break;
|
||||
case VT_I4:
|
||||
swprintf(buffer, ARRAY_SIZE(buffer), L"%d", V_I4(var));
|
||||
break;
|
||||
default:
|
||||
FIXME("Unsupported type %d.\n", V_VT(var));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
if (wcslen(str) > cch - 1)
|
||||
return STRSAFE_E_INSUFFICIENT_BUFFER;
|
||||
wcscpy(ret, str);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* PropVariantChangeType (PROPSYS.@)
|
||||
|
@ -437,7 +546,7 @@ HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT p
|
|||
return PropVariantCopy(ppropvarDest, propvarSrc);
|
||||
|
||||
if (propvarSrc->vt == VT_FILETIME)
|
||||
return PROPVAR_ConvertFILETIME(&propvarSrc->u.filetime, ppropvarDest, vt);
|
||||
return PROPVAR_ConvertFILETIME(&propvarSrc->filetime, ppropvarDest, vt);
|
||||
|
||||
switch (vt)
|
||||
{
|
||||
|
@ -449,7 +558,7 @@ HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT p
|
|||
if (SUCCEEDED(hr))
|
||||
{
|
||||
ppropvarDest->vt = VT_I1;
|
||||
ppropvarDest->u.cVal = (char)res;
|
||||
ppropvarDest->cVal = (char)res;
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
@ -462,7 +571,7 @@ HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT p
|
|||
if (SUCCEEDED(hr))
|
||||
{
|
||||
ppropvarDest->vt = VT_UI1;
|
||||
ppropvarDest->u.bVal = (UCHAR)res;
|
||||
ppropvarDest->bVal = (UCHAR)res;
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
@ -474,7 +583,7 @@ HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT p
|
|||
if (SUCCEEDED(hr))
|
||||
{
|
||||
ppropvarDest->vt = VT_I2;
|
||||
ppropvarDest->u.iVal = res;
|
||||
ppropvarDest->iVal = res;
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
@ -485,7 +594,7 @@ HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT p
|
|||
if (SUCCEEDED(hr))
|
||||
{
|
||||
ppropvarDest->vt = VT_UI2;
|
||||
ppropvarDest->u.uiVal = res;
|
||||
ppropvarDest->uiVal = res;
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
@ -496,7 +605,7 @@ HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT p
|
|||
if (SUCCEEDED(hr))
|
||||
{
|
||||
ppropvarDest->vt = VT_I4;
|
||||
ppropvarDest->u.lVal = res;
|
||||
ppropvarDest->lVal = res;
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
@ -507,7 +616,7 @@ HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT p
|
|||
if (SUCCEEDED(hr))
|
||||
{
|
||||
ppropvarDest->vt = VT_UI4;
|
||||
ppropvarDest->u.ulVal = res;
|
||||
ppropvarDest->ulVal = res;
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
@ -518,7 +627,7 @@ HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT p
|
|||
if (SUCCEEDED(hr))
|
||||
{
|
||||
ppropvarDest->vt = VT_I8;
|
||||
ppropvarDest->u.hVal.QuadPart = res;
|
||||
ppropvarDest->hVal.QuadPart = res;
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
@ -529,7 +638,7 @@ HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT p
|
|||
if (SUCCEEDED(hr))
|
||||
{
|
||||
ppropvarDest->vt = VT_UI8;
|
||||
ppropvarDest->u.uhVal.QuadPart = res;
|
||||
ppropvarDest->uhVal.QuadPart = res;
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
@ -542,7 +651,7 @@ HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT p
|
|||
if (SUCCEEDED(hr))
|
||||
{
|
||||
ppropvarDest->vt = VT_LPWSTR;
|
||||
ppropvarDest->u.pwszVal = res;
|
||||
ppropvarDest->pwszVal = res;
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
@ -562,7 +671,7 @@ HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT p
|
|||
{
|
||||
WideCharToMultiByte(CP_ACP, 0, resW, -1, res, len, NULL, NULL);
|
||||
ppropvarDest->vt = VT_LPSTR;
|
||||
ppropvarDest->u.pszVal = res;
|
||||
ppropvarDest->pszVal = res;
|
||||
}
|
||||
else
|
||||
hr = E_OUTOFMEMORY;
|
||||
|
@ -577,18 +686,6 @@ HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT p
|
|||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
static void PROPVAR_GUIDToWSTR(REFGUID guid, WCHAR *str)
|
||||
{
|
||||
static const WCHAR format[] = {'{','%','0','8','X','-','%','0','4','X','-','%','0','4','X',
|
||||
'-','%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X','%','0','2','X',
|
||||
'%','0','2','X','%','0','2','X','%','0','2','X','}',0};
|
||||
|
||||
swprintf(str, format, guid->Data1, guid->Data2, guid->Data3,
|
||||
guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
|
||||
guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
|
||||
}
|
||||
|
||||
HRESULT WINAPI InitPropVariantFromGUIDAsString(REFGUID guid, PROPVARIANT *ppropvar)
|
||||
{
|
||||
TRACE("(%p %p)\n", guid, ppropvar);
|
||||
|
@ -597,11 +694,11 @@ HRESULT WINAPI InitPropVariantFromGUIDAsString(REFGUID guid, PROPVARIANT *ppropv
|
|||
return E_FAIL;
|
||||
|
||||
ppropvar->vt = VT_LPWSTR;
|
||||
ppropvar->u.pwszVal = CoTaskMemAlloc(39*sizeof(WCHAR));
|
||||
if(!ppropvar->u.pwszVal)
|
||||
ppropvar->pwszVal = CoTaskMemAlloc((GUID_STR_LEN + 1) * sizeof(WCHAR));
|
||||
if(!ppropvar->pwszVal)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
PROPVAR_GUIDToWSTR(guid, ppropvar->u.pwszVal);
|
||||
StringFromGUID2(guid, ppropvar->pwszVal, GUID_STR_LEN + 1);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -615,11 +712,11 @@ HRESULT WINAPI InitVariantFromGUIDAsString(REFGUID guid, VARIANT *pvar)
|
|||
}
|
||||
|
||||
V_VT(pvar) = VT_BSTR;
|
||||
V_BSTR(pvar) = SysAllocStringLen(NULL, 38);
|
||||
V_BSTR(pvar) = SysAllocStringLen(NULL, GUID_STR_LEN);
|
||||
if(!V_BSTR(pvar))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
PROPVAR_GUIDToWSTR(guid, V_BSTR(pvar));
|
||||
StringFromGUID2(guid, V_BSTR(pvar), GUID_STR_LEN + 1);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -627,13 +724,13 @@ HRESULT WINAPI InitPropVariantFromBuffer(const VOID *pv, UINT cb, PROPVARIANT *p
|
|||
{
|
||||
TRACE("(%p %u %p)\n", pv, cb, ppropvar);
|
||||
|
||||
ppropvar->u.caub.pElems = CoTaskMemAlloc(cb);
|
||||
if(!ppropvar->u.caub.pElems)
|
||||
ppropvar->caub.pElems = CoTaskMemAlloc(cb);
|
||||
if(!ppropvar->caub.pElems)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
ppropvar->vt = VT_VECTOR|VT_UI1;
|
||||
ppropvar->u.caub.cElems = cb;
|
||||
memcpy(ppropvar->u.caub.pElems, pv, cb);
|
||||
ppropvar->caub.cElems = cb;
|
||||
memcpy(ppropvar->caub.pElems, pv, cb);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -641,12 +738,44 @@ HRESULT WINAPI InitPropVariantFromCLSID(REFCLSID clsid, PROPVARIANT *ppropvar)
|
|||
{
|
||||
TRACE("(%s %p)\n", debugstr_guid(clsid), ppropvar);
|
||||
|
||||
ppropvar->u.puuid = CoTaskMemAlloc(sizeof(*ppropvar->u.puuid));
|
||||
if(!ppropvar->u.puuid)
|
||||
ppropvar->puuid = CoTaskMemAlloc(sizeof(*ppropvar->puuid));
|
||||
if(!ppropvar->puuid)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
ppropvar->vt = VT_CLSID;
|
||||
memcpy(ppropvar->u.puuid, clsid, sizeof(*ppropvar->u.puuid));
|
||||
memcpy(ppropvar->puuid, clsid, sizeof(*ppropvar->puuid));
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -681,6 +810,21 @@ HRESULT WINAPI InitVariantFromBuffer(const VOID *pv, UINT cb, VARIANT *pvar)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI InitVariantFromFileTime(const FILETIME *ft, VARIANT *var)
|
||||
{
|
||||
SYSTEMTIME st;
|
||||
|
||||
TRACE("%p, %p\n", ft, var);
|
||||
|
||||
VariantInit(var);
|
||||
if (!FileTimeToSystemTime(ft, &st))
|
||||
return E_INVALIDARG;
|
||||
if (!SystemTimeToVariantTime(&st, &V_DATE(var)))
|
||||
return E_INVALIDARG;
|
||||
V_VT(var) = VT_DATE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static inline DWORD PROPVAR_HexToNum(const WCHAR *hex)
|
||||
{
|
||||
DWORD ret;
|
||||
|
@ -759,11 +903,11 @@ HRESULT WINAPI PropVariantToGUID(const PROPVARIANT *ppropvar, GUID *guid)
|
|||
|
||||
switch(ppropvar->vt) {
|
||||
case VT_BSTR:
|
||||
return PROPVAR_WCHARToGUID(ppropvar->u.bstrVal, SysStringLen(ppropvar->u.bstrVal), guid);
|
||||
return PROPVAR_WCHARToGUID(ppropvar->bstrVal, SysStringLen(ppropvar->bstrVal), guid);
|
||||
case VT_LPWSTR:
|
||||
return PROPVAR_WCHARToGUID(ppropvar->u.pwszVal, lstrlenW(ppropvar->u.pwszVal), guid);
|
||||
return PROPVAR_WCHARToGUID(ppropvar->pwszVal, lstrlenW(ppropvar->pwszVal), guid);
|
||||
case VT_CLSID:
|
||||
memcpy(guid, ppropvar->u.puuid, sizeof(*ppropvar->u.puuid));
|
||||
memcpy(guid, ppropvar->puuid, sizeof(*ppropvar->puuid));
|
||||
return S_OK;
|
||||
|
||||
default:
|
||||
|
@ -797,17 +941,20 @@ static BOOL isemptyornull(const PROPVARIANT *propvar)
|
|||
if ((propvar->vt & VT_ARRAY) == VT_ARRAY)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<propvar->u.parray->cDims; i++)
|
||||
for (i=0; i<propvar->parray->cDims; i++)
|
||||
{
|
||||
if (propvar->u.parray->rgsabound[i].cElements != 0)
|
||||
if (propvar->parray->rgsabound[i].cElements != 0)
|
||||
break;
|
||||
}
|
||||
return i == propvar->u.parray->cDims;
|
||||
return i == propvar->parray->cDims;
|
||||
}
|
||||
if (propvar->vt == VT_CLSID)
|
||||
return !propvar->u.puuid;
|
||||
return !propvar->puuid;
|
||||
|
||||
/* FIXME: vectors, byrefs, errors? */
|
||||
if (propvar->vt & VT_VECTOR)
|
||||
return !propvar->caub.cElems;
|
||||
|
||||
/* FIXME: byrefs, errors? */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -816,6 +963,7 @@ INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2
|
|||
{
|
||||
const PROPVARIANT *propvar2_converted;
|
||||
PROPVARIANT propvar2_static;
|
||||
unsigned int count;
|
||||
HRESULT hr;
|
||||
INT res=-1;
|
||||
|
||||
|
@ -844,9 +992,9 @@ INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2
|
|||
propvar2_converted = propvar2;
|
||||
|
||||
#define CMP_NUM_VALUE(var) do { \
|
||||
if (propvar1->u.var > propvar2_converted->u.var) \
|
||||
if (propvar1->var > propvar2_converted->var) \
|
||||
res = 1; \
|
||||
else if (propvar1->u.var < propvar2_converted->u.var) \
|
||||
else if (propvar1->var < propvar2_converted->var) \
|
||||
res = -1; \
|
||||
else \
|
||||
res = 0; \
|
||||
|
@ -870,7 +1018,7 @@ INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2
|
|||
CMP_NUM_VALUE(lVal);
|
||||
break;
|
||||
case VT_UI4:
|
||||
CMP_NUM_VALUE(uiVal);
|
||||
CMP_NUM_VALUE(ulVal);
|
||||
break;
|
||||
case VT_I8:
|
||||
CMP_NUM_VALUE(hVal.QuadPart);
|
||||
|
@ -888,21 +1036,28 @@ INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2
|
|||
case VT_LPWSTR:
|
||||
/* FIXME: Use other string flags. */
|
||||
if (flags & (PVCF_USESTRCMPI | PVCF_USESTRCMPIC))
|
||||
res = lstrcmpiW(propvar1->u.bstrVal, propvar2_converted->u.bstrVal);
|
||||
res = lstrcmpiW(propvar1->bstrVal, propvar2_converted->bstrVal);
|
||||
else
|
||||
res = lstrcmpW(propvar1->u.bstrVal, propvar2_converted->u.bstrVal);
|
||||
res = lstrcmpW(propvar1->bstrVal, propvar2_converted->bstrVal);
|
||||
break;
|
||||
case VT_LPSTR:
|
||||
/* FIXME: Use other string flags. */
|
||||
if (flags & (PVCF_USESTRCMPI | PVCF_USESTRCMPIC))
|
||||
res = lstrcmpiA(propvar1->u.pszVal, propvar2_converted->u.pszVal);
|
||||
res = lstrcmpiA(propvar1->pszVal, propvar2_converted->pszVal);
|
||||
else
|
||||
res = lstrcmpA(propvar1->u.pszVal, propvar2_converted->u.pszVal);
|
||||
res = lstrcmpA(propvar1->pszVal, propvar2_converted->pszVal);
|
||||
break;
|
||||
case VT_CLSID:
|
||||
res = memcmp(propvar1->u.puuid, propvar2->u.puuid, sizeof(*propvar1->u.puuid));
|
||||
res = memcmp(propvar1->puuid, propvar2->puuid, sizeof(*propvar1->puuid));
|
||||
if (res) res = res > 0 ? 1 : -1;
|
||||
break;
|
||||
case VT_VECTOR | VT_UI1:
|
||||
count = min(propvar1->caub.cElems, propvar2->caub.cElems);
|
||||
res = count ? memcmp(propvar1->caub.pElems, propvar2->caub.pElems, sizeof(*propvar1->caub.pElems) * count) : 0;
|
||||
if (res) res = res > 0 ? 1 : -1;
|
||||
if (!res && propvar1->caub.cElems != propvar2->caub.cElems)
|
||||
res = propvar1->caub.cElems > propvar2->caub.cElems ? 1 : -1;
|
||||
break;
|
||||
default:
|
||||
FIXME("vartype %#x not handled\n", propvar1->vt);
|
||||
res = -1;
|
||||
|
@ -914,3 +1069,158 @@ INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2
|
|||
|
||||
return res;
|
||||
}
|
||||
|
||||
HRESULT WINAPI PropVariantToVariant(const PROPVARIANT *propvar, VARIANT *var)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
TRACE("propvar %p, var %p, propvar->vt %#x.\n", propvar, var, propvar ? propvar->vt : 0);
|
||||
|
||||
if (!var || !propvar)
|
||||
return E_INVALIDARG;
|
||||
|
||||
VariantInit(var);
|
||||
#ifdef __REACTOS__
|
||||
V_VT(var) = propvar->vt;
|
||||
#else
|
||||
var->vt = propvar->vt;
|
||||
#endif
|
||||
|
||||
switch (propvar->vt)
|
||||
{
|
||||
case VT_EMPTY:
|
||||
case VT_NULL:
|
||||
break;
|
||||
case VT_I1:
|
||||
V_I1(var) = propvar->cVal;
|
||||
break;
|
||||
case VT_I2:
|
||||
V_I2(var) = propvar->iVal;
|
||||
break;
|
||||
case VT_I4:
|
||||
V_I4(var) = propvar->lVal;
|
||||
break;
|
||||
case VT_I8:
|
||||
V_I8(var) = propvar->hVal.QuadPart;
|
||||
break;
|
||||
case VT_UI1:
|
||||
V_UI1(var) = propvar->bVal;
|
||||
break;
|
||||
case VT_UI2:
|
||||
V_UI2(var) = propvar->uiVal;
|
||||
break;
|
||||
case VT_UI4:
|
||||
V_UI4(var) = propvar->ulVal;
|
||||
break;
|
||||
case VT_UI8:
|
||||
V_UI8(var) = propvar->uhVal.QuadPart;
|
||||
break;
|
||||
case VT_BOOL:
|
||||
V_BOOL(var) = propvar->boolVal;
|
||||
break;
|
||||
case VT_R4:
|
||||
V_R4(var) = propvar->fltVal;
|
||||
break;
|
||||
case VT_R8:
|
||||
V_R8(var) = propvar->dblVal;
|
||||
break;
|
||||
case VT_LPSTR:
|
||||
case VT_LPWSTR:
|
||||
case VT_BSTR:
|
||||
case VT_CLSID:
|
||||
#ifdef __REACTOS__
|
||||
V_VT(var) = VT_BSTR;
|
||||
#else
|
||||
var->vt = VT_BSTR;
|
||||
#endif
|
||||
hr = PropVariantToBSTR(propvar, &V_BSTR(var));
|
||||
break;
|
||||
default:
|
||||
FIXME("Unsupported type %d.\n", propvar->vt);
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI VariantToPropVariant(const VARIANT *var, PROPVARIANT *propvar)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("var %p, propvar %p.\n", debugstr_variant(var), propvar);
|
||||
|
||||
if (!var || !propvar)
|
||||
return E_INVALIDARG;
|
||||
|
||||
#ifdef __REACTOS__
|
||||
if (FAILED(hr = VARIANT_ValidateType(V_VT(var))))
|
||||
#else
|
||||
if (FAILED(hr = VARIANT_ValidateType(var->vt)))
|
||||
#endif
|
||||
return hr;
|
||||
|
||||
PropVariantInit(propvar);
|
||||
|
||||
|
||||
#ifdef __REACTOS__
|
||||
propvar->vt = V_VT(var);
|
||||
#else
|
||||
propvar->vt = var->vt;
|
||||
#endif
|
||||
|
||||
#ifdef __REACTOS__
|
||||
switch (V_VT(var))
|
||||
#else
|
||||
switch (var->vt)
|
||||
#endif
|
||||
{
|
||||
case VT_EMPTY:
|
||||
case VT_NULL:
|
||||
break;
|
||||
case VT_I1:
|
||||
propvar->cVal = V_I1(var);
|
||||
break;
|
||||
case VT_I2:
|
||||
propvar->iVal = V_I2(var);
|
||||
break;
|
||||
case VT_I4:
|
||||
propvar->lVal = V_I4(var);
|
||||
break;
|
||||
case VT_I8:
|
||||
propvar->hVal.QuadPart = V_I8(var);
|
||||
break;
|
||||
case VT_UI1:
|
||||
propvar->bVal = V_UI1(var);
|
||||
break;
|
||||
case VT_UI2:
|
||||
propvar->uiVal = V_UI2(var);
|
||||
break;
|
||||
case VT_UI4:
|
||||
propvar->ulVal = V_UI4(var);
|
||||
break;
|
||||
case VT_UI8:
|
||||
propvar->uhVal.QuadPart = V_UI8(var);
|
||||
break;
|
||||
case VT_BOOL:
|
||||
propvar->boolVal = V_BOOL(var);
|
||||
break;
|
||||
case VT_R4:
|
||||
propvar->fltVal = V_R4(var);
|
||||
break;
|
||||
case VT_R8:
|
||||
propvar->dblVal = V_R8(var);
|
||||
break;
|
||||
case VT_BSTR:
|
||||
propvar->bstrVal = SysAllocString(V_BSTR(var));
|
||||
break;
|
||||
default:
|
||||
#ifdef __REACTOS__
|
||||
FIXME("Unsupported type %d.\n", V_VT(var));
|
||||
#else
|
||||
FIXME("Unsupported type %d.\n", var->vt);
|
||||
#endif
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ dll/win32/pdh # Synced to WineStaging-4.18
|
|||
dll/win32/pidgen # Synced to WineStaging-4.18
|
||||
dll/win32/powrprof # Forked at Wine-1.0rc5
|
||||
dll/win32/printui # Synced to WineStaging-4.18
|
||||
dll/win32/propsys # Synced to WineStaging-4.18
|
||||
dll/win32/propsys # Synced to Wine-10.0
|
||||
dll/win32/pstorec # Synced to WineStaging-3.3
|
||||
dll/win32/qmgr # Synced to WineStaging-4.18
|
||||
dll/win32/qmgrprxy # Synced to WineStaging-2.9
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
add_definitions(-DUSE_WINE_TODOS -DWINETEST_USE_DBGSTR_LONGLONG)
|
||||
add_executable(propsys_winetest propstore.c propsys.c testlist.c)
|
||||
remove_definitions(-D__ROS_LONG64__)
|
||||
add_executable(propsys_winetest propsys.c testlist.c)
|
||||
set_module_type(propsys_winetest win32cui)
|
||||
add_importlibs(propsys_winetest propsys ole32 oleaut32 msvcrt kernel32)
|
||||
|
||||
|
|
|
@ -1,374 +0,0 @@
|
|||
/*
|
||||
* Unit tests for IPropertyStore and related interfaces
|
||||
*
|
||||
* Copyright 2012 Vincent Povirk
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define NONAMELESSUNION
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "objbase.h"
|
||||
#include "propsys.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
#include "initguid.h"
|
||||
|
||||
DEFINE_GUID(PKEY_WineTest, 0x7b317433, 0xdfa3, 0x4c44, 0xad, 0x3e, 0x2f, 0x80, 0x4b, 0x90, 0xdb, 0xf4);
|
||||
DEFINE_GUID(DUMMY_GUID1, 0x12345678, 0x1234,0x1234, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19);
|
||||
|
||||
#define EXPECT_REF(obj,ref) _expect_ref((IUnknown *)obj, ref, __LINE__)
|
||||
static void _expect_ref(IUnknown *obj, ULONG ref, int line)
|
||||
{
|
||||
ULONG rc;
|
||||
IUnknown_AddRef(obj);
|
||||
rc = IUnknown_Release(obj);
|
||||
ok_(__FILE__,line)(rc == ref, "expected refcount %d, got %d\n", ref, rc);
|
||||
}
|
||||
|
||||
static void test_inmemorystore(void)
|
||||
{
|
||||
IPropertyStoreCache *propcache;
|
||||
HRESULT hr;
|
||||
PROPERTYKEY pkey;
|
||||
PROPVARIANT propvar;
|
||||
DWORD count;
|
||||
PSC_STATE state;
|
||||
|
||||
hr = CoCreateInstance(&CLSID_InMemoryPropertyStore, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IPropertyStoreCache, (void**)&propcache);
|
||||
ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
skip("CLSID_InMemoryPropertyStore not supported\n");
|
||||
return;
|
||||
}
|
||||
|
||||
hr = IPropertyStoreCache_GetCount(propcache, NULL);
|
||||
ok(hr == E_POINTER, "GetCount failed, hr=%x\n", hr);
|
||||
|
||||
hr = IPropertyStoreCache_GetCount(propcache, &count);
|
||||
ok(hr == S_OK, "GetCount failed, hr=%x\n", hr);
|
||||
ok(count == 0, "GetCount returned %i, expected 0\n", count);
|
||||
|
||||
hr = IPropertyStoreCache_Commit(propcache);
|
||||
ok(hr == S_OK, "Commit failed, hr=%x\n", hr);
|
||||
|
||||
hr = IPropertyStoreCache_Commit(propcache);
|
||||
ok(hr == S_OK, "Commit failed, hr=%x\n", hr);
|
||||
|
||||
hr = IPropertyStoreCache_GetAt(propcache, 0, &pkey);
|
||||
ok(hr == E_INVALIDARG, "GetAt failed, hr=%x\n", hr);
|
||||
|
||||
pkey.fmtid = PKEY_WineTest;
|
||||
pkey.pid = 4;
|
||||
|
||||
memset(&propvar, 0, sizeof(propvar));
|
||||
propvar.vt = VT_I4;
|
||||
propvar.u.lVal = 12345;
|
||||
|
||||
if (0)
|
||||
{
|
||||
/* Crashes on Windows 7 */
|
||||
hr = IPropertyStoreCache_SetValue(propcache, NULL, &propvar);
|
||||
ok(hr == E_POINTER, "SetValue failed, hr=%x\n", hr);
|
||||
|
||||
hr = IPropertyStoreCache_SetValue(propcache, &pkey, NULL);
|
||||
ok(hr == E_POINTER, "SetValue failed, hr=%x\n", hr);
|
||||
}
|
||||
|
||||
hr = IPropertyStoreCache_SetValue(propcache, &pkey, &propvar);
|
||||
ok(hr == S_OK, "SetValue failed, hr=%x\n", hr);
|
||||
|
||||
hr = IPropertyStoreCache_GetCount(propcache, &count);
|
||||
ok(hr == S_OK, "GetCount failed, hr=%x\n", hr);
|
||||
ok(count == 1, "GetCount returned %i, expected 0\n", count);
|
||||
|
||||
memset(&pkey, 0, sizeof(pkey));
|
||||
|
||||
hr = IPropertyStoreCache_GetAt(propcache, 0, &pkey);
|
||||
ok(hr == S_OK, "GetAt failed, hr=%x\n", hr);
|
||||
ok(IsEqualGUID(&pkey.fmtid, &PKEY_WineTest), "got wrong pkey\n");
|
||||
ok(pkey.pid == 4, "got pid of %i, expected 4\n", pkey.pid);
|
||||
|
||||
pkey.fmtid = PKEY_WineTest;
|
||||
pkey.pid = 4;
|
||||
|
||||
memset(&propvar, 0, sizeof(propvar));
|
||||
|
||||
if (0)
|
||||
{
|
||||
/* Crashes on Windows 7 */
|
||||
hr = IPropertyStoreCache_GetValue(propcache, NULL, &propvar);
|
||||
ok(hr == E_POINTER, "GetValue failed, hr=%x\n", hr);
|
||||
}
|
||||
|
||||
hr = IPropertyStoreCache_GetValue(propcache, &pkey, NULL);
|
||||
ok(hr == E_POINTER, "GetValue failed, hr=%x\n", hr);
|
||||
|
||||
hr = IPropertyStoreCache_GetValue(propcache, &pkey, &propvar);
|
||||
ok(hr == S_OK, "GetValue failed, hr=%x\n", hr);
|
||||
ok(propvar.vt == VT_I4, "expected VT_I4, got %d\n", propvar.vt);
|
||||
ok(propvar.u.lVal == 12345, "expected 12345, got %d\n", propvar.u.lVal);
|
||||
|
||||
pkey.fmtid = PKEY_WineTest;
|
||||
pkey.pid = 10;
|
||||
|
||||
/* Get information for field that isn't set yet */
|
||||
propvar.vt = VT_I2;
|
||||
hr = IPropertyStoreCache_GetValue(propcache, &pkey, &propvar);
|
||||
ok(hr == S_OK, "GetValue failed, hr=%x\n", hr);
|
||||
ok(propvar.vt == VT_EMPTY, "expected VT_EMPTY, got %d\n", propvar.vt);
|
||||
|
||||
state = 0xdeadbeef;
|
||||
hr = IPropertyStoreCache_GetState(propcache, &pkey, &state);
|
||||
ok(hr == TYPE_E_ELEMENTNOTFOUND, "GetState failed, hr=%x\n", hr);
|
||||
ok(state == PSC_NORMAL, "expected PSC_NORMAL, got %d\n", state);
|
||||
|
||||
propvar.vt = VT_I2;
|
||||
state = 0xdeadbeef;
|
||||
hr = IPropertyStoreCache_GetValueAndState(propcache, &pkey, &propvar, &state);
|
||||
ok(hr == TYPE_E_ELEMENTNOTFOUND, "GetValueAndState failed, hr=%x\n", hr);
|
||||
ok(propvar.vt == VT_EMPTY, "expected VT_EMPTY, got %d\n", propvar.vt);
|
||||
ok(state == PSC_NORMAL, "expected PSC_NORMAL, got %d\n", state);
|
||||
|
||||
/* Set state on an unset field */
|
||||
hr = IPropertyStoreCache_SetState(propcache, &pkey, PSC_NORMAL);
|
||||
ok(hr == TYPE_E_ELEMENTNOTFOUND, "SetState failed, hr=%x\n", hr);
|
||||
|
||||
/* Manipulate state on already set field */
|
||||
pkey.fmtid = PKEY_WineTest;
|
||||
pkey.pid = 4;
|
||||
|
||||
state = 0xdeadbeef;
|
||||
hr = IPropertyStoreCache_GetState(propcache, &pkey, &state);
|
||||
ok(hr == S_OK, "GetState failed, hr=%x\n", hr);
|
||||
ok(state == PSC_NORMAL, "expected PSC_NORMAL, got %d\n", state);
|
||||
|
||||
hr = IPropertyStoreCache_SetState(propcache, &pkey, 10);
|
||||
ok(hr == S_OK, "SetState failed, hr=%x\n", hr);
|
||||
|
||||
state = 0xdeadbeef;
|
||||
hr = IPropertyStoreCache_GetState(propcache, &pkey, &state);
|
||||
ok(hr == S_OK, "GetState failed, hr=%x\n", hr);
|
||||
ok(state == 10, "expected 10, got %d\n", state);
|
||||
|
||||
propvar.vt = VT_I4;
|
||||
propvar.u.lVal = 12346;
|
||||
hr = IPropertyStoreCache_SetValueAndState(propcache, &pkey, &propvar, 5);
|
||||
ok(hr == S_OK, "SetValueAndState failed, hr=%x\n", hr);
|
||||
|
||||
memset(&propvar, 0, sizeof(propvar));
|
||||
state = 0xdeadbeef;
|
||||
hr = IPropertyStoreCache_GetValueAndState(propcache, &pkey, &propvar, &state);
|
||||
ok(hr == S_OK, "GetValueAndState failed, hr=%x\n", hr);
|
||||
ok(propvar.vt == VT_I4, "expected VT_I4, got %d\n", propvar.vt);
|
||||
ok(propvar.u.lVal == 12346, "expected 12346, got %d\n", propvar.vt);
|
||||
ok(state == 5, "expected 5, got %d\n", state);
|
||||
|
||||
/* Set new field with state */
|
||||
pkey.fmtid = PKEY_WineTest;
|
||||
pkey.pid = 8;
|
||||
|
||||
propvar.vt = VT_I4;
|
||||
propvar.u.lVal = 12347;
|
||||
hr = IPropertyStoreCache_SetValueAndState(propcache, &pkey, &propvar, PSC_DIRTY);
|
||||
ok(hr == S_OK, "SetValueAndState failed, hr=%x\n", hr);
|
||||
|
||||
memset(&propvar, 0, sizeof(propvar));
|
||||
state = 0xdeadbeef;
|
||||
hr = IPropertyStoreCache_GetValueAndState(propcache, &pkey, &propvar, &state);
|
||||
ok(hr == S_OK, "GetValueAndState failed, hr=%x\n", hr);
|
||||
ok(propvar.vt == VT_I4, "expected VT_I4, got %d\n", propvar.vt);
|
||||
ok(propvar.u.lVal == 12347, "expected 12347, got %d\n", propvar.vt);
|
||||
ok(state == PSC_DIRTY, "expected PSC_DIRTY, got %d\n", state);
|
||||
|
||||
IPropertyStoreCache_Release(propcache);
|
||||
}
|
||||
|
||||
static void test_persistserialized(void)
|
||||
{
|
||||
IPropertyStore *propstore;
|
||||
IPersistSerializedPropStorage *serialized;
|
||||
HRESULT hr;
|
||||
SERIALIZEDPROPSTORAGE *result;
|
||||
DWORD result_size;
|
||||
|
||||
hr = CoCreateInstance(&CLSID_InMemoryPropertyStore, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IPropertyStore, (void**)&propstore);
|
||||
ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
|
||||
|
||||
hr = IPropertyStore_QueryInterface(propstore, &IID_IPersistSerializedPropStorage,
|
||||
(void**)&serialized);
|
||||
todo_wine ok(hr == S_OK, "QueryInterface failed, hr=%x\n", hr);
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
IPropertyStore_Release(propstore);
|
||||
skip("IPersistSerializedPropStorage not supported\n");
|
||||
return;
|
||||
}
|
||||
|
||||
hr = IPersistSerializedPropStorage_GetPropertyStorage(serialized, NULL, &result_size);
|
||||
ok(hr == E_POINTER, "GetPropertyStorage failed, hr=%x\n", hr);
|
||||
|
||||
hr = IPersistSerializedPropStorage_GetPropertyStorage(serialized, &result, NULL);
|
||||
ok(hr == E_POINTER, "GetPropertyStorage failed, hr=%x\n", hr);
|
||||
|
||||
hr = IPersistSerializedPropStorage_GetPropertyStorage(serialized, &result, &result_size);
|
||||
ok(hr == S_OK, "GetPropertyStorage failed, hr=%x\n", hr);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
ok(result_size == 0, "expected 0 bytes, got %i\n", result_size);
|
||||
|
||||
CoTaskMemFree(result);
|
||||
}
|
||||
|
||||
hr = IPersistSerializedPropStorage_SetPropertyStorage(serialized, NULL, 4);
|
||||
ok(hr == E_POINTER, "SetPropertyStorage failed, hr=%x\n", hr);
|
||||
|
||||
hr = IPersistSerializedPropStorage_SetPropertyStorage(serialized, NULL, 0);
|
||||
ok(hr == S_OK, "SetPropertyStorage failed, hr=%x\n", hr);
|
||||
|
||||
hr = IPropertyStore_GetCount(propstore, &result_size);
|
||||
ok(hr == S_OK, "GetCount failed, hr=%x\n", hr);
|
||||
ok(result_size == 0, "expecting 0, got %d\n", result_size);
|
||||
|
||||
IPropertyStore_Release(propstore);
|
||||
IPersistSerializedPropStorage_Release(serialized);
|
||||
}
|
||||
|
||||
static void test_PSCreateMemoryPropertyStore(void)
|
||||
{
|
||||
IPropertyStore *propstore, *propstore1;
|
||||
IPersistSerializedPropStorage *serialized;
|
||||
IPropertyStoreCache *propstorecache;
|
||||
HRESULT hr;
|
||||
|
||||
/* PSCreateMemoryPropertyStore(&IID_IPropertyStore, NULL); crashes */
|
||||
|
||||
hr = PSCreateMemoryPropertyStore(&IID_IPropertyStore, (void **)&propstore);
|
||||
ok(hr == S_OK, "PSCreateMemoryPropertyStore failed: 0x%08x.\n", hr);
|
||||
ok(propstore != NULL, "got %p.\n", propstore);
|
||||
EXPECT_REF(propstore, 1);
|
||||
|
||||
hr = PSCreateMemoryPropertyStore(&IID_IPersistSerializedPropStorage, (void **)&serialized);
|
||||
todo_wine ok(hr == S_OK, "PSCreateMemoryPropertyStore failed: 0x%08x.\n", hr);
|
||||
todo_wine ok(serialized != NULL, "got %p.\n", serialized);
|
||||
EXPECT_REF(propstore, 1);
|
||||
if(serialized)
|
||||
{
|
||||
EXPECT_REF(serialized, 1);
|
||||
IPersistSerializedPropStorage_Release(serialized);
|
||||
}
|
||||
|
||||
hr = PSCreateMemoryPropertyStore(&IID_IPropertyStoreCache, (void **)&propstorecache);
|
||||
ok(hr == S_OK, "PSCreateMemoryPropertyStore failed: 0x%08x.\n", hr);
|
||||
ok(propstorecache != NULL, "got %p.\n", propstore);
|
||||
ok(propstorecache != (IPropertyStoreCache *)propstore, "pointer are equal: %p, %p.\n", propstorecache, propstore);
|
||||
EXPECT_REF(propstore, 1);
|
||||
EXPECT_REF(propstorecache, 1);
|
||||
|
||||
hr = PSCreateMemoryPropertyStore(&IID_IPropertyStore, (void **)&propstore1);
|
||||
ok(hr == S_OK, "PSCreateMemoryPropertyStore failed: 0x%08x.\n", hr);
|
||||
ok(propstore1 != NULL, "got %p.\n", propstore);
|
||||
ok(propstore1 != propstore, "pointer are equal: %p, %p.\n", propstore1, propstore);
|
||||
EXPECT_REF(propstore, 1);
|
||||
EXPECT_REF(propstore1, 1);
|
||||
EXPECT_REF(propstorecache, 1);
|
||||
|
||||
IPropertyStore_Release(propstore1);
|
||||
IPropertyStore_Release(propstore);
|
||||
IPropertyStoreCache_Release(propstorecache);
|
||||
}
|
||||
|
||||
static void test_propertystore(void)
|
||||
{
|
||||
IPropertyStore *propstore;
|
||||
HRESULT hr;
|
||||
PROPVARIANT propvar, ret_propvar;
|
||||
PROPERTYKEY propkey;
|
||||
DWORD count = 0;
|
||||
|
||||
hr = PSCreateMemoryPropertyStore(&IID_IPropertyStore, (void **)&propstore);
|
||||
ok(hr == S_OK, "PSCreateMemoryPropertyStore failed: 0x%08x.\n", hr);
|
||||
ok(propstore != NULL, "got %p.\n", propstore);
|
||||
|
||||
hr = IPropertyStore_GetCount(propstore, &count);
|
||||
ok(hr == S_OK, "IPropertyStore_GetCount failed: 0x%08x.\n", hr);
|
||||
ok(!count, "got wrong property count: %d, expected 0.\n", count);
|
||||
|
||||
PropVariantInit(&propvar);
|
||||
propvar.vt = VT_I4;
|
||||
U(propvar).lVal = 123;
|
||||
propkey.fmtid = DUMMY_GUID1;
|
||||
propkey.pid = PID_FIRST_USABLE;
|
||||
hr = IPropertyStore_SetValue(propstore, &propkey, &propvar);
|
||||
ok(hr == S_OK, "IPropertyStore_SetValue failed: 0x%08x.\n", hr);
|
||||
hr = IPropertyStore_Commit(propstore);
|
||||
ok(hr == S_OK, "IPropertyStore_Commit failed: 0x%08x.\n", hr);
|
||||
hr = IPropertyStore_GetCount(propstore, &count);
|
||||
ok(hr == S_OK, "IPropertyStore_GetCount failed: 0x%08x.\n", hr);
|
||||
ok(count == 1, "got wrong property count: %d, expected 1.\n", count);
|
||||
PropVariantInit(&ret_propvar);
|
||||
ret_propvar.vt = VT_I4;
|
||||
hr = IPropertyStore_GetValue(propstore, &propkey, &ret_propvar);
|
||||
ok(hr == S_OK, "IPropertyStore_GetValue failed: 0x%08x.\n", hr);
|
||||
ok(ret_propvar.vt == VT_I4, "got wrong property type: %x.\n", ret_propvar.vt);
|
||||
ok(U(ret_propvar).lVal == 123, "got wrong value: %d, expected 123.\n", U(ret_propvar).lVal);
|
||||
PropVariantClear(&propvar);
|
||||
PropVariantClear(&ret_propvar);
|
||||
|
||||
PropVariantInit(&propvar);
|
||||
propkey.fmtid = DUMMY_GUID1;
|
||||
propkey.pid = PID_FIRST_USABLE;
|
||||
hr = IPropertyStore_SetValue(propstore, &propkey, &propvar);
|
||||
ok(hr == S_OK, "IPropertyStore_SetValue failed: 0x%08x.\n", hr);
|
||||
hr = IPropertyStore_Commit(propstore);
|
||||
ok(hr == S_OK, "IPropertyStore_Commit failed: 0x%08x.\n", hr);
|
||||
hr = IPropertyStore_GetCount(propstore, &count);
|
||||
ok(hr == S_OK, "IPropertyStore_GetCount failed: 0x%08x.\n", hr);
|
||||
ok(count == 1, "got wrong property count: %d, expected 1.\n", count);
|
||||
PropVariantInit(&ret_propvar);
|
||||
hr = IPropertyStore_GetValue(propstore, &propkey, &ret_propvar);
|
||||
ok(hr == S_OK, "IPropertyStore_GetValue failed: 0x%08x.\n", hr);
|
||||
ok(ret_propvar.vt == VT_EMPTY, "got wrong property type: %x.\n", ret_propvar.vt);
|
||||
ok(!U(ret_propvar).lVal, "got wrong value: %d, expected 0.\n", U(ret_propvar).lVal);
|
||||
PropVariantClear(&propvar);
|
||||
PropVariantClear(&ret_propvar);
|
||||
|
||||
IPropertyStore_Release(propstore);
|
||||
}
|
||||
|
||||
START_TEST(propstore)
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
|
||||
test_inmemorystore();
|
||||
test_persistserialized();
|
||||
test_PSCreateMemoryPropertyStore();
|
||||
test_propertystore();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -3,12 +3,10 @@
|
|||
#define STANDALONE
|
||||
#include <wine/test.h>
|
||||
|
||||
extern void func_propstore(void);
|
||||
extern void func_propsys(void);
|
||||
|
||||
const struct test winetest_testlist[] =
|
||||
{
|
||||
{ "propstore", func_propstore },
|
||||
{ "propsys", func_propsys },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
|
|
@ -230,6 +230,17 @@ typedef VARIANT *LPVARIANT;
|
|||
typedef VARIANT VARIANTARG;
|
||||
typedef VARIANTARG *LPVARIANTARG;
|
||||
|
||||
cpp_quote("#ifdef MIDL_PASS")
|
||||
typedef const VARIANT *REFVARIANT;
|
||||
cpp_quote("#elif !defined(_REFVARIANT_DEFINED)")
|
||||
cpp_quote("#define _REFVARIANT_DEFINED")
|
||||
cpp_quote("#ifdef __cplusplus")
|
||||
cpp_quote("#define REFVARIANT const VARIANT &")
|
||||
cpp_quote("#else")
|
||||
cpp_quote("#define REFVARIANT const VARIANT *__MIDL_CONST")
|
||||
cpp_quote("#endif")
|
||||
cpp_quote("#endif")
|
||||
|
||||
struct _wireBRECORD {
|
||||
ULONG fFlags;
|
||||
ULONG clSize;
|
||||
|
|
|
@ -27,7 +27,13 @@ import "shtypes.idl";
|
|||
import "structuredquerycondition.idl";
|
||||
|
||||
cpp_quote("#ifndef PSSTDAPI")
|
||||
cpp_quote("#define PSSTDAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE")
|
||||
cpp_quote("#ifdef _PROPSYS_")
|
||||
cpp_quote("#define PSSTDAPI STDAPI")
|
||||
cpp_quote("#define PSSTDAPI_(type) STDAPI_(type)")
|
||||
cpp_quote("#else")
|
||||
cpp_quote("#define PSSTDAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE")
|
||||
cpp_quote("#define PSSTDAPI_(type) EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE")
|
||||
cpp_quote("#endif")
|
||||
cpp_quote("#endif")
|
||||
|
||||
cpp_quote("#if 0")
|
||||
|
@ -272,7 +278,7 @@ interface IPropertyEnumType : IUnknown
|
|||
}
|
||||
|
||||
[
|
||||
uuid(9b6e051c-5ddd-4321-9070-fe2acb55e974),
|
||||
uuid(9b6e051c-5ddd-4321-9070-fe2acb55e794),
|
||||
object,
|
||||
pointer_default(unique)
|
||||
]
|
||||
|
@ -799,14 +805,15 @@ cpp_quote("#define PKEY_PIDSTR_MAX 10")
|
|||
cpp_quote("#define GUIDSTRING_MAX 39")
|
||||
cpp_quote("#define PKEYSTR_MAX (GUIDSTRING_MAX + 1 + PKEY_PIDSTR_MAX)")
|
||||
|
||||
cpp_quote("HRESULT WINAPI PSCreateMemoryPropertyStore(REFIID,void **);")
|
||||
cpp_quote("HRESULT WINAPI PSStringFromPropertyKey(REFPROPERTYKEY,LPWSTR,UINT);")
|
||||
cpp_quote("HRESULT WINAPI PSPropertyKeyFromString(LPCWSTR,PROPERTYKEY*);")
|
||||
cpp_quote("HRESULT WINAPI PSGetPropertyDescription(REFPROPERTYKEY,REFIID,void **);")
|
||||
cpp_quote("HRESULT WINAPI PSGetPropertyDescriptionListFromString(LPCWSTR,REFIID,void **);")
|
||||
cpp_quote("HRESULT WINAPI PSRefreshPropertySchema(void);")
|
||||
cpp_quote("HRESULT WINAPI PSRegisterPropertySchema(LPCWSTR);")
|
||||
cpp_quote("HRESULT WINAPI PSUnregisterPropertySchema(LPCWSTR);")
|
||||
cpp_quote("PSSTDAPI PSCreateMemoryPropertyStore(REFIID,void **);")
|
||||
cpp_quote("PSSTDAPI PSCreatePropertyStoreFromObject(IUnknown*,DWORD,REFIID,void **);")
|
||||
cpp_quote("PSSTDAPI PSStringFromPropertyKey(REFPROPERTYKEY,LPWSTR,UINT);")
|
||||
cpp_quote("PSSTDAPI PSPropertyKeyFromString(LPCWSTR,PROPERTYKEY*);")
|
||||
cpp_quote("PSSTDAPI PSGetPropertyDescription(REFPROPERTYKEY,REFIID,void **);")
|
||||
cpp_quote("PSSTDAPI PSGetPropertyDescriptionListFromString(LPCWSTR,REFIID,void **);")
|
||||
cpp_quote("PSSTDAPI PSRefreshPropertySchema(void);")
|
||||
cpp_quote("PSSTDAPI PSRegisterPropertySchema(LPCWSTR);")
|
||||
cpp_quote("PSSTDAPI PSUnregisterPropertySchema(LPCWSTR);")
|
||||
|
||||
/* TODO: Add remainder of the C api here */
|
||||
|
||||
|
@ -821,7 +828,7 @@ library PropSysObjects
|
|||
{
|
||||
interface IPropertyStore;
|
||||
}
|
||||
[uuid(b8967f86-58ae-4f96-9fb2-5d7904798f4b)] coclass PropertySystem
|
||||
[uuid(b8967f85-58ae-4f46-9fb2-5d7904798f4b)] coclass PropertySystem
|
||||
{
|
||||
interface IPropertySystem;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,16 @@
|
|||
#include <shtypes.h>
|
||||
#include <shlwapi.h>
|
||||
|
||||
#ifndef PSSTDAPI
|
||||
#ifdef _PROPSYS_
|
||||
#define PSSTDAPI STDAPI
|
||||
#define PSSTDAPI_(type) STDAPI_(type)
|
||||
#else
|
||||
#define PSSTDAPI DECLSPEC_IMPORT STDAPI
|
||||
#define PSSTDAPI_(type) DECLSPEC_IMPORT STDAPI_(type)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -63,37 +73,56 @@ enum tagPROPVAR_COMPARE_FLAGS
|
|||
|
||||
typedef int PROPVAR_COMPARE_FLAGS;
|
||||
|
||||
HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT propvarSrc,
|
||||
PSSTDAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT propvarSrc,
|
||||
PROPVAR_CHANGE_FLAGS flags, VARTYPE vt);
|
||||
HRESULT WINAPI InitPropVariantFromGUIDAsString(REFGUID guid, PROPVARIANT *ppropvar);
|
||||
HRESULT WINAPI InitVariantFromGUIDAsString(REFGUID guid, VARIANT *pvar);
|
||||
HRESULT WINAPI InitPropVariantFromBuffer(const VOID *pv, UINT cb, PROPVARIANT *ppropvar);
|
||||
HRESULT WINAPI InitPropVariantFromCLSID(REFCLSID clsid, PROPVARIANT *ppropvar);
|
||||
HRESULT WINAPI InitVariantFromBuffer(const VOID *pv, UINT cb, VARIANT *pvar);
|
||||
HRESULT WINAPI PropVariantToGUID(const PROPVARIANT *ppropvar, GUID *guid);
|
||||
HRESULT WINAPI VariantToGUID(const VARIANT *pvar, GUID *guid);
|
||||
INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2,
|
||||
PSSTDAPI InitPropVariantFromGUIDAsString(REFGUID guid, PROPVARIANT *ppropvar);
|
||||
PSSTDAPI InitVariantFromFileTime(const FILETIME *ft, VARIANT *var);
|
||||
PSSTDAPI InitVariantFromGUIDAsString(REFGUID guid, VARIANT *pvar);
|
||||
PSSTDAPI InitPropVariantFromBuffer(const VOID *pv, UINT cb, PROPVARIANT *ppropvar);
|
||||
PSSTDAPI InitPropVariantFromCLSID(REFCLSID clsid, PROPVARIANT *ppropvar);
|
||||
PSSTDAPI InitVariantFromBuffer(const VOID *pv, UINT cb, VARIANT *pvar);
|
||||
PSSTDAPI PropVariantToGUID(const PROPVARIANT *ppropvar, GUID *guid);
|
||||
PSSTDAPI VariantToGUID(const VARIANT *pvar, GUID *guid);
|
||||
PSSTDAPI_(INT) PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2,
|
||||
PROPVAR_COMPARE_UNIT uint, PROPVAR_COMPARE_FLAGS flags);
|
||||
PSSTDAPI InitPropVariantFromFileTime(const FILETIME *pftIn, PROPVARIANT *ppropvar);
|
||||
PSSTDAPI InitPropVariantFromStringVector(PCWSTR *strs, ULONG count, PROPVARIANT *ppropvar);
|
||||
|
||||
HRESULT WINAPI PropVariantToDouble(REFPROPVARIANT propvarIn, double *ret);
|
||||
HRESULT WINAPI PropVariantToInt16(REFPROPVARIANT propvarIn, SHORT *ret);
|
||||
HRESULT WINAPI PropVariantToInt32(REFPROPVARIANT propvarIn, LONG *ret);
|
||||
HRESULT WINAPI PropVariantToInt64(REFPROPVARIANT propvarIn, LONGLONG *ret);
|
||||
HRESULT WINAPI PropVariantToUInt16(REFPROPVARIANT propvarIn, USHORT *ret);
|
||||
HRESULT WINAPI PropVariantToUInt32(REFPROPVARIANT propvarIn, ULONG *ret);
|
||||
HRESULT WINAPI PropVariantToUInt64(REFPROPVARIANT propvarIn, ULONGLONG *ret);
|
||||
HRESULT WINAPI PropVariantToBoolean(REFPROPVARIANT propvarIn, BOOL *ret);
|
||||
HRESULT WINAPI PropVariantToBuffer(REFPROPVARIANT propvarIn, void *ret, UINT cb);
|
||||
HRESULT WINAPI PropVariantToString(REFPROPVARIANT propvarIn, PWSTR ret, UINT cch);
|
||||
PCWSTR WINAPI PropVariantToStringWithDefault(REFPROPVARIANT propvarIn, LPCWSTR pszDefault);
|
||||
PSSTDAPI PropVariantToDouble(REFPROPVARIANT propvarIn, double *ret);
|
||||
PSSTDAPI PropVariantToInt16(REFPROPVARIANT propvarIn, SHORT *ret);
|
||||
PSSTDAPI PropVariantToInt32(REFPROPVARIANT propvarIn, LONG *ret);
|
||||
PSSTDAPI PropVariantToInt64(REFPROPVARIANT propvarIn, LONGLONG *ret);
|
||||
PSSTDAPI PropVariantToUInt16(REFPROPVARIANT propvarIn, USHORT *ret);
|
||||
PSSTDAPI PropVariantToUInt32(REFPROPVARIANT propvarIn, ULONG *ret);
|
||||
PSSTDAPI_(ULONG) PropVariantToUInt32WithDefault(REFPROPVARIANT propvarIn, ULONG uLDefault);
|
||||
PSSTDAPI PropVariantToUInt64(REFPROPVARIANT propvarIn, ULONGLONG *ret);
|
||||
PSSTDAPI PropVariantToBoolean(REFPROPVARIANT propvarIn, BOOL *ret);
|
||||
PSSTDAPI PropVariantToBSTR(REFPROPVARIANT propvar, BSTR *bstr);
|
||||
PSSTDAPI PropVariantToBuffer(REFPROPVARIANT propvarIn, void *ret, UINT cb);
|
||||
PSSTDAPI PropVariantToString(REFPROPVARIANT propvarIn, PWSTR ret, UINT cch);
|
||||
PSSTDAPI_(PCWSTR) PropVariantToStringWithDefault(REFPROPVARIANT propvarIn, LPCWSTR pszDefault);
|
||||
PSSTDAPI_(PCWSTR) VariantToStringWithDefault(const VARIANT *pvar, LPCWSTR pszDefault);
|
||||
PSSTDAPI VariantToString(REFVARIANT var, PWSTR ret, UINT cch);
|
||||
|
||||
HRESULT WINAPI PropVariantToStringAlloc(REFPROPVARIANT propvarIn, WCHAR **ret);
|
||||
PSSTDAPI PropVariantToStringAlloc(REFPROPVARIANT propvarIn, WCHAR **ret);
|
||||
|
||||
PSSTDAPI PropVariantToVariant(const PROPVARIANT *propvar, VARIANT *var);
|
||||
PSSTDAPI VariantToPropVariant(const VARIANT* var, PROPVARIANT* propvar);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
HRESULT InitPropVariantFromBoolean(BOOL fVal, PROPVARIANT *ppropvar);
|
||||
HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar);
|
||||
HRESULT InitPropVariantFromInt16(SHORT nVal, PROPVARIANT *ppropvar);
|
||||
HRESULT InitPropVariantFromUInt16(USHORT uiVal, PROPVARIANT *ppropvar);
|
||||
HRESULT InitPropVariantFromInt32(LONG lVal, PROPVARIANT *ppropvar);
|
||||
HRESULT InitPropVariantFromUInt32(ULONG ulVal, PROPVARIANT *ppropvar);
|
||||
HRESULT InitPropVariantFromInt64(LONGLONG llVal, PROPVARIANT *ppropvar);
|
||||
HRESULT InitPropVariantFromUInt64(ULONGLONG ullVal, PROPVARIANT *ppropvar);
|
||||
HRESULT InitPropVariantFromDouble(DOUBLE dblVal, PROPVARIANT *ppropvar);
|
||||
HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar);
|
||||
HRESULT InitPropVariantFromGUIDAsBuffer(REFGUID guid, PROPVARIANT *ppropvar);
|
||||
BOOL IsPropVariantVector(REFPROPVARIANT propvar);
|
||||
BOOL IsPropVariantString(REFPROPVARIANT propvar);
|
||||
|
||||
#ifndef NO_PROPVAR_INLINES
|
||||
|
||||
|
@ -104,6 +133,55 @@ inline HRESULT InitPropVariantFromBoolean(BOOL fVal, PROPVARIANT *ppropvar)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
inline HRESULT InitPropVariantFromInt16(SHORT nVal, PROPVARIANT *ppropvar)
|
||||
{
|
||||
ppropvar->vt = VT_I2;
|
||||
ppropvar->iVal = nVal;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
inline HRESULT InitPropVariantFromUInt16(USHORT uiVal, PROPVARIANT *ppropvar)
|
||||
{
|
||||
ppropvar->vt = VT_UI2;
|
||||
ppropvar->uiVal = uiVal;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
inline HRESULT InitPropVariantFromInt32(LONG lVal, PROPVARIANT *ppropvar)
|
||||
{
|
||||
ppropvar->vt = VT_I4;
|
||||
ppropvar->lVal = lVal;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
inline HRESULT InitPropVariantFromUInt32(ULONG ulVal, PROPVARIANT *ppropvar)
|
||||
{
|
||||
ppropvar->vt = VT_UI4;
|
||||
ppropvar->ulVal = ulVal;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
inline HRESULT InitPropVariantFromInt64(LONGLONG llVal, PROPVARIANT *ppropvar)
|
||||
{
|
||||
ppropvar->vt = VT_I8;
|
||||
ppropvar->hVal.QuadPart = llVal;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
inline HRESULT InitPropVariantFromUInt64(ULONGLONG ullVal, PROPVARIANT *ppropvar)
|
||||
{
|
||||
ppropvar->vt = VT_UI8;
|
||||
ppropvar->uhVal.QuadPart = ullVal;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
inline HRESULT InitPropVariantFromDouble(DOUBLE dblVal, PROPVARIANT *ppropvar)
|
||||
{
|
||||
ppropvar->vt = VT_R8;
|
||||
ppropvar->dblVal = dblVal;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
inline HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar)
|
||||
{
|
||||
HRESULT hres;
|
||||
|
@ -117,16 +195,26 @@ inline HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar)
|
|||
return hres;
|
||||
}
|
||||
|
||||
inline HRESULT InitPropVariantFromInt64(LONGLONG llVal, PROPVARIANT *ppropvar)
|
||||
inline HRESULT InitPropVariantFromGUIDAsBuffer(REFGUID guid, PROPVARIANT *ppropvar)
|
||||
{
|
||||
ppropvar->vt = VT_I8;
|
||||
ppropvar->hVal.QuadPart = llVal;
|
||||
return S_OK;
|
||||
return InitPropVariantFromBuffer(&guid, sizeof(GUID), ppropvar);
|
||||
}
|
||||
|
||||
inline BOOL IsPropVariantVector(REFPROPVARIANT propvar)
|
||||
{
|
||||
return (propvar.vt & (VT_ARRAY | VT_VECTOR));
|
||||
}
|
||||
|
||||
inline BOOL IsPropVariantString(REFPROPVARIANT propvar)
|
||||
{
|
||||
return (PropVariantToStringWithDefault(propvar, NULL) != NULL);
|
||||
}
|
||||
|
||||
#endif /* NO_PROPVAR_INLINES */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
PSSTDAPI StgSerializePropVariant(const PROPVARIANT *ppropvar, SERIALIZEDPROPERTYVALUE **ppprop, ULONG *pcb);
|
||||
PSSTDAPI StgDeserializePropVariant(const SERIALIZEDPROPERTYVALUE *pprop, ULONG cbmax, PROPVARIANT *ppropvar);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
9
sdk/tools/winesync/propsys.cfg
Normal file
9
sdk/tools/winesync/propsys.cfg
Normal file
|
@ -0,0 +1,9 @@
|
|||
directories:
|
||||
dlls/propsys: dll/win32/propsys
|
||||
dlls/propsys/tests: modules/rostests/winetests/propsys
|
||||
files:
|
||||
include/oaidl.idl: sdk/include/psdk/oaidl.idl
|
||||
include/propsys.idl: sdk/include/psdk/propsys.idl
|
||||
include/propvarutil.h: sdk/include/psdk/propvarutil.h
|
||||
tags:
|
||||
wine: wine-10.0
|
Loading…
Add table
Add a link
Reference in a new issue