sync oleaut32 to wine 1.1.4
authorChristoph von Wittich <christoph_vw@reactos.org>
Sun, 14 Sep 2008 05:15:39 +0000 (05:15 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Sun, 14 Sep 2008 05:15:39 +0000 (05:15 +0000)
svn path=/trunk/; revision=36210

16 files changed:
reactos/dll/win32/oleaut32/hash.c
reactos/dll/win32/oleaut32/oleaut.c
reactos/dll/win32/oleaut32/oleaut32.rbuild
reactos/dll/win32/oleaut32/oleaut32.rc
reactos/dll/win32/oleaut32/oleaut32_Zh.rc [new file with mode: 0644]
reactos/dll/win32/oleaut32/oleaut32_ocidl.idl [new file with mode: 0644]
reactos/dll/win32/oleaut32/olepicture.c
reactos/dll/win32/oleaut32/safearray.c
reactos/dll/win32/oleaut32/typelib.c
reactos/dll/win32/oleaut32/typelib.spec
reactos/dll/win32/oleaut32/typelib2.c
reactos/dll/win32/oleaut32/usrmarshal.c
reactos/dll/win32/oleaut32/varformat.c
reactos/dll/win32/oleaut32/variant.c
reactos/dll/win32/oleaut32/vartype.c
reactos/dll/win32/oleaut32/version.rc

index b3929f3..32c1086 100644 (file)
@@ -486,6 +486,7 @@ static const unsigned char Lookup_224[128 * 3] = {
 
 /***********************************************************************
  *             LHashValOfNameSysA (OLEAUT32.166)
+ *              LHashValOfNameSys  (TYPELIB.4)
  *
  * Produce a string hash value.
  *
index 9884416..aa97b31 100644 (file)
@@ -807,8 +807,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
            return S_OK;
        /*FALLTHROUGH*/
     }
-    FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid));
-    return CLASS_E_CLASSNOTAVAILABLE;
+    return OLEAUTPS_DllGetClassObject(rclsid, iid, ppv);
 }
 
 /***********************************************************************
index 1d4cb14..83a0e2d 100644 (file)
@@ -31,7 +31,7 @@
        <file>oleaut32_oaidl.idl</file>
        <include base="oleaut32" root="intermediate">.</include>
        <file>oleaut32.spec</file>
-       <library>oleaut32_oleaut32_oaidl_proxy</library>
+       <library>oleaut32_proxy</library>
        <library>wine</library>
        <library>ole32</library>
        <library>rpcrt4</library>
@@ -45,7 +45,8 @@
        <library>uuid</library>
        <library>pseh</library>
 </module>
-<module name="oleaut32_oleaut32_oaidl_proxy" type="rpcproxy" allowwarnings="true">
+<module name="oleaut32_proxy" type="rpcproxy" allowwarnings="true">
        <file>oleaut32_oaidl.idl</file>
+       <file>oleaut32_ocidl.idl</file>
 </module>
 </group>
index f32e12a..e05528e 100644 (file)
@@ -47,6 +47,7 @@
 #include "oleaut32_Sv.rc"
 #include "oleaut32_Th.rc"
 #include "oleaut32_Tr.rc"
+#include "oleaut32_Zh.rc"
 #include "oleaut32_Uk.rc"
 
 /*
diff --git a/reactos/dll/win32/oleaut32/oleaut32_Zh.rc b/reactos/dll/win32/oleaut32/oleaut32_Zh.rc
new file mode 100644 (file)
index 0000000..320c40f
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * oleaut32 (Simplified and Traditional Chinese Resources)
+ *
+ * Copyright 2008 Hongbo Ni <hongbo.at.njstar.com>
+ *
+ * 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
+ */
+
+/* Chinese text is encoded in UTF-8 */
+#pragma code_page(65001)
+
+LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
+
+STRINGTABLE DISCARDABLE
+{
+  IDS_TRUE  "真"
+  IDS_FALSE "假"
+  IDS_YES   "是"
+  IDS_NO    "否"
+  IDS_ON    "开"
+  IDS_OFF   "关"
+}
+
+LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL
+
+STRINGTABLE DISCARDABLE
+{
+  IDS_TRUE  "真"
+  IDS_FALSE "假"
+  IDS_YES   "是"
+  IDS_NO    "否"
+  IDS_ON    "開"
+  IDS_OFF   "關"
+}
+
+#pragma code_page(default)
diff --git a/reactos/dll/win32/oleaut32/oleaut32_ocidl.idl b/reactos/dll/win32/oleaut32/oleaut32_ocidl.idl
new file mode 100644 (file)
index 0000000..379df5b
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2007 Google (Dan Hipschman)
+ *
+ * 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
+ */
+
+cpp_quote("#include <winuser.h>")
+#include "ocidl.idl"
index cad5b7b..8dc10ed 100644 (file)
@@ -1365,6 +1365,8 @@ static HRESULT OLEPictureImpl_LoadDIB(OLEPictureImpl *This, BYTE *xbuf, ULONG xr
        DIB_RGB_COLORS
     );
     DeleteDC(hdcref);
+    if (This->desc.u.bmp.hbitmap == 0)
+        return E_FAIL;
     This->desc.picType = PICTYPE_BITMAP;
     OLEPictureImpl_SetBitmap(This);
     return S_OK;
@@ -1845,7 +1847,7 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
       TRACE("Reading all data from stream.\n");
       xbuf = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, origsize);
       if (headerisdata)
-          memcpy (xbuf, &header, 8);
+          memcpy (xbuf, header, 8);
       while (1) {
           while (xread < origsize) {
               hr = IStream_Read(pStm,xbuf+xread,origsize-xread,&nread);
@@ -1869,9 +1871,11 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
   } else {
       This->datalen = toread+(headerisdata?8:0);
       xbuf = This->data = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, This->datalen);
+      if (!xbuf)
+          return E_OUTOFMEMORY;
 
       if (headerisdata)
-          memcpy (xbuf, &header, 8);
+          memcpy (xbuf, header, 8);
 
       while (xread < This->datalen) {
           ULONG nread;
@@ -1927,7 +1931,7 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
     FIXME("Unknown magic %04x, %d read bytes:\n",magic,xread);
     hr=E_FAIL;
     for (i=0;i<xread+8;i++) {
-       if (i<8) MESSAGE("%02x ",((unsigned char*)&header)[i]);
+       if (i<8) MESSAGE("%02x ",((unsigned char*)header)[i]);
        else MESSAGE("%02x ",xbuf[i-8]);
         if (i % 10 == 9) MESSAGE("\n");
     }
@@ -2644,8 +2648,15 @@ HRESULT WINAPI OleLoadPicture( LPSTREAM lpstream, LONG lSize, BOOL fRunmode,
       *ppvObj = NULL;
       return hr;
   }
-  IPersistStream_Load(ps,lpstream);
+  hr = IPersistStream_Load(ps,lpstream);
   IPersistStream_Release(ps);
+  if (FAILED(hr))
+  {
+      ERR("IPersistStream_Load failed\n");
+      IPicture_Release(newpic);
+      *ppvObj = NULL;
+      return hr;
+  }
   hr = IPicture_QueryInterface(newpic,riid,ppvObj);
   if (hr)
       FIXME("Failed to get interface %s from IPicture.\n",debugstr_guid(riid));
index 34cfd91..a19d599 100644 (file)
@@ -1500,6 +1500,8 @@ HRESULT WINAPI SafeArrayGetVartype(SAFEARRAY* psa, VARTYPE* pvt)
 
   if (psa->fFeatures & FADF_RECORD)
     *pvt = VT_RECORD;
+  else if ((psa->fFeatures & (FADF_HAVEIID|FADF_DISPATCH)) == (FADF_HAVEIID|FADF_DISPATCH))
+    *pvt = VT_DISPATCH;
   else if (psa->fFeatures & FADF_HAVEIID)
     *pvt = VT_UNKNOWN;
   else if (psa->fFeatures & FADF_HAVEVARTYPE)
index bbdae10..9c7ef98 100644 (file)
@@ -1357,6 +1357,8 @@ static void TLB_abort(void)
 {
     DebugBreak();
 }
+
+static void * TLB_Alloc(unsigned size) __WINE_ALLOC_SIZE(1);
 static void * TLB_Alloc(unsigned size)
 {
     void * ret;
@@ -1436,6 +1438,18 @@ static inline void TLB_FreeCustData(TLBCustData *pCustData)
     }
 }
 
+static BSTR TLB_MultiByteToBSTR(const char *ptr)
+{
+    DWORD len;
+    BSTR ret;
+
+    len = MultiByteToWideChar(CP_ACP, 0, ptr, -1, NULL, 0);
+    ret = SysAllocStringLen(NULL, len - 1);
+    if (!ret) return ret;
+    MultiByteToWideChar(CP_ACP, 0, ptr, -1, ret, len);
+    return ret;
+}
+
 /**********************************************************************
  *
  *  Functions for reading MSFT typelibs (those created by CreateTypeLib2)
@@ -2699,7 +2713,6 @@ static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength)
         while(offset < tlbSegDir.pImpFiles.offset +tlbSegDir.pImpFiles.length)
        {
             char *name;
-            DWORD len;
 
             *ppImpLib = TLB_Alloc(sizeof(TLBImpLib));
             (*ppImpLib)->offset = offset - tlbSegDir.pImpFiles.offset;
@@ -2713,10 +2726,7 @@ static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength)
             size >>= 2;
             name = TLB_Alloc(size+1);
             MSFT_Read(name, size, &cx, DO_NOT_SEEK);
-            len = MultiByteToWideChar(CP_ACP, 0, name, -1, NULL, 0 );
-            (*ppImpLib)->name = TLB_Alloc(len * sizeof(WCHAR));
-            MultiByteToWideChar(CP_ACP, 0, name, -1, (*ppImpLib)->name, len );
-            TLB_Free(name);
+            (*ppImpLib)->name = TLB_MultiByteToBSTR(name);
 
             MSFT_ReadGuid(&(*ppImpLib)->guid, oGuid, &cx);
             offset = (offset + sizeof(INT) + sizeof(DWORD) + sizeof(LCID) + sizeof(UINT16) + size + 3) & ~3;
@@ -2750,20 +2760,6 @@ static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength)
 }
 
 
-static BSTR TLB_MultiByteToBSTR(const char *ptr)
-{
-    DWORD len;
-    WCHAR *nameW;
-    BSTR ret;
-
-    len = MultiByteToWideChar(CP_ACP, 0, ptr, -1, NULL, 0);
-    nameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
-    MultiByteToWideChar(CP_ACP, 0, ptr, -1, nameW, len);
-    ret = SysAllocString(nameW);
-    HeapFree(GetProcessHeap(), 0, nameW);
-    return ret;
-}
-
 static BOOL TLB_GUIDFromString(const char *str, GUID *guid)
 {
   char b[3];
@@ -2790,16 +2786,14 @@ static WORD SLTG_ReadString(const char *ptr, BSTR *pBstr)
 {
     WORD bytelen;
     DWORD len;
-    WCHAR *nameW;
 
     *pBstr = NULL;
     bytelen = *(const WORD*)ptr;
     if(bytelen == 0xffff) return 2;
     len = MultiByteToWideChar(CP_ACP, 0, ptr + 2, bytelen, NULL, 0);
-    nameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
-    len = MultiByteToWideChar(CP_ACP, 0, ptr + 2, bytelen, nameW, len);
-    *pBstr = SysAllocStringLen(nameW, len);
-    HeapFree(GetProcessHeap(), 0, nameW);
+    *pBstr = SysAllocStringLen(NULL, len - 1);
+    if (*pBstr)
+        len = MultiByteToWideChar(CP_ACP, 0, ptr + 2, bytelen, *pBstr, len);
     return bytelen + 2;
 }
 
@@ -2882,7 +2876,7 @@ static HRESULT sltg_get_typelib_ref(const sltg_ref_lookup_t *table, DWORD typein
         return S_OK;
     }
 
-    ERR("Unable to find reference\n");
+    ERR_(typelib)("Unable to find reference\n");
     *typelib_ref = -1;
     return E_FAIL;
 }
@@ -2989,7 +2983,7 @@ static sltg_ref_lookup_t *SLTG_DoRefs(SLTG_RefInfo *pRef, ITypeLibImpl *pTL,
         FIXME("Ref magic = %x\n", pRef->magic);
        return NULL;
     }
-    name = ( (char*)(&pRef->names) + pRef->number);
+    name = ( (char*)pRef->names + pRef->number);
 
     table = HeapAlloc(GetProcessHeap(), 0, sizeof(*table) + ((pRef->number >> 3) - 1) * sizeof(table->refs[0]));
     table->num = pRef->number >> 3;
@@ -3007,7 +3001,7 @@ static sltg_ref_lookup_t *SLTG_DoRefs(SLTG_RefInfo *pRef, ITypeLibImpl *pTL,
 
        name += SLTG_ReadStringA(name, &refname);
        if(sscanf(refname, "*\\R%x*#%x", &lib_offs, &type_num) != 2)
-           FIXME("Can't sscanf ref\n");
+           FIXME_(typelib)("Can't sscanf ref\n");
        if(lib_offs != 0xffff) {
            TLBImpLib **import = &pTL->pImpLibs;
 
@@ -3029,7 +3023,7 @@ static sltg_ref_lookup_t *SLTG_DoRefs(SLTG_RefInfo *pRef, ITypeLibImpl *pTL,
                          &(*import)->wVersionMajor,
                          &(*import)->wVersionMinor,
                          &(*import)->lcid, fname) != 4) {
-                 FIXME("can't sscanf ref %s\n",
+                 FIXME_(typelib)("can't sscanf ref %s\n",
                        pNameTable + lib_offs + 40);
                }
                len = strlen(fname);
@@ -3057,7 +3051,7 @@ static sltg_ref_lookup_t *SLTG_DoRefs(SLTG_RefInfo *pRef, ITypeLibImpl *pTL,
         typelib_ref += 4;
     }
     if((BYTE)*name != SLTG_REF_MAGIC)
-      FIXME("End of ref block magic = %x\n", *name);
+      FIXME_(typelib)("End of ref block magic = %x\n", *name);
     dump_TLBRefType(pTL);
     return table;
 }
@@ -3086,7 +3080,7 @@ static char *SLTG_DoImpls(char *pBlk, ITypeInfoImpl *pTI,
         if(info->next == 0xffff)
            break;
        if(OneOnly)
-           FIXME("Interface inheriting more than one interface\n");
+           FIXME_(typelib)("Interface inheriting more than one interface\n");
        info = (SLTG_ImplInfo*)(pBlk + info->next);
     }
     info++; /* see comment at top of function */
@@ -3135,6 +3129,12 @@ static void SLTG_DoVars(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsign
       SLTG_DoElem(pType, pBlk,
                  &(*ppVarDesc)->vardesc.elemdescVar, ref_lookup);
 
+      if (TRACE_ON(typelib)) {
+          char buf[300];
+          dump_TypeDesc(&(*ppVarDesc)->vardesc.elemdescVar.tdesc, buf);
+          TRACE_(typelib)("elemdescVar: %s\n", buf);
+      }
+
       if (pItem->flags & 0x40) {
         TRACE_(typelib)("VAR_DISPATCH\n");
         (*ppVarDesc)->vardesc.varkind = VAR_DISPATCH;
@@ -3155,9 +3155,15 @@ static void SLTG_DoVars(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsign
             case VT_BSTR:
             {
               WORD len = *(WORD *)(pBlk + pItem->byte_offs);
-              INT alloc_len = MultiByteToWideChar(CP_ACP, 0, pBlk + pItem->byte_offs + 2, len, NULL, 0);
-              BSTR str = SysAllocStringLen(NULL, alloc_len);
-              MultiByteToWideChar(CP_ACP, 0, pBlk + pItem->byte_offs + 2, len, str, alloc_len);
+              BSTR str;
+              TRACE_(typelib)("len = %u\n", len);
+              if (len == 0xffff) {
+                str = NULL;
+              } else {
+                INT alloc_len = MultiByteToWideChar(CP_ACP, 0, pBlk + pItem->byte_offs + 2, len, NULL, 0);
+                str = SysAllocStringLen(NULL, alloc_len);
+                MultiByteToWideChar(CP_ACP, 0, pBlk + pItem->byte_offs + 2, len, str, alloc_len);
+              }
               V_VT((*ppVarDesc)->vardesc.u.lpvarValue) = VT_BSTR;
               V_BSTR((*ppVarDesc)->vardesc.u.lpvarValue) = str;
               break;
@@ -3170,7 +3176,7 @@ static void SLTG_DoVars(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsign
                 *(INT*)(pBlk + pItem->byte_offs);
               break;
             default:
-              FIXME("VAR_CONST unimplemented for type %d\n", (*ppVarDesc)->vardesc.elemdescVar.tdesc.vt);
+              FIXME_(typelib)("VAR_CONST unimplemented for type %d\n", (*ppVarDesc)->vardesc.elemdescVar.tdesc.vt);
           }
         }
       }
@@ -3186,12 +3192,6 @@ static void SLTG_DoVars(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsign
       if (pItem->flags & 0x80)
         (*ppVarDesc)->vardesc.wVarFlags |= VARFLAG_FREADONLY;
 
-      if (TRACE_ON(typelib)) {
-          char buf[300];
-          dump_TypeDesc(&(*ppVarDesc)->vardesc.elemdescVar.tdesc, buf);
-          TRACE_(typelib)("elemdescVar: %s\n", buf);
-      }
-
       bstrPrevName = (*ppVarDesc)->Name;
       ppVarDesc = &((*ppVarDesc)->next);
   }
@@ -3302,6 +3302,9 @@ static void SLTG_DoFuncs(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI,
            if(paramName) {
                (*ppFuncDesc)->pParamDesc[param].Name =
                  TLB_MultiByteToBSTR(paramName);
+           } else {
+               (*ppFuncDesc)->pParamDesc[param].Name =
+                  SysAllocString((*ppFuncDesc)->Name);
            }
        }
 
@@ -3439,6 +3442,8 @@ static void SLTG_ProcessModule(char *pBlk, ITypeInfoImpl *pTI,
   if (pTITail->funcs_off != 0xffff)
     SLTG_DoFuncs(pBlk, pBlk + pTITail->funcs_off, pTI, pTITail->cFuncs, pNameTable, ref_lookup);
   HeapFree(GetProcessHeap(), 0, ref_lookup);
+  if (TRACE_ON(typelib))
+    dump_TypeInfo(pTI);
 }
 
 /* Because SLTG_OtherTypeInfo is such a painful struct, we make a more
@@ -3491,7 +3496,7 @@ static ITypeLib2* ITypeLib2_Constructor_SLTG(LPVOID pLib, DWORD dwTLBLength)
     TRACE_(typelib)("\tmagic=0x%08x, file blocks = %d\n", pHeader->SLTG_magic,
          pHeader->nrOfFileBlks );
     if (pHeader->SLTG_magic != SLTG_SIGNATURE) {
-       FIXME("Header type magic 0x%08x not supported.\n",
+       FIXME_(typelib)("Header type magic 0x%08x not supported.\n",
              pHeader->SLTG_magic);
        return NULL;
     }
@@ -3508,12 +3513,12 @@ static ITypeLib2* ITypeLib2_Constructor_SLTG(LPVOID pLib, DWORD dwTLBLength)
     /* Let's see if we're still in sync */
     if(memcmp(pMagic->CompObj_magic, SLTG_COMPOBJ_MAGIC,
              sizeof(SLTG_COMPOBJ_MAGIC))) {
-        FIXME("CompObj magic = %s\n", pMagic->CompObj_magic);
+        FIXME_(typelib)("CompObj magic = %s\n", pMagic->CompObj_magic);
        return NULL;
     }
     if(memcmp(pMagic->dir_magic, SLTG_DIR_MAGIC,
              sizeof(SLTG_DIR_MAGIC))) {
-        FIXME("dir magic = %s\n", pMagic->dir_magic);
+        FIXME_(typelib)("dir magic = %s\n", pMagic->dir_magic);
        return NULL;
     }
 
@@ -3607,7 +3612,7 @@ static ITypeLib2* ITypeLib2_Constructor_SLTG(LPVOID pLib, DWORD dwTLBLength)
        pNameTable += 0x20;
        break;
    default:
-       FIXME("pNameTable jump = %x\n", *(WORD*)pNameTable);
+       FIXME_(typelib)("pNameTable jump = %x\n", *(WORD*)pNameTable);
        break;
    }
 
@@ -3615,7 +3620,7 @@ static ITypeLib2* ITypeLib2_Constructor_SLTG(LPVOID pLib, DWORD dwTLBLength)
 
     pNameTable += 2;
 
-    TRACE("Library name is %s\n", pNameTable + pLibBlk->name);
+    TRACE_(typelib)("Library name is %s\n", pNameTable + pLibBlk->name);
 
     pTypeLibImpl->Name = TLB_MultiByteToBSTR(pNameTable + pLibBlk->name);
 
@@ -3637,16 +3642,17 @@ static ITypeLib2* ITypeLib2_Constructor_SLTG(LPVOID pLib, DWORD dwTLBLength)
 
       if(strcmp(pBlkEntry[order].index_string + (char*)pMagic,
                pOtherTypeInfoBlks[i].index_name)) {
-       FIXME("Index strings don't match\n");
+       FIXME_(typelib)("Index strings don't match\n");
        return NULL;
       }
 
       pTIHeader = pBlk;
       if(pTIHeader->magic != SLTG_TIHEADER_MAGIC) {
-       FIXME("TypeInfoHeader magic = %04x\n", pTIHeader->magic);
+       FIXME_(typelib)("TypeInfoHeader magic = %04x\n", pTIHeader->magic);
        return NULL;
       }
-      TRACE("pTIHeader->res06 = %x, pTIHeader->res0e = %x, pTIHeader->res16 = %x, pTIHeader->res1e = %x\n",
+      TRACE_(typelib)("pTIHeader->res06 = %x, pTIHeader->res0e = %x, "
+        "pTIHeader->res16 = %x, pTIHeader->res1e = %x\n",
         pTIHeader->res06, pTIHeader->res0e, pTIHeader->res16, pTIHeader->res1e);
 
       *ppTypeInfoImpl = (ITypeInfoImpl*)ITypeInfo_Constructor();
@@ -3664,11 +3670,11 @@ static ITypeLib2* ITypeLib2_Constructor_SLTG(LPVOID pLib, DWORD dwTLBLength)
        (pTIHeader->typeflags1 >> 3) | (pTIHeader->typeflags2 << 5);
 
       if((pTIHeader->typeflags1 & 7) != 2)
-       FIXME("typeflags1 = %02x\n", pTIHeader->typeflags1);
+       FIXME_(typelib)("typeflags1 = %02x\n", pTIHeader->typeflags1);
       if(pTIHeader->typeflags3 != 2)
-       FIXME("typeflags3 = %02x\n", pTIHeader->typeflags3);
+       FIXME_(typelib)("typeflags3 = %02x\n", pTIHeader->typeflags3);
 
-      TRACE("TypeInfo %s of kind %s guid %s typeflags %04x\n",
+      TRACE_(typelib)("TypeInfo %s of kind %s guid %s typeflags %04x\n",
            debugstr_w((*ppTypeInfoImpl)->Name),
            typekind_desc[pTIHeader->typekind],
            debugstr_guid(&(*ppTypeInfoImpl)->TypeAttr.guid),
@@ -3867,7 +3873,7 @@ static ULONG WINAPI ITypeLib2_fnRelease( ITypeLib2 *iface)
       {
           if (pImpLib->pImpTypeLib)
               ITypeLib_Release((ITypeLib *)pImpLib->pImpTypeLib);
-          TLB_Free(pImpLib->name);
+          SysFreeString(pImpLib->name);
 
           pImpLibNext = pImpLib->next;
           TLB_Free(pImpLib);
index 3f943e2..c994288 100644 (file)
@@ -1,6 +1,6 @@
 2  stub CREATETYPELIB
 3  pascal LoadTypeLib(ptr ptr) LoadTypeLib16
-4  stub LHASHVALOFNAMESYS
+4  pascal LHashValOfNameSys(word long str) LHashValOfNameSysA
 5  stub _IID_ICREATETYPEINFO
 6  stub _IID_ICREATETYPELIB
 7  stub _IID_ITYPECOMP
index 6b773dc..cbcd7f0 100644 (file)
@@ -152,6 +152,7 @@ typedef struct tagICreateTypeLib2Impl
     WCHAR *filename;
 
     MSFT_Header typelib_header;
+    INT helpStringDll;
     MSFT_pSeg typelib_segdir[MSFT_SEG_MAX];
     char *typelib_segment_data[MSFT_SEG_MAX];
     int typelib_segment_block_length[MSFT_SEG_MAX];
@@ -231,6 +232,7 @@ static void ctl2_init_header(
     This->typelib_header.res48 = 0x80;
     This->typelib_header.dispatchpos = -1;
     This->typelib_header.nimpinfos = 0;
+    This->helpStringDll = -1;
 }
 
 /****************************************************************************
@@ -726,7 +728,7 @@ static int ctl2_alloc_importfile(
     importfile->guid = guidoffset;
     importfile->lcid = This->typelib_header.lcid2;
     importfile->version = major_version | (minor_version << 16);
-    memcpy(&importfile->filename, encoded_string, length);
+    memcpy(importfile->filename, encoded_string, length);
 
     return offset;
 }
@@ -3331,8 +3333,10 @@ static HRESULT WINAPI ICreateTypeLib2_fnSaveAllChanges(ICreateTypeLib2 * iface)
     ctl2_finalize_typeinfos(This, filepos);
 
     if (!ctl2_write_chunk(hFile, &This->typelib_header, sizeof(This->typelib_header))) return retval;
+    if (This->typelib_header.varflags & HELPDLLFLAG)
+        if (!ctl2_write_chunk(hFile, &This->helpStringDll, sizeof(This->helpStringDll))) return retval;
     if (!ctl2_write_chunk(hFile, This->typelib_typeinfo_offsets, This->typelib_header.nrtypeinfos * 4)) return retval;
-    if (!ctl2_write_chunk(hFile, &This->typelib_segdir, sizeof(This->typelib_segdir))) return retval;
+    if (!ctl2_write_chunk(hFile, This->typelib_segdir, sizeof(This->typelib_segdir))) return retval;
     if (!ctl2_write_segment(This, hFile, MSFT_SEG_TYPEINFO    )) return retval;
     if (!ctl2_write_segment(This, hFile, MSFT_SEG_GUIDHASH    )) return retval;
     if (!ctl2_write_segment(This, hFile, MSFT_SEG_GUID        )) return retval;
@@ -3401,35 +3405,56 @@ static HRESULT WINAPI ICreateTypeLib2_fnSetCustData(
  *
  *  Sets a context number for the library help string.
  *
- * RETURNS
+ * PARAMS
+ *  iface     [I] The type library to set the help string context for.
+ *  dwContext [I] The help string context.
  *
+ * RETURNS
  *  Success: S_OK
  *  Failure: E_OUTOFMEMORY or E_INVALIDARG.
  */
-static HRESULT WINAPI ICreateTypeLib2_fnSetHelpStringContext(
-       ICreateTypeLib2 * iface,   /* [I] The type library to set the help string context for. */
-       ULONG dwHelpStringContext) /* [I] The help string context. */
+static
+HRESULT WINAPI ICreateTypeLib2_fnSetHelpStringContext(ICreateTypeLib2 * iface,
+                                                      ULONG dwContext)
 {
-    FIXME("(%p,%d), stub!\n", iface, dwHelpStringContext);
-    return E_OUTOFMEMORY;
+    ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
+
+    TRACE("(%p,%d)\n", iface, dwContext);
+
+    This->typelib_header.helpstringcontext = dwContext;
+    return S_OK;
 }
 
 /******************************************************************************
  * ICreateTypeLib2_SetHelpStringDll {OLEAUT32}
  *
- *  Sets the DLL used to look up localized help strings.
+ *  Set the DLL used to look up localized help strings.
  *
- * RETURNS
+ * PARAMS
+ *  iface     [I] The type library to set the help DLL for.
+ *  szDllName [I] The name of the help DLL.
  *
+ * RETURNS
  *  Success: S_OK
  *  Failure: E_OUTOFMEMORY or E_INVALIDARG.
  */
-static HRESULT WINAPI ICreateTypeLib2_fnSetHelpStringDll(
-       ICreateTypeLib2 * iface, /* [I] The type library to set the help DLL for. */
-       LPOLESTR szFileName)     /* [I] The name of the help DLL. */
+static
+HRESULT WINAPI ICreateTypeLib2_fnSetHelpStringDll(ICreateTypeLib2 * iface,
+                                                  LPOLESTR szDllName)
 {
-    FIXME("(%p,%s), stub!\n", iface, debugstr_w(szFileName));
-    return E_OUTOFMEMORY;
+    ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
+    int offset;
+
+    TRACE("(%p,%s)\n", iface, debugstr_w(szDllName));
+    if (!szDllName)
+        return E_INVALIDARG;
+
+    offset = ctl2_alloc_string(This, szDllName);
+    if (offset == -1)
+        return E_OUTOFMEMORY;
+    This->typelib_header.varflags |= HELPDLLFLAG;
+    This->helpStringDll = offset;
+    return S_OK;
 }
 
 /*================== ITypeLib2 Implementation ===================================*/
index a9a738c..ea5f49e 100644 (file)
@@ -36,6 +36,7 @@
 #include "oleauto.h"
 #include "rpcproxy.h"
 #include "typelib.h"
+#include "ocidl.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
@@ -50,9 +51,11 @@ static CStdPSFactoryBuffer PSFactoryBuffer;
 CSTDSTUBBUFFERRELEASE(&PSFactoryBuffer)
 
 extern const ExtendedProxyFileInfo oleaut32_oaidl_ProxyFileInfo;
+extern const ExtendedProxyFileInfo oleaut32_ocidl_ProxyFileInfo;
 
 static const ProxyFileInfo *OLEAUT32_ProxyFileList[] = {
   &oleaut32_oaidl_ProxyFileInfo,
+  &oleaut32_ocidl_ProxyFileInfo,
   NULL
 };
 
@@ -1128,6 +1131,32 @@ void WINAPI LPSAFEARRAY_UserFree(ULONG *pFlags, LPSAFEARRAY *ppsa)
     SafeArrayDestroy(*ppsa);
 }
 
+
+ULONG WINAPI HFONT_UserSize(ULONG *pFlags, ULONG Start, HFONT *phfont)
+{
+    FIXME(":stub\n");
+    return 0;
+}
+
+unsigned char * WINAPI HFONT_UserMarshal(ULONG *pFlags, unsigned char *Buffer, HFONT *phfont)
+{
+    FIXME(":stub\n");
+    return NULL;
+}
+
+unsigned char * WINAPI HFONT_UserUnmarshal(ULONG *pFlags, unsigned char *Buffer, HFONT *phfont)
+{
+    FIXME(":stub\n");
+    return NULL;
+}
+
+void WINAPI HFONT_UserFree(ULONG *pFlags, HFONT *phfont)
+{
+    FIXME(":stub\n");
+    return;
+}
+
+
 /* IDispatch */
 /* exactly how Invoke is marshalled is not very clear to me yet,
  * but the way I've done it seems to work for me */
@@ -2029,3 +2058,158 @@ HRESULT __RPC_STUB IPropertyBag_Read_Stub(
   FIXME("not implemented\n");
   return E_FAIL;
 }
+
+/* call_as/local stubs for ocidl.idl */
+
+HRESULT CALLBACK IClassFactory2_CreateInstanceLic_Proxy(
+    IClassFactory2* This,
+    IUnknown *pUnkOuter,
+    IUnknown *pUnkReserved,
+    REFIID riid,
+    BSTR bstrKey,
+    PVOID *ppvObj)
+{
+    FIXME("not implemented\n");
+    return E_NOTIMPL;
+}
+
+HRESULT __RPC_STUB IClassFactory2_CreateInstanceLic_Stub(
+    IClassFactory2* This,
+    REFIID riid,
+    BSTR bstrKey,
+    IUnknown **ppvObj)
+{
+    FIXME("not implemented\n");
+    return E_NOTIMPL;
+}
+
+HRESULT CALLBACK IEnumConnections_Next_Proxy(
+    IEnumConnections* This,
+    ULONG cConnections,
+    LPCONNECTDATA rgcd,
+    ULONG *pcFetched)
+{
+    FIXME("not implemented\n");
+    return E_NOTIMPL;
+}
+
+HRESULT __RPC_STUB IEnumConnections_Next_Stub(
+    IEnumConnections* This,
+    ULONG cConnections,
+    LPCONNECTDATA rgcd,
+    ULONG *pcFetched)
+{
+    FIXME("not implemented\n");
+    return E_NOTIMPL;
+}
+
+HRESULT CALLBACK IEnumConnectionPoints_Next_Proxy(
+    IEnumConnectionPoints* This,
+    ULONG cConnections,
+    LPCONNECTIONPOINT *ppCP,
+    ULONG *pcFetched)
+{
+    FIXME("not implemented\n");
+    return E_NOTIMPL;
+}
+
+HRESULT __RPC_STUB IEnumConnectionPoints_Next_Stub(
+    IEnumConnectionPoints* This,
+    ULONG cConnections,
+    LPCONNECTIONPOINT *ppCP,
+    ULONG *pcFetched)
+{
+    FIXME("not implemented\n");
+    return E_NOTIMPL;
+}
+
+HRESULT CALLBACK IPersistMemory_Load_Proxy(
+    IPersistMemory* This,
+    LPVOID pMem,
+    ULONG cbSize)
+{
+    FIXME("not implemented\n");
+    return E_NOTIMPL;
+}
+
+HRESULT __RPC_STUB IPersistMemory_Load_Stub(
+    IPersistMemory* This,
+    BYTE *pMem,
+    ULONG cbSize)
+{
+    FIXME("not implemented\n");
+    return E_NOTIMPL;
+}
+
+HRESULT CALLBACK IPersistMemory_Save_Proxy(
+    IPersistMemory* This,
+    LPVOID pMem,
+    BOOL fClearDirty,
+    ULONG cbSize)
+{
+    FIXME("not implemented\n");
+    return E_NOTIMPL;
+}
+
+HRESULT __RPC_STUB IPersistMemory_Save_Stub(
+    IPersistMemory* This,
+    BYTE *pMem,
+    BOOL fClearDirty,
+    ULONG cbSize)
+{
+    FIXME("not implemented\n");
+    return E_NOTIMPL;
+}
+
+void CALLBACK IAdviseSinkEx_OnViewStatusChange_Proxy(
+    IAdviseSinkEx* This,
+    DWORD dwViewStatus)
+{
+    FIXME("not implemented\n");
+}
+
+HRESULT __RPC_STUB IAdviseSinkEx_OnViewStatusChange_Stub(
+    IAdviseSinkEx* This,
+    DWORD dwViewStatus)
+{
+    FIXME("not implemented\n");
+    return E_NOTIMPL;
+}
+
+HRESULT CALLBACK IEnumOleUndoUnits_Next_Proxy(
+    IEnumOleUndoUnits* This,
+    ULONG cElt,
+    IOleUndoUnit **rgElt,
+    ULONG *pcEltFetched)
+{
+    FIXME("not implemented\n");
+    return E_NOTIMPL;
+}
+
+HRESULT __RPC_STUB IEnumOleUndoUnits_Next_Stub(
+    IEnumOleUndoUnits* This,
+    ULONG cElt,
+    IOleUndoUnit **rgElt,
+    ULONG *pcEltFetched)
+{
+    FIXME("not implemented\n");
+    return E_NOTIMPL;
+}
+
+HRESULT CALLBACK IQuickActivate_QuickActivate_Proxy(
+    IQuickActivate* This,
+    QACONTAINER *pQaContainer,
+    QACONTROL *pQaControl)
+{
+    FIXME("not implemented\n");
+    return E_NOTIMPL;
+}
+
+HRESULT __RPC_STUB IQuickActivate_QuickActivate_Stub(
+    IQuickActivate* This,
+    QACONTAINER *pQaContainer,
+    QACONTROL *pQaControl)
+{
+    FIXME("not implemented\n");
+    return E_NOTIMPL;
+}
index 83f075f..27735fc 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Variant formatting functions
  *
+ * Copyright 2008 Damjan Jovanovic
  * Copyright 2003 Jon Griffiths
  *
  * This library is free software; you can redistribute it and/or
@@ -1181,6 +1182,7 @@ HRESULT WINAPI VarTokenizeFormatString(LPOLESTR lpszFormat, LPBYTE rgbTok,
 /* Number formatting state flags */
 #define NUM_WROTE_DEC  0x01 /* Written the decimal separator */
 #define NUM_WRITE_ON   0x02 /* Started to write the number */
+#define NUM_WROTE_SIGN 0x04 /* Written the negative sign */
 
 /* Format a variant using a number format */
 static HRESULT VARIANT_FormatNumber(LPVARIANT pVarIn, LPOLESTR lpszFormat,
@@ -1191,6 +1193,7 @@ static HRESULT VARIANT_FormatNumber(LPVARIANT pVarIn, LPOLESTR lpszFormat,
   NUMPARSE np;
   int have_int, need_int = 0, have_frac, need_frac, exponent = 0, pad = 0;
   WCHAR buff[256], *pBuff = buff;
+  WCHAR thousandSeparator[32];
   VARIANT vString, vBool;
   DWORD dwState = 0;
   FMT_HEADER *header = (FMT_HEADER*)rgbTok;
@@ -1313,6 +1316,16 @@ static HRESULT VARIANT_FormatNumber(LPVARIANT pVarIn, LPOLESTR lpszFormat,
           have_int, need_int, have_frac, need_frac, pad, exponent);
   }
 
+  if (numHeader->flags & FMT_FLAG_THOUSANDS)
+  {
+    if (!GetLocaleInfoW(lcid, LOCALE_STHOUSAND, thousandSeparator,
+                        sizeof(thousandSeparator)/sizeof(WCHAR)))
+    {
+      thousandSeparator[0] = ',';
+      thousandSeparator[1] = 0;
+    }
+  }
+
   pToken = (const BYTE*)numHeader + sizeof(FMT_NUMBER_HEADER);
   prgbDig = rgbDig;
 
@@ -1320,6 +1333,7 @@ static HRESULT VARIANT_FormatNumber(LPVARIANT pVarIn, LPOLESTR lpszFormat,
   {
     WCHAR defaultChar = '?';
     DWORD boolFlag, localeValue = 0;
+    BOOL shouldAdvance = TRUE;
 
     if (pToken - rgbTok > header->size)
     {
@@ -1377,6 +1391,16 @@ VARIANT_FormatNumber_Bool:
       break;
 
     case FMT_NUM_DECIMAL:
+      if ((np.dwOutFlags & NUMPRS_NEG) && !(dwState & NUM_WROTE_SIGN))
+      {
+        /* last chance for a negative sign in the .# case */
+        TRACE("write negative sign\n");
+        localeValue = LOCALE_SNEGATIVESIGN;
+        defaultChar = '-';
+        dwState |= NUM_WROTE_SIGN;
+        shouldAdvance = FALSE;
+        break;
+      }
       TRACE("write decimal separator\n");
       localeValue = LOCALE_SDECIMAL;
       defaultChar = '.';
@@ -1450,8 +1474,21 @@ VARIANT_FormatNumber_Bool:
       }
       else
       {
-        int count, count_max;
+        int count, count_max, position;
 
+        if ((np.dwOutFlags & NUMPRS_NEG) && !(dwState & NUM_WROTE_SIGN))
+        {
+          TRACE("write negative sign\n");
+          localeValue = LOCALE_SNEGATIVESIGN;
+          defaultChar = '-';
+          dwState |= NUM_WROTE_SIGN;
+          shouldAdvance = FALSE;
+          break;
+        }
+
+        position = have_int + pad;
+        if (dwState & NUM_WRITE_ON)
+          position = max(position, need_int);
         need_int -= pToken[1];
         count_max = have_int + pad - need_int;
         if (count_max < 0)
@@ -1461,25 +1498,55 @@ VARIANT_FormatNumber_Bool:
           count = pToken[1] - count_max;
           TRACE("write %d leading zeros\n", count);
           while (count-- > 0)
+          {
             *pBuff++ = '0';
+            if ((numHeader->flags & FMT_FLAG_THOUSANDS) &&
+                position > 1 && (--position % 3) == 0)
+            {
+              int k;
+              TRACE("write thousand separator\n");
+              for (k = 0; thousandSeparator[k]; k++)
+                *pBuff++ = thousandSeparator[k];
+            }
+          }
         }
         if (*pToken == FMT_NUM_COPY_ZERO || have_int > 1 ||
             (have_int > 0 && *prgbDig > 0))
         {
-          dwState |= NUM_WRITE_ON;
           count = min(count_max, have_int);
           count_max -= count;
           have_int -= count;
           TRACE("write %d whole number digits\n", count);
           while (count--)
+          {
+            dwState |= NUM_WRITE_ON;
             *pBuff++ = '0' + *prgbDig++;
+            if ((numHeader->flags & FMT_FLAG_THOUSANDS) &&
+                position > 1 && (--position % 3) == 0)
+            {
+              int k;
+              TRACE("write thousand separator\n");
+              for (k = 0; thousandSeparator[k]; k++)
+                *pBuff++ = thousandSeparator[k];
+            }
+          }
         }
         count = min(count_max, pad);
         count_max -= count;
         pad -= count;
         TRACE("write %d whole trailing 0's\n", count);
         while (count--)
+        {
           *pBuff++ = '0';
+          if ((numHeader->flags & FMT_FLAG_THOUSANDS) &&
+              position > 1 && (--position % 3) == 0)
+          {
+            int k;
+            TRACE("write thousand separator\n");
+            for (k = 0; thousandSeparator[k]; k++)
+              *pBuff++ = thousandSeparator[k];
+          }
+        }
       }
       pToken++;
       break;
@@ -1504,7 +1571,8 @@ VARIANT_FormatNumber_Bool:
         *pBuff++ = defaultChar;
       }
     }
-    pToken++;
+    if (shouldAdvance)
+      pToken++;
   }
 
 VARIANT_FormatNumber_Exit:
index e6191d1..5c094e1 100644 (file)
@@ -1191,7 +1191,7 @@ INT WINAPI DosDateTimeToVariantTime(USHORT wDosDate, USHORT wDosTime,
   ud.st.wSecond = DOS_SECOND(wDosTime);
   ud.st.wDayOfWeek = ud.st.wMilliseconds = 0;
 
-  return !VarDateFromUdate(&ud, 0, pDateOut);
+  return VarDateFromUdate(&ud, 0, pDateOut) == S_OK;
 }
 
 /**********************************************************************
@@ -1255,7 +1255,7 @@ INT WINAPI SystemTimeToVariantTime(LPSYSTEMTIME lpSt, double *pDateOut)
     return FALSE;
 
   ud.st = *lpSt;
-  return !VarDateFromUdate(&ud, 0, pDateOut);
+  return VarDateFromUdate(&ud, 0, pDateOut) == S_OK;
 }
 
 /***********************************************************************
index daeac85..5f697c8 100644 (file)
@@ -5179,7 +5179,7 @@ static HRESULT VARIANT_DI_div(const VARIANT_DI * dividend, const VARIANT_DI * di
            to multiply quotient by 10 (without overflowing), while adjusting the scale,
            until scale is 0. If this cannot be done, it is a real overflow.
          */
-        while (!r_overflow && quotientscale < 0) {
+        while (r_overflow == S_OK && quotientscale < 0) {
             memset(remainderplusquotient, 0, sizeof(remainderplusquotient));
             memcpy(remainderplusquotient, quotient->bitsnum, sizeof(quotient->bitsnum));
             VARIANT_int_mulbychar(remainderplusquotient, sizeof(remainderplusquotient)/sizeof(DWORD), 10);
@@ -5189,7 +5189,7 @@ static HRESULT VARIANT_DI_div(const VARIANT_DI * dividend, const VARIANT_DI * di
                 memcpy(quotient->bitsnum, remainderplusquotient, sizeof(quotient->bitsnum));
             } else r_overflow = DISP_E_OVERFLOW;
         }
-        if (!r_overflow) {
+        if (r_overflow == S_OK) {
             if (quotientscale <= 255) quotient->scale = quotientscale;
             else VARIANT_DI_clear(quotient);
         }
@@ -6516,7 +6516,7 @@ HRESULT WINAPI VarBstrFromCy(CY cyIn, LCID lcid, ULONG dwFlags, BSTR *pbstrOut)
     VARIANT_int_add(decVal.bitsnum, 3, &one, 1);
   }
   decVal.bitsnum[2] = 0;
-  VARIANT_DI_tostringW(&decVal, buff, sizeof(buff));
+  VARIANT_DI_tostringW(&decVal, buff, sizeof(buff)/sizeof(buff[0]));
 
   if (dwFlags & LOCALE_USE_NLS)
   {
index 5a3f1ff..6887af3 100644 (file)
@@ -19,5 +19,7 @@
 #define WINE_OLESELFREGISTER
 #define WINE_FILEDESCRIPTION_STR "Wine OLE dll"
 #define WINE_FILENAME_STR "oleaut32.dll"
+#define WINE_FILEVERSION 6, 0, 6001, 18000 /* version from Vista SP1 */
+#define WINE_FILEVERSION_STR "6.0.6001.18000"
 
 #include "wine/wine_common_ver.rc"