diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c index 7421b177aa4..34465ed9776 100644 --- a/dlls/oleaut32/olefont.c +++ b/dlls/oleaut32/olefont.c @@ -306,8 +306,22 @@ HRESULT WINAPI OleCreateFontIndirect( *ppvObj = 0; - if (lpFontDesc == 0) - return NO_ERROR; /* MSDN Oct 2001 */ + if (!lpFontDesc) { + FONTDESC fd; + + WCHAR fname[] = { 'S','y','s','t','e','m',0 }; + + fd.cbSizeofstruct = sizeof(fd); + fd.lpstrName = fname; + fd.cySize.s.Lo = 80000; + fd.cySize.s.Hi = 0; + fd.sWeight = 0; + fd.sCharset = 0; + fd.fItalic = 0; + fd.fUnderline = 0; + fd.fStrikethrough = 0; + lpFontDesc = &fd; + } /* * Try to construct a new instance of the class. @@ -1964,20 +1978,7 @@ static ULONG WINAPI SFCF_Release(LPCLASSFACTORY iface) { static HRESULT WINAPI SFCF_CreateInstance( LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj ) { - FONTDESC fd; - - WCHAR fname[] = { 'S','y','s','t','e','m',0 }; - - fd.cbSizeofstruct = sizeof(fd); - fd.lpstrName = fname; - fd.cySize.s.Lo = 80000; - fd.cySize.s.Hi = 0; - fd.sWeight = 0; - fd.sCharset = 0; - fd.fItalic = 0; - fd.fUnderline = 0; - fd.fStrikethrough = 0; - return OleCreateFontIndirect(&fd,riid,ppobj); + return OleCreateFontIndirect(NULL,riid,ppobj); } diff --git a/dlls/oleaut32/tests/.cvsignore b/dlls/oleaut32/tests/.cvsignore index 1a4e576f969..2e26d1d1090 100644 --- a/dlls/oleaut32/tests/.cvsignore +++ b/dlls/oleaut32/tests/.cvsignore @@ -1,5 +1,6 @@ Makefile oleaut32_test.exe.spec.c +olefont.ok safearray.ok testlist.c vartest.ok diff --git a/dlls/oleaut32/tests/Makefile.in b/dlls/oleaut32/tests/Makefile.in index d6f793f6cee..93c51a171eb 100644 --- a/dlls/oleaut32/tests/Makefile.in +++ b/dlls/oleaut32/tests/Makefile.in @@ -7,6 +7,7 @@ IMPORTS = oleaut32 EXTRALIBS = $(LIBUUID) CTESTS = \ + olefont.c \ safearray.c \ vartest.c diff --git a/dlls/oleaut32/tests/olefont.c b/dlls/oleaut32/tests/olefont.c new file mode 100644 index 00000000000..d01b5175290 --- /dev/null +++ b/dlls/oleaut32/tests/olefont.c @@ -0,0 +1,57 @@ +/* + * OLEFONT test program + * + * Copyright 2003 Marcus Meissner + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + +START_TEST(olefont) +{ + LPVOID pvObj = NULL; + HRESULT hres; + IFont* font = NULL; + + hres = OleCreateFontIndirect(NULL, &IID_IFont, &pvObj); + font = pvObj; + + ok(hres == S_OK,"OCFI (NULL,..) does not return 0, but 0x%08lx",hres); + ok(font != NULL,"OCFI (NULL,..) does return NULL, insytead of !NULL"); + + pvObj = NULL; + hres = IFont_QueryInterface( font, &IID_IFont, &pvObj); + + ok(hres == S_OK,"IFont_QI does not return S_OK, but 0x%08lx", hres); + ok(pvObj != NULL,"IFont_QI does return NULL, instead of a ptr"); +} diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c index 95c30e76c1b..642bad50d8a 100644 --- a/dlls/oleaut32/variant.c +++ b/dlls/oleaut32/variant.c @@ -1539,6 +1539,7 @@ static HRESULT Coerce( VARIANTARG* pd, LCID lcid, ULONG dwFlags, VARIANTARG* ps, case( VT_BOOL ): switch( vtFrom ) { + case( VT_NULL ): case( VT_EMPTY ): res = S_OK; V_UNION(pd,boolVal) = VARIANT_FALSE;