mirror of
https://github.com/reactos/wine.git
synced 2024-11-28 06:00:45 +00:00
propsys: Implement PSStringFromPropertyKey.
This commit is contained in:
parent
7114094472
commit
c50177b1c1
2
configure
vendored
2
configure
vendored
@ -14664,7 +14664,7 @@ wine_fn_config_test dlls/pdh/tests pdh_test
|
||||
wine_fn_config_dll pidgen enable_pidgen
|
||||
wine_fn_config_dll powrprof enable_powrprof powrprof
|
||||
wine_fn_config_dll printui enable_printui
|
||||
wine_fn_config_dll propsys enable_propsys
|
||||
wine_fn_config_dll propsys enable_propsys propsys
|
||||
wine_fn_config_dll psapi enable_psapi psapi
|
||||
wine_fn_config_test dlls/psapi/tests psapi_test
|
||||
wine_fn_config_dll pstorec enable_pstorec
|
||||
|
@ -2533,7 +2533,7 @@ WINE_CONFIG_TEST(dlls/pdh/tests)
|
||||
WINE_CONFIG_DLL(pidgen)
|
||||
WINE_CONFIG_DLL(powrprof,,[powrprof])
|
||||
WINE_CONFIG_DLL(printui)
|
||||
WINE_CONFIG_DLL(propsys)
|
||||
WINE_CONFIG_DLL(propsys,,[propsys])
|
||||
WINE_CONFIG_DLL(psapi,,[psapi])
|
||||
WINE_CONFIG_TEST(dlls/psapi/tests)
|
||||
WINE_CONFIG_DLL(pstorec)
|
||||
|
@ -3,6 +3,7 @@ TOPOBJDIR = ../..
|
||||
SRCDIR = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
MODULE = propsys.dll
|
||||
IMPORTLIB = propsys
|
||||
|
||||
C_SRCS = \
|
||||
propsys_main.c \
|
||||
|
@ -91,7 +91,7 @@
|
||||
@ stub PSRefreshPropertySchema
|
||||
@ stdcall PSRegisterPropertySchema(wstr)
|
||||
@ stub PSSetPropertyValue
|
||||
@ stub PSStringFromPropertyKey
|
||||
@ stdcall PSStringFromPropertyKey(ptr ptr long)
|
||||
@ stdcall PSUnregisterPropertySchema(wstr)
|
||||
@ stdcall PropVariantChangeType(ptr ptr long long)
|
||||
@ stub PropVariantCompareEx
|
||||
|
@ -24,7 +24,10 @@
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "objbase.h"
|
||||
#include "propsys.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(propsys);
|
||||
|
||||
@ -61,3 +64,69 @@ HRESULT WINAPI PSUnregisterPropertySchema(PCWSTR path)
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
TRACE("(%p, %p, %u)\n", pkey, psz, cch);
|
||||
|
||||
if (!psz)
|
||||
return E_POINTER;
|
||||
|
||||
/* GUIDSTRING_MAX accounts for null terminator, +1 for space character. */
|
||||
if (cch <= GUIDSTRING_MAX + 1)
|
||||
return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
|
||||
|
||||
if (!pkey)
|
||||
{
|
||||
psz[0] = '\0';
|
||||
return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
|
||||
}
|
||||
|
||||
sprintfW(psz, guid_fmtW, 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]);
|
||||
|
||||
/* Overwrite the null terminator with the space character. */
|
||||
p += GUIDSTRING_MAX - 1;
|
||||
*p++ = ' ';
|
||||
cch -= GUIDSTRING_MAX - 1 + 1;
|
||||
|
||||
len = sprintfW(pidW, pid_fmtW, pkey->pid);
|
||||
|
||||
if (cch >= len + 1)
|
||||
{
|
||||
strcpyW(p, pidW);
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
WCHAR *ptr = pidW + len - 1;
|
||||
|
||||
psz[0] = '\0';
|
||||
*p++ = '\0';
|
||||
cch--;
|
||||
|
||||
/* Replicate a quirk of the native implementation where the contents
|
||||
* of the property ID string are written backwards to the output
|
||||
* buffer, skipping the rightmost digit. */
|
||||
if (cch)
|
||||
{
|
||||
ptr--;
|
||||
while (cch--)
|
||||
*p++ = *ptr--;
|
||||
}
|
||||
|
||||
return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
|
||||
}
|
||||
}
|
||||
|
@ -795,6 +795,12 @@ interface ICreateObject : IUnknown
|
||||
);
|
||||
}
|
||||
|
||||
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 PSStringFromPropertyKey(REFPROPERTYKEY,LPWSTR,UINT);")
|
||||
|
||||
/* TODO: Add remainder of the C api here */
|
||||
|
||||
[
|
||||
|
Loading…
Reference in New Issue
Block a user