diff --git a/reactos/dll/win32/oleaut32/hash.c b/reactos/dll/win32/oleaut32/hash.c index b3929f31c04..32c1086b7ef 100644 --- a/reactos/dll/win32/oleaut32/hash.c +++ b/reactos/dll/win32/oleaut32/hash.c @@ -486,6 +486,7 @@ static const unsigned char Lookup_224[128 * 3] = { /*********************************************************************** * LHashValOfNameSysA (OLEAUT32.166) + * LHashValOfNameSys (TYPELIB.4) * * Produce a string hash value. * diff --git a/reactos/dll/win32/oleaut32/oleaut.c b/reactos/dll/win32/oleaut32/oleaut.c index 98844167ca8..aa97b31a550 100644 --- a/reactos/dll/win32/oleaut32/oleaut.c +++ b/reactos/dll/win32/oleaut32/oleaut.c @@ -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); } /*********************************************************************** diff --git a/reactos/dll/win32/oleaut32/oleaut32.rbuild b/reactos/dll/win32/oleaut32/oleaut32.rbuild index 1d4cb14270a..83a0e2da883 100644 --- a/reactos/dll/win32/oleaut32/oleaut32.rbuild +++ b/reactos/dll/win32/oleaut32/oleaut32.rbuild @@ -31,7 +31,7 @@ oleaut32_oaidl.idl . oleaut32.spec - oleaut32_oleaut32_oaidl_proxy + oleaut32_proxy wine ole32 rpcrt4 @@ -45,7 +45,8 @@ uuid pseh - + oleaut32_oaidl.idl + oleaut32_ocidl.idl diff --git a/reactos/dll/win32/oleaut32/oleaut32.rc b/reactos/dll/win32/oleaut32/oleaut32.rc index f32e12a44d6..e05528ee698 100644 --- a/reactos/dll/win32/oleaut32/oleaut32.rc +++ b/reactos/dll/win32/oleaut32/oleaut32.rc @@ -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 index 00000000000..320c40ff5dd --- /dev/null +++ b/reactos/dll/win32/oleaut32/oleaut32_Zh.rc @@ -0,0 +1,48 @@ +/* + * oleaut32 (Simplified and Traditional Chinese Resources) + * + * Copyright 2008 Hongbo Ni + * + * 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 index 00000000000..379df5bbfee --- /dev/null +++ b/reactos/dll/win32/oleaut32/oleaut32_ocidl.idl @@ -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 ") +#include "ocidl.idl" diff --git a/reactos/dll/win32/oleaut32/olepicture.c b/reactos/dll/win32/oleaut32/olepicture.c index cad5b7b16ce..8dc10edf5a4 100644 --- a/reactos/dll/win32/oleaut32/olepicture.c +++ b/reactos/dll/win32/oleaut32/olepicture.c @@ -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;ifFeatures & 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) diff --git a/reactos/dll/win32/oleaut32/typelib.c b/reactos/dll/win32/oleaut32/typelib.c index bbdae109709..9c7ef98d72c 100644 --- a/reactos/dll/win32/oleaut32/typelib.c +++ b/reactos/dll/win32/oleaut32/typelib.c @@ -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); diff --git a/reactos/dll/win32/oleaut32/typelib.spec b/reactos/dll/win32/oleaut32/typelib.spec index 3f943e2795e..c9942886481 100644 --- a/reactos/dll/win32/oleaut32/typelib.spec +++ b/reactos/dll/win32/oleaut32/typelib.spec @@ -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 diff --git a/reactos/dll/win32/oleaut32/typelib2.c b/reactos/dll/win32/oleaut32/typelib2.c index 6b773dceadf..cbcd7f02332 100644 --- a/reactos/dll/win32/oleaut32/typelib2.c +++ b/reactos/dll/win32/oleaut32/typelib2.c @@ -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. + * + * 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 ===================================*/ diff --git a/reactos/dll/win32/oleaut32/usrmarshal.c b/reactos/dll/win32/oleaut32/usrmarshal.c index a9a738c2df5..ea5f49e0b2f 100644 --- a/reactos/dll/win32/oleaut32/usrmarshal.c +++ b/reactos/dll/win32/oleaut32/usrmarshal.c @@ -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; +} diff --git a/reactos/dll/win32/oleaut32/varformat.c b/reactos/dll/win32/oleaut32/varformat.c index 83f075f0724..27735fcffdd 100644 --- a/reactos/dll/win32/oleaut32/varformat.c +++ b/reactos/dll/win32/oleaut32/varformat.c @@ -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: diff --git a/reactos/dll/win32/oleaut32/variant.c b/reactos/dll/win32/oleaut32/variant.c index e6191d1c840..5c094e10278 100644 --- a/reactos/dll/win32/oleaut32/variant.c +++ b/reactos/dll/win32/oleaut32/variant.c @@ -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; } /*********************************************************************** diff --git a/reactos/dll/win32/oleaut32/vartype.c b/reactos/dll/win32/oleaut32/vartype.c index daeac853873..5f697c8963a 100644 --- a/reactos/dll/win32/oleaut32/vartype.c +++ b/reactos/dll/win32/oleaut32/vartype.c @@ -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) { diff --git a/reactos/dll/win32/oleaut32/version.rc b/reactos/dll/win32/oleaut32/version.rc index 5a3f1fffafa..6887af389bc 100644 --- a/reactos/dll/win32/oleaut32/version.rc +++ b/reactos/dll/win32/oleaut32/version.rc @@ -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"