Index: wine-0.9.34/dlls/oleaut32/oleaut32.spec =================================================================== --- wine-0.9.34.orig/dlls/oleaut32/oleaut32.spec 2007-07-31 19:02:31.000000000 +0200 +++ wine-0.9.34/dlls/oleaut32/oleaut32.spec 2007-08-01 15:26:08.000000000 +0200 @@ -124,7 +124,7 @@ 125 stdcall VarBoolFromStr(wstr long long ptr) 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) +128 stdcall VarWeekdayName(long long long long ptr) 129 stdcall VarMonthName(long long long ptr) 130 stdcall VarUI1FromI2(long ptr) 131 stdcall VarUI1FromI4(long ptr) Index: wine-0.9.34/dlls/oleaut32/varformat.c =================================================================== --- wine-0.9.34.orig/dlls/oleaut32/varformat.c 2007-07-31 19:02:31.000000000 +0200 +++ wine-0.9.34/dlls/oleaut32/varformat.c 2007-08-01 15:26:09.000000000 +0200 @@ -2498,3 +2498,69 @@ } return S_OK; } + +/********************************************************************** + * VarWeekdayName [OLEAUT32.129] + * + * Print the specified month as localized name. + * + * PARAMS + * iWeekday [I] day of week, 1..7, 0=system default? + * fAbbrev [I] 0 - full name, !0 - abbreviated name + * iFirstDay [I] first day of week, 1..7, 0=system default? + * 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 VarWeekdayName(INT iWeekday, INT fAbbrev, INT iFirstDay, ULONG dwFlags, BSTR *pbstrOut) +{ + DWORD localeValue; + INT size; + + /* Windows XP oleaut32.dll doesn't allow iWekday==0, although MSDN says something different */ + if ((iWeekday < 1) || (iWeekday > 7)) + return E_INVALIDARG; + if ((iFirstDay < 0) || (iFirstDay > 7)) + return E_INVALIDARG; + if (!pbstrOut) + return E_INVALIDARG; + + if (dwFlags) + FIXME("Does not support dwFlags 0x%x, ignoring.\n", dwFlags); + + if (iFirstDay==0) + { + DWORD firstDay; + size = GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_RETURN_NUMBER | LOCALE_IFIRSTDAYOFWEEK, + (LPWSTR)&firstDay, sizeof(firstDay)/sizeof(WCHAR)); + if (iFirstDay==0) + iFirstDay = firstDay + 2; + } + + if (fAbbrev) + localeValue = LOCALE_SABBREVDAYNAME1 + (iWeekday + iFirstDay + 4)%7; + else + localeValue = LOCALE_SDAYNAME1 + (iWeekday + iFirstDay + 4)%7; + + size = GetLocaleInfoW(LOCALE_USER_DEFAULT,localeValue, NULL, 0); + if (!size) + { + ERR("GetLocaleInfo 0x%x failed.\n", localeValue); + return HRESULT_FROM_WIN32(GetLastError()); + } + *pbstrOut = SysAllocStringLen(NULL,size - 1); + if (!*pbstrOut) + return E_OUTOFMEMORY; + size = GetLocaleInfoW(LOCALE_USER_DEFAULT,localeValue, *pbstrOut, size); + if (!size) + { + ERR("GetLocaleInfo of 0x%x failed in 2nd stage?!\n", localeValue); + SysFreeString(*pbstrOut); + return HRESULT_FROM_WIN32(GetLastError()); + } + return S_OK; +}