Release 1.3.7.
[wine/gsoc-2012-control.git] / dlls / propsys / propvar.c
blobcdfb89fa76897112f2bc8741eeca46e650341f0e
1 /*
2 * PropVariant implementation
4 * Copyright 2008 James Hawkins for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
22 #include <stdio.h>
24 #define NONAMELESSUNION
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winerror.h"
29 #include "winreg.h"
30 #include "winuser.h"
31 #include "shlobj.h"
32 #include "propvarutil.h"
34 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(propsys);
38 static HRESULT PROPVAR_ConvertFILETIME(PROPVARIANT *ppropvarDest,
39 REFPROPVARIANT propvarSrc, VARTYPE vt)
41 SYSTEMTIME time;
43 FileTimeToSystemTime(&propvarSrc->u.filetime, &time);
45 switch (vt)
47 case VT_LPSTR:
49 static const char format[] = "%04d/%02d/%02d:%02d:%02d:%02d.%03d";
51 ppropvarDest->u.pszVal = HeapAlloc(GetProcessHeap(), 0,
52 lstrlenA(format) + 1);
53 if (!ppropvarDest->u.pszVal)
54 return E_OUTOFMEMORY;
56 sprintf(ppropvarDest->u.pszVal, format, time.wYear, time.wMonth,
57 time.wDay, time.wHour, time.wMinute,
58 time.wSecond, time.wMilliseconds);
60 return S_OK;
63 default:
64 FIXME("Unhandled target type: %d\n", vt);
67 return E_FAIL;
70 /******************************************************************
71 * PropVariantChangeType (PROPSYS.@)
73 HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT propvarSrc,
74 PROPVAR_CHANGE_FLAGS flags, VARTYPE vt)
76 FIXME("(%p, %p, %d, %d, %d): semi-stub!\n", ppropvarDest, propvarSrc,
77 propvarSrc->vt, flags, vt);
79 switch (propvarSrc->vt)
81 case VT_FILETIME:
82 return PROPVAR_ConvertFILETIME(ppropvarDest, propvarSrc, vt);
83 default:
84 FIXME("Unhandled source type: %d\n", propvarSrc->vt);
87 return E_FAIL;