PATCH: VarMonthName

Marcus Meissner marcus at jet.franken.de
Sun May 29 10:30:00 CDT 2005


Hi,

This implements VarMonthName().

Tested with program in http://bugs.winehq.org/show_bug.cgi?id=2869

Ciao, Marcus

Changelog:
	Added VarMonthName() implementation.

Index: dlls/oleaut32/oleaut32.spec
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/oleaut32.spec,v
retrieving revision 1.73
diff -u -r1.73 oleaut32.spec
--- dlls/oleaut32/oleaut32.spec	13 Apr 2005 10:59:25 -0000	1.73
+++ dlls/oleaut32/oleaut32.spec	29 May 2005 15:28:51 -0000
@@ -126,7 +126,7 @@
 126 stdcall VarBoolFromDisp(ptr long ptr)
 127 stdcall VarFormatCurrency(ptr long long long long long ptr)
 128 stub VarWeekdayName # stdcall (long long long long ptr)
-129 stub VarMonthName # stdcall (long long long ptr)
+129 stdcall VarMonthName(long long long ptr)
 130 stdcall VarUI1FromI2(long ptr)
 131 stdcall VarUI1FromI4(long ptr)
 132 stdcall VarUI1FromR4(long ptr)
Index: dlls/oleaut32/varformat.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/varformat.c,v
retrieving revision 1.9
diff -u -r1.9 varformat.c
--- dlls/oleaut32/varformat.c	2 Mar 2005 13:53:51 -0000	1.9
+++ dlls/oleaut32/varformat.c	29 May 2005 15:28:52 -0000
@@ -2405,3 +2405,57 @@
   }
   return hRet;
 }
+
+/**********************************************************************
+ *              VarMonthName [OLEAUT32.129]
+ *
+ * Print the specified month as localized name.
+ *
+ * PARAMS
+ *  iMonth    [I] month number 1..12
+ *  fAbbrev   [I] 0 - full name, !0 - abbreviated name
+ *  dwFlags   [I] flag stuff. only VAR_CALENDAR_HIJRI possible.
+ *  pbstrOut  [O] Destination for month name
+ *
+ * RETURNS
+ *  Success: S_OK. pbstrOut contains the name.
+ *  Failure: E_INVALIDARG, if any parameter is invalid.
+ *           E_OUTOFMEMORY, if enough memory cannot be allocated.
+ */
+HRESULT WINAPI VarMonthName(INT iMonth, INT fAbbrev, ULONG dwFlags, BSTR *pbstrOut)
+{
+  DWORD localeValue;
+  INT size;
+  WCHAR *str;
+
+  if ((iMonth < 1)  || (iMonth > 12))
+    return E_INVALIDARG;
+
+  if (dwFlags)
+    FIXME("Does not support dwFlags 0x%lx, ignoring.\n", dwFlags);
+
+  if (fAbbrev)
+	localeValue = LOCALE_SABBREVMONTHNAME1 + iMonth - 1;
+  else
+	localeValue = LOCALE_SMONTHNAME1 + iMonth - 1;
+
+  size = GetLocaleInfoW(LOCALE_USER_DEFAULT,localeValue, NULL, 0);
+  if (!size) {
+    FIXME("GetLocaleInfo 0x%lx failed.\n", localeValue);
+    return E_INVALIDARG;
+  }
+  str = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*size);
+  if (!str)
+    return E_OUTOFMEMORY;
+  size = GetLocaleInfoW(LOCALE_USER_DEFAULT,localeValue, str, size);
+  if (!size) {
+    FIXME("GetLocaleInfo of 0x%lx failed in 2nd stage?!\n", localeValue);
+    HeapFree(GetProcessHeap(),0,str);
+    return E_INVALIDARG;
+  }
+  *pbstrOut = SysAllocString(str);
+  HeapFree(GetProcessHeap(),0,str);
+  if (!*pbstrOut)
+    return E_OUTOFMEMORY;
+  return S_OK;
+}



More information about the wine-patches mailing list