[OLEAUT32] Sync with Wine Staging 2.9. CORE-13362
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 3 Jun 2017 22:34:09 +0000 (22:34 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 3 Jun 2017 22:34:09 +0000 (22:34 +0000)
6e7179e oleaut32: Make OleLoadPicture load DIBs using WIC decoder.
1762f89 oleaut32: Use VariantChangeTypeEx to convert to VT_BOOL.
c260de0 oleaut32: Remove dead code.
efc86ec oleaut32: Fix parse error when converting non-ascii string to VT_DATE.
f506ffc oleaut32: Use VariantInit() rather than open coding it.
c082edb oleaut32: Remove redundant call to VariantClear().
7fb4809 oleaut32: Implement GetAltMonthNames().
d90fcb4 oleaut32: Fix OleLoadPictureEx spec file entry.

svn path=/trunk/; revision=74831

reactos/dll/win32/oleaut32/oleaut.c
reactos/dll/win32/oleaut32/oleaut32.spec
reactos/dll/win32/oleaut32/olepicture.c
reactos/dll/win32/oleaut32/variant.c
reactos/dll/win32/oleaut32/vartype.c
reactos/media/doc/README.WINE

index a70da6f..349a64d 100644 (file)
@@ -918,3 +918,112 @@ HCURSOR WINAPI OleIconToCursor( HINSTANCE hinstExe, HICON hIcon)
     /* FIXME: make an extended conversation from HICON to HCURSOR */
     return CopyCursor(hIcon);
 }
+
+/***********************************************************************
+ *              GetAltMonthNames (OLEAUT32.@)
+ */
+HRESULT WINAPI GetAltMonthNames(LCID lcid, LPOLESTR **str)
+{
+    static const WCHAR ar_month1W[] = {0x645,0x62d,0x631,0x645,0};
+    static const WCHAR ar_month2W[] = {0x635,0x641,0x631,0};
+    static const WCHAR ar_month3W[] = {0x631,0x628,0x64a,0x639,' ',0x627,0x644,0x627,0x648,0x644,0};
+    static const WCHAR ar_month4W[] = {0x631,0x628,0x64a,0x639,' ',0x627,0x644,0x62b,0x627,0x646,0x64a,0};
+    static const WCHAR ar_month5W[] = {0x62c,0x645,0x627,0x62f,0x649,' ',0x627,0x644,0x627,0x648,0x644,0x649,0};
+    static const WCHAR ar_month6W[] = {0x62c,0x645,0x627,0x62f,0x649,' ',0x627,0x644,0x62b,0x627,0x646,0x64a,0x629,0};
+    static const WCHAR ar_month7W[] = {0x631,0x62c,0x628,0};
+    static const WCHAR ar_month8W[] = {0x634,0x639,0x628,0x627,0x646,0};
+    static const WCHAR ar_month9W[] = {0x631,0x645,0x636,0x627,0x646,0};
+    static const WCHAR ar_month10W[] = {0x634,0x648,0x627,0x643,0};
+    static const WCHAR ar_month11W[] = {0x630,0x648,' ',0x627,0x644,0x642,0x639,0x62f,0x629,0};
+    static const WCHAR ar_month12W[] = {0x630,0x648,' ',0x627,0x644,0x62d,0x62c,0x629,0};
+
+    static const WCHAR *arabic_hijri[] =
+    {
+        ar_month1W,
+        ar_month2W,
+        ar_month3W,
+        ar_month4W,
+        ar_month5W,
+        ar_month6W,
+        ar_month7W,
+        ar_month8W,
+        ar_month9W,
+        ar_month10W,
+        ar_month11W,
+        ar_month12W,
+        NULL
+    };
+
+    static const WCHAR pl_month1W[] = {'s','t','y','c','z','n','i','a',0};
+    static const WCHAR pl_month2W[] = {'l','u','t','e','g','o',0};
+    static const WCHAR pl_month3W[] = {'m','a','r','c','a',0};
+    static const WCHAR pl_month4W[] = {'k','w','i','e','t','n','i','a',0};
+    static const WCHAR pl_month5W[] = {'m','a','j','a',0};
+    static const WCHAR pl_month6W[] = {'c','z','e','r','w','c','a',0};
+    static const WCHAR pl_month7W[] = {'l','i','p','c','a',0};
+    static const WCHAR pl_month8W[] = {'s','i','e','r','p','n','i','a',0};
+    static const WCHAR pl_month9W[] = {'w','r','z','e',0x15b,'n','i','a',0};
+    static const WCHAR pl_month10W[] = {'p','a',0x17a,'d','z','i','e','r','n','i','k','a',0};
+    static const WCHAR pl_month11W[] = {'l','i','s','t','o','p','a','d','a',0};
+    static const WCHAR pl_month12W[] = {'g','r','u','d','n','i','a',0};
+
+    static const WCHAR *polish_genitive_names[] =
+    {
+        pl_month1W,
+        pl_month2W,
+        pl_month3W,
+        pl_month4W,
+        pl_month5W,
+        pl_month6W,
+        pl_month7W,
+        pl_month8W,
+        pl_month9W,
+        pl_month10W,
+        pl_month11W,
+        pl_month12W,
+        NULL
+    };
+
+    static const WCHAR ru_month1W[] = {0x44f,0x43d,0x432,0x430,0x440,0x44f,0};
+    static const WCHAR ru_month2W[] = {0x444,0x435,0x432,0x440,0x430,0x43b,0x44f,0};
+    static const WCHAR ru_month3W[] = {0x43c,0x430,0x440,0x442,0x430,0};
+    static const WCHAR ru_month4W[] = {0x430,0x43f,0x440,0x435,0x43b,0x44f,0};
+    static const WCHAR ru_month5W[] = {0x43c,0x430,0x44f,0};
+    static const WCHAR ru_month6W[] = {0x438,0x44e,0x43d,0x44f,0};
+    static const WCHAR ru_month7W[] = {0x438,0x44e,0x43b,0x44f,0};
+    static const WCHAR ru_month8W[] = {0x430,0x432,0x433,0x443,0x441,0x442,0x430,0};
+    static const WCHAR ru_month9W[] = {0x441,0x435,0x43d,0x442,0x44f,0x431,0x440,0x44f,0};
+    static const WCHAR ru_month10W[] = {0x43e,0x43a,0x442,0x44f,0x431,0x440,0x44f,0};
+    static const WCHAR ru_month11W[] = {0x43d,0x43e,0x44f,0x431,0x440,0x44f,0};
+    static const WCHAR ru_month12W[] = {0x434,0x435,0x43a,0x430,0x431,0x440,0x44f,0};
+
+    static const WCHAR *russian_genitive_names[] =
+    {
+        ru_month1W,
+        ru_month2W,
+        ru_month3W,
+        ru_month4W,
+        ru_month5W,
+        ru_month6W,
+        ru_month7W,
+        ru_month8W,
+        ru_month9W,
+        ru_month10W,
+        ru_month11W,
+        ru_month12W,
+        NULL
+    };
+
+    TRACE("%#x, %p\n", lcid, str);
+
+    if (PRIMARYLANGID(LANGIDFROMLCID(lcid)) == LANG_ARABIC)
+        *str = (LPOLESTR *)arabic_hijri;
+    else if (PRIMARYLANGID(LANGIDFROMLCID(lcid)) == LANG_POLISH)
+        *str = (LPOLESTR *)polish_genitive_names;
+    else if (PRIMARYLANGID(LANGIDFROMLCID(lcid)) == LANG_RUSSIAN)
+        *str = (LPOLESTR *)russian_genitive_names;
+    else
+        *str = NULL;
+
+    return S_OK;
+}
index 1f938b2..06ef3d3 100644 (file)
 329 stdcall VarCyMulI8(int64 int64 ptr)
 330 stdcall VarDateFromUdate(ptr long ptr)
 331 stdcall VarUdateFromDate(double long ptr)
-332 stub GetAltMonthNames
+332 stdcall GetAltMonthNames(long ptr)
 333 stdcall VarI8FromUI1(long long)
 334 stdcall VarI8FromI2(long long)
 335 stdcall VarI8FromR4(float long)
 377 stdcall VarI1FromUI8(int64 ptr)
 378 stdcall VarUI2FromI8(int64 ptr)
 379 stdcall VarUI2FromUI8(int64 ptr)
-401 stdcall OleLoadPictureEx(ptr long long long long long long ptr)
+401 stdcall OleLoadPictureEx(ptr long long ptr long long long ptr)
 402 stub OleLoadPictureFileEx
 411 stdcall SafeArrayCreateVector(long long long)
 412 stdcall SafeArrayCopyData(ptr ptr)
index 02b485e..878fd18 100644 (file)
@@ -978,25 +978,6 @@ static HRESULT WINAPI OLEPictureImpl_IsDirty(
   return E_NOTIMPL;
 }
 
-static HRESULT OLEPictureImpl_LoadDIB(OLEPictureImpl *This, BYTE *xbuf, ULONG xread)
-{
-    BITMAPFILEHEADER   *bfh = (BITMAPFILEHEADER*)xbuf;
-    BITMAPINFO         *bi = (BITMAPINFO*)(bfh+1);
-    void *bits;
-    BITMAP bmp;
-
-    This->desc.u.bmp.hbitmap = CreateDIBSection(0, bi, DIB_RGB_COLORS, &bits, NULL, 0);
-    if (This->desc.u.bmp.hbitmap == 0)
-        return E_FAIL;
-
-    GetObjectA(This->desc.u.bmp.hbitmap, sizeof(bmp), &bmp);
-    memcpy(bits, xbuf + bfh->bfOffBits, bmp.bmHeight * bmp.bmWidthBytes);
-
-    This->desc.picType = PICTYPE_BITMAP;
-    OLEPictureImpl_SetBitmap(This);
-    return S_OK;
-}
-
 static HRESULT OLEPictureImpl_LoadWICSource(OLEPictureImpl *This, IWICBitmapSource *src)
 {
     HRESULT hr;
@@ -1477,7 +1458,7 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface, IStream *pStm)
     hr = OLEPictureImpl_LoadWICDecoder(This, &CLSID_WICJpegDecoder, xbuf, xread);
     break;
   case BITMAP_FORMAT_BMP: /* Bitmap */
-    hr = OLEPictureImpl_LoadDIB(This, xbuf, xread);
+    hr = OLEPictureImpl_LoadWICDecoder(This, &CLSID_WICBmpDecoder, xbuf, xread);
     break;
   case BITMAP_FORMAT_PNG: /* PNG */
     hr = OLEPictureImpl_LoadWICDecoder(This, &CLSID_WICPngDecoder, xbuf, xread);
index f49684a..1423d25 100644 (file)
@@ -2487,19 +2487,12 @@ HRESULT WINAPI VarCat(LPVARIANT left, LPVARIANT right, LPVARIANT out)
 {
     VARTYPE leftvt,rightvt,resultvt;
     HRESULT hres;
-    static WCHAR str_true[32];
-    static WCHAR str_false[32];
     static const WCHAR sz_empty[] = {'\0'};
     leftvt = V_VT(left);
     rightvt = V_VT(right);
 
     TRACE("%s,%s,%p)\n", debugstr_variant(left), debugstr_variant(right), out);
 
-    if (!str_true[0]) {
-        VARIANT_GetLocalisedText(LOCALE_USER_DEFAULT, IDS_FALSE, str_false);
-        VARIANT_GetLocalisedText(LOCALE_USER_DEFAULT, IDS_TRUE, str_true);
-    }
-
     /* when both left and right are NULL the result is NULL */
     if (leftvt == VT_NULL && rightvt == VT_NULL)
     {
@@ -2580,38 +2573,18 @@ HRESULT WINAPI VarCat(LPVARIANT left, LPVARIANT right, LPVARIANT out)
         /* Convert left side variant to string */
         if (leftvt != VT_BSTR)
         {
-            if (leftvt == VT_BOOL)
-            {
-                /* Bools are handled as localized True/False strings instead of 0/-1 as in MSDN */
-                V_VT(&bstrvar_left) = VT_BSTR;
-                if (V_BOOL(left))
-                    V_BSTR(&bstrvar_left) = SysAllocString(str_true);
-                else
-                    V_BSTR(&bstrvar_left) = SysAllocString(str_false);
-            }
             /* Fill with empty string for later concat with right side */
-            else if (leftvt == VT_NULL)
+            if (leftvt == VT_NULL)
             {
                 V_VT(&bstrvar_left) = VT_BSTR;
                 V_BSTR(&bstrvar_left) = SysAllocString(sz_empty);
             }
             else
             {
-                hres = VariantChangeTypeEx(&bstrvar_left,left,0,0,VT_BSTR);
+                hres = VariantChangeTypeEx(&bstrvar_left,left,0,VARIANT_ALPHABOOL|VARIANT_LOCALBOOL,VT_BSTR);
                 if (hres != S_OK) {
                     VariantClear(&bstrvar_left);
                     VariantClear(&bstrvar_right);
-                    if (leftvt == VT_NULL && (rightvt == VT_EMPTY ||
-                        rightvt == VT_NULL || rightvt ==  VT_I2 ||
-                        rightvt == VT_I4 || rightvt == VT_R4 ||
-                        rightvt == VT_R8 || rightvt == VT_CY ||
-                        rightvt == VT_DATE || rightvt == VT_BSTR ||
-                        rightvt == VT_BOOL ||  rightvt == VT_DECIMAL ||
-                        rightvt == VT_I1 || rightvt == VT_UI1 ||
-                        rightvt == VT_UI2 || rightvt == VT_UI4 ||
-                        rightvt == VT_I8 || rightvt == VT_UI8 ||
-                        rightvt == VT_INT || rightvt == VT_UINT))
-                        return DISP_E_BADVARTYPE;
                     return hres;
                 }
             }
@@ -2620,38 +2593,18 @@ HRESULT WINAPI VarCat(LPVARIANT left, LPVARIANT right, LPVARIANT out)
         /* convert right side variant to string */
         if (rightvt != VT_BSTR)
         {
-            if (rightvt == VT_BOOL)
-            {
-                /* Bools are handled as localized True/False strings instead of 0/-1 as in MSDN */
-                V_VT(&bstrvar_right) = VT_BSTR;
-                if (V_BOOL(right))
-                    V_BSTR(&bstrvar_right) = SysAllocString(str_true);
-                else
-                    V_BSTR(&bstrvar_right) = SysAllocString(str_false);
-            }
             /* Fill with empty string for later concat with right side */
-            else if (rightvt == VT_NULL)
+            if (rightvt == VT_NULL)
             {
                 V_VT(&bstrvar_right) = VT_BSTR;
                 V_BSTR(&bstrvar_right) = SysAllocString(sz_empty);
             }
             else
             {
-                hres = VariantChangeTypeEx(&bstrvar_right,right,0,0,VT_BSTR);
+                hres = VariantChangeTypeEx(&bstrvar_right,right,0,VARIANT_ALPHABOOL|VARIANT_LOCALBOOL,VT_BSTR);
                 if (hres != S_OK) {
                     VariantClear(&bstrvar_left);
                     VariantClear(&bstrvar_right);
-                    if (rightvt == VT_NULL && (leftvt == VT_EMPTY ||
-                        leftvt == VT_NULL || leftvt ==  VT_I2 ||
-                        leftvt == VT_I4 || leftvt == VT_R4 ||
-                        leftvt == VT_R8 || leftvt == VT_CY ||
-                        leftvt == VT_DATE || leftvt == VT_BSTR ||
-                        leftvt == VT_BOOL ||  leftvt == VT_DECIMAL ||
-                        leftvt == VT_I1 || leftvt == VT_UI1 ||
-                        leftvt == VT_UI2 || leftvt == VT_UI4 ||
-                        leftvt == VT_I8 || leftvt == VT_UI8 ||
-                        leftvt == VT_INT || leftvt == VT_UINT))
-                        return DISP_E_BADVARTYPE;
                     return hres;
                 }
             }
index eca9453..3b7ef40 100644 (file)
@@ -119,15 +119,12 @@ static HRESULT VARIANT_FromDisp(IDispatch* pdispIn, LCID lcid, void* pOut,
   if (SUCCEEDED(hRet))
   {
     /* Convert the property to the requested type */
-    V_VT(&dstVar) = VT_EMPTY;
+    VariantInit(&dstVar);
     hRet = VariantChangeTypeEx(&dstVar, &srcVar, lcid, dwFlags, vt);
     VariantClear(&srcVar);
 
     if (SUCCEEDED(hRet))
-    {
       VARIANT_CopyData(&dstVar, vt, pOut);
-      VariantClear(&srcVar);
-    }
   }
   else
     hRet = DISP_E_TYPEMISMATCH;
@@ -7669,7 +7666,7 @@ HRESULT WINAPI VarDateFromStr(OLECHAR* strIn, LCID lcid, ULONG dwFlags, DATE* pd
       dp.dwCount++;
       strIn--;
     }
-    else if (isalpha(*strIn))
+    else if (isalphaW(*strIn))
     {
       BOOL bFound = FALSE;
 
index 89ae05a..226b4ef 100644 (file)
@@ -141,7 +141,7 @@ reactos/dll/win32/odbc32              # Synced to WineStaging-2.9. Depends on po
 reactos/dll/win32/odbccp32            # Synced to WineStaging-2.9
 reactos/dll/win32/ole32               # Synced to WineStaging-2.9
 reactos/dll/win32/oleacc              # Synced to WineStaging-1.9.11
-reactos/dll/win32/oleaut32            # Synced to WineStaging-2.2
+reactos/dll/win32/oleaut32            # Synced to WineStaging-2.9
 reactos/dll/win32/olecli32            # Synced to WineStaging-1.9.11
 reactos/dll/win32/oledlg              # Synced to WineStaging-1.9.23
 reactos/dll/win32/olepro32            # Synced to WineStaging-1.9.11