Module: wine
Branch: master
Commit: 47120f500300e377cd7d86a897e6f9787733d87a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=47120f500300e377cd7d86a89…
Author: James Hawkins <jhawkins(a)codeweavers.com>
Date: Wed Feb 27 02:38:14 2008 -0600
propsys: Add an initial implementation of PropVariantChangeType.
---
dlls/propsys/Makefile.in | 3 +-
dlls/propsys/propsys.spec | 2 +-
dlls/propsys/propvar.c | 88 +++++++++++++++++++++++++++++++++++++++++++++
include/Makefile.in | 1 +
include/propidl.idl | 2 +
include/propvarutil.h | 41 +++++++++++++++++++++
6 files changed, 135 insertions(+), 2 deletions(-)
diff --git a/dlls/propsys/Makefile.in b/dlls/propsys/Makefile.in
index dd630b2..1563741 100644
--- a/dlls/propsys/Makefile.in
+++ b/dlls/propsys/Makefile.in
@@ -6,7 +6,8 @@ MODULE = propsys.dll
IMPORTS = kernel32
C_SRCS = \
- propsys_main.c
+ propsys_main.c \
+ propvar.c
@MAKE_DLL_RULES@
diff --git a/dlls/propsys/propsys.spec b/dlls/propsys/propsys.spec
index 8de5e4b..a2ae522 100644
--- a/dlls/propsys/propsys.spec
+++ b/dlls/propsys/propsys.spec
@@ -93,7 +93,7 @@
@ stub PSSetPropertyValue
@ stub PSStringFromPropertyKey
@ stub PSUnregisterPropertySchema
-@ stub PropVariantChangeType
+@ stdcall PropVariantChangeType(ptr ptr long long)
@ stub PropVariantCompareEx
@ stub PropVariantGetBooleanElem
@ stub PropVariantGetDoubleElem
diff --git a/dlls/propsys/propvar.c b/dlls/propsys/propvar.c
new file mode 100644
index 0000000..cdfb89f
--- /dev/null
+++ b/dlls/propsys/propvar.c
@@ -0,0 +1,88 @@
+/*
+ * PropVariant implementation
+ *
+ * Copyright 2008 James Hawkins for CodeWeavers
+ *
+ * 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
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+
+#define NONAMELESSUNION
+
+#include "windef.h"
+#include "winbase.h"
+#include "winerror.h"
+#include "winreg.h"
+#include "winuser.h"
+#include "shlobj.h"
+#include "propvarutil.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(propsys);
+
+static HRESULT PROPVAR_ConvertFILETIME(PROPVARIANT *ppropvarDest,
+ REFPROPVARIANT propvarSrc, VARTYPE vt)
+{
+ SYSTEMTIME time;
+
+ FileTimeToSystemTime(&propvarSrc->u.filetime, &time);
+
+ switch (vt)
+ {
+ case VT_LPSTR:
+ {
+ static const char format[] = "%04d/%02d/%02d:%02d:%02d:%02d.%03d";
+
+ ppropvarDest->u.pszVal = HeapAlloc(GetProcessHeap(), 0,
+ lstrlenA(format) + 1);
+ if (!ppropvarDest->u.pszVal)
+ return E_OUTOFMEMORY;
+
+ sprintf(ppropvarDest->u.pszVal, format, time.wYear, time.wMonth,
+ time.wDay, time.wHour, time.wMinute,
+ time.wSecond, time.wMilliseconds);
+
+ return S_OK;
+ }
+
+ default:
+ FIXME("Unhandled target type: %d\n", vt);
+ }
+
+ return E_FAIL;
+}
+
+/******************************************************************
+ * PropVariantChangeType (PROPSYS.@)
+ */
+HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT propvarSrc,
+ PROPVAR_CHANGE_FLAGS flags, VARTYPE vt)
+{
+ FIXME("(%p, %p, %d, %d, %d): semi-stub!\n", ppropvarDest, propvarSrc,
+ propvarSrc->vt, flags, vt);
+
+ switch (propvarSrc->vt)
+ {
+ case VT_FILETIME:
+ return PROPVAR_ConvertFILETIME(ppropvarDest, propvarSrc, vt);
+ default:
+ FIXME("Unhandled source type: %d\n", propvarSrc->vt);
+ }
+
+ return E_FAIL;
+}
diff --git a/include/Makefile.in b/include/Makefile.in
index 1acd285..73d1cb0 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -326,6 +326,7 @@ SRCDIR_INCLUDES = \
poppack.h \
powrprof.h \
profinfo.h \
+ propvarutil.h \
prsht.h \
psapi.h \
pshpack1.h \
diff --git a/include/propidl.idl b/include/propidl.idl
index a0d83be..6720988 100644
--- a/include/propidl.idl
+++ b/include/propidl.idl
@@ -206,6 +206,8 @@ interface IPropertyStorage : IUnknown
typedef struct tagPROPVARIANT *LPPROPVARIANT;
+ cpp_quote("#define REFPROPVARIANT const PROPVARIANT *")
+
cpp_quote("#define PIDDI_THUMBNAIL 0x00000002L /* VT_BLOB */")
cpp_quote("")
cpp_quote("#define PIDSI_TITLE 0x00000002L /* VT_LPSTR */")
diff --git a/include/propvarutil.h b/include/propvarutil.h
new file mode 100644
index 0000000..2573d38
--- /dev/null
+++ b/include/propvarutil.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2008 James Hawkins for CodeWeavers
+ *
+ * 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
+ */
+
+#ifndef __WINE_PROPVARUTIL_H
+#define __WINE_PROPVARUTIL_H
+
+#include <propidl.h>
+#include <shtypes.h>
+#include <shlwapi.h>
+
+enum tagPROPVAR_CHANGE_FLAGS
+{
+ PVCHF_DEFAULT = 0x00000000,
+ PVCHF_NOVALUEPROP = 0x00000001,
+ PVCHF_ALPHABOOL = 0x00000002,
+ PVCHF_NOUSEROVERRIDE = 0x00000004,
+ PVCHF_LOCALBOOL = 0x00000008,
+ PVCHF_NOHEXSTRING = 0x00000010,
+};
+
+typedef int PROPVAR_CHANGE_FLAGS;
+
+HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT propvarSrc,
+ PROPVAR_CHANGE_FLAGS flags, VARTYPE vt);
+
+#endif /* __WINE_PROPVARUTIL_H */