Stdole2 / Stdole32 (RESEND)

Robert Shearman R.J.Shearman at warwick.ac.uk
Fri Jan 31 01:42:36 CST 2003


I guess this one was just lost, so I'm resubmitting:

There are a couple of things to note about this patch.
The first is that this only really provides the stdole2.tlb resource data
since it is just an alias for oleaut32.dll and there can be only one
resource of each type for a given id, so I am not 100% sure at the moment
whether it will work properly for those apps wanting stdole32. The good news
is that I have tested InstallShield v6.10 with this and it works without
having to copy over the two files from Windows.
The second point is that the resource data is not automatically generated at
the moment. I have generated it with mktyplib for the moment, the reasons
for this can be seen at
http://www.winehq.com/hypermail/wine-devel/2003/01/0869.html and there is
one other reason I forgot to mention there. Mktyplib has a number of base
types that MIDL doesn't have like VARIANTs and SCODEs, so the declarations
would have a different signature to the native versions if compiled with
MIDL. The eventual goal is for WIDL to generate the resource data itself and
to facilitate this I have provided the .odl source although nothing is done
with it for the moment.
The third note is that there is a function commented out of the StdFunctions
interface which I am not sure about. The entry id is extracted from the
memberid part of the FUNCDESC structure, which should be the ordinal of the
entry point. I have tried finding out through VB which entry point this
should be but it just gives me a compile error.

Install Notes:

1. Put stdole2.tlb.resource into the dlls/oleaut32 directory
2. touch dlls/oleaut32/stdole32.spec && touch dlls/oleaut32/stdole2.spec

ChangeLog:
- Add standard type library support (stdole32.tlb & stdole2.tlb)

Rob
-------------- next part --------------
Index: dlls/oleaut32/.cvsignore
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/.cvsignore,v
retrieving revision 1.8
diff -u -r1.8 .cvsignore
--- dlls/oleaut32/.cvsignore	12 Dec 2002 22:04:06 -0000	1.8
+++ dlls/oleaut32/.cvsignore	22 Jan 2003 12:02:14 -0000
@@ -5,3 +5,6 @@
 oleaut32.spec.def
 typelib.spec.c
 version.res
+stdole2.spec.c
+stdole32.spec.c
+typelib.res
Index: dlls/oleaut32/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/Makefile.in,v
retrieving revision 1.43
diff -u -r1.43 Makefile.in
--- dlls/oleaut32/Makefile.in	9 Jan 2003 06:04:33 -0000	1.43
+++ dlls/oleaut32/Makefile.in	22 Jan 2003 12:02:14 -0000
@@ -6,7 +6,7 @@
 MODULE    = oleaut32.dll
 IMPORTS   = ole32 user32 gdi32 advapi32 kernel32
 DELAYIMPORTS = comctl32
-ALTNAMES  = ole2disp.dll typelib.dll
+ALTNAMES  = ole2disp.dll typelib.dll stdole32.tlb stdole2.tlb
 EXTRALIBS = $(LIBUNICODE) $(LIBUUID) @GIFLIB@ @JPEGLIB@
 
 LDDLLFLAGS = @LDDLLFLAGS@
@@ -30,7 +30,7 @@
 	ole2disp.c \
 	typelib16.c
 
-RC_SRCS = version.rc
+RC_SRCS = version.rc typelib.rc
 
 SUBDIRS = tests
 
--- /dev/null	Mon Jun 24 01:53:01 2002
+++ dlls/oleaut32/stdole2.odl	Wed Jan 22 10:45:59 2003
@@ -0,0 +1,428 @@
+/*
+ * Copyright (C) 2003 Robert Shearman
+ *
+ * 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
+ *
+ * NOTES
+ * 
+ * This is basically a file with snippets from other files. I have converted
+ * the definitions to the ODL language to make it work with MS mktyplib.exe
+ * I also have a load of typedef's so that we don't include a load of
+ * unnecessary (and unwanted) structures when including wtypes.idl/.h
+ */
+
+#ifndef STDOLE_TLB_VERSION
+#define STDOLE_TLB_VERSION 2
+#endif
+
+[
+  uuid(00020430-0000-0000-C000-000000000046),
+#if (STDOLE_TLB_VERSION == 1)
+  version(1.0),
+#elif (STDOLE_TLB_VERSION == 2)
+  version(2.0),
+#else
+#  error STDOLE_TLB_VERSION must be defined
+#endif
+  helpstring("OLE Automation")
+]
+library stdole
+{
+	/* We have to define these types without including a load of other types */
+	/* typedef's aren't stored in the type library */
+	typedef unsigned long ULONG;
+	typedef unsigned long DWORD;
+	typedef DWORD LCID;
+	typedef DWORD DISPID;
+	typedef unsigned long ULONG_PTR;
+	typedef unsigned short WORD;
+	typedef unsigned int UINT;
+	typedef void ITypeInfo;
+	typedef void * LPCRECT;
+	typedef void * LPSTREAM;
+	typedef wchar_t * LPOLESTR;
+	typedef int HDC;
+	typedef boolean VARIANT_BOOL;
+	typedef boolean BOOL;
+	typedef CURRENCY CY;
+	dispinterface FontEvents; /* forward declaration */
+	
+	/* from guiddef.h */
+	typedef struct _GUID {
+		unsigned long  Data1;
+		unsigned short Data2;
+		unsigned short Data3;
+		unsigned char  Data4[8];
+	} GUID;
+	typedef GUID REFIID;
+
+	/* from oaidl.idl */
+	typedef struct tagDISPPARAMS {
+		VARIANT * rgvarg;
+		long * rgdispidNamedArgs;
+		unsigned int cArgs;
+		unsigned int cNamedArgs;
+	} DISPPARAMS;
+
+	/* from oaidl.idl */
+	typedef struct tagEXCEPINFO {
+		WORD  wCode;
+		WORD  wReserved;
+		BSTR  bstrSource;
+		BSTR  bstrDescription;
+		BSTR  bstrHelpFile;
+		DWORD dwHelpContext;
+		ULONG_PTR pvReserved;
+		ULONG_PTR pfnDeferredFillIn;
+		SCODE scode;
+	} EXCEPINFO;
+
+	/* from unknwn.idl */
+	[
+	  odl,
+	  uuid(00000000-0000-0000-C000-000000000046),
+	]
+	interface IUnknown
+	{
+		HRESULT QueryInterface(
+			[in] REFIID riid,
+			[out] void **ppvObject);
+		ULONG AddRef();
+		ULONG Release();
+	}
+
+	/* from oaidl.idl */
+	[
+		odl,
+		uuid(00020400-0000-0000-C000-000000000046),
+	]
+	interface IDispatch : IUnknown
+	{
+		HRESULT GetTypeInfoCount(
+					[out] UINT *pctinfo);
+
+		HRESULT GetTypeInfo(
+					[in] UINT iTInfo,
+					[in] LCID lcid,
+					[out] ITypeInfo **ppTInfo);
+
+		HRESULT GetIDsOfNames(
+					[in] REFIID riid,
+					[in] LPOLESTR *rgszNames,
+					[in] UINT cNames,
+					[in] LCID lcid,
+					[out] DISPID *rgDispId);
+
+		HRESULT Invoke(
+					[in] DISPID dispIdMember,
+					[in] REFIID riid,
+					[in] LCID lcid,
+					[in] WORD wFlags,
+					[in, out] DISPPARAMS *pDispParams,
+					[out] VARIANT *pVarResult,
+					[out] EXCEPINFO *pExcepInfo,
+					[out] UINT *puArgErr);
+
+	}
+
+	/* from oaidl.idl */
+	[
+		odl,
+		uuid(00020404-0000-0000-C000-000000000046)
+	]
+	interface IEnumVARIANT : IUnknown
+	{
+		HRESULT Next(
+					[in] ULONG celt,
+					[out] VARIANT *rgVar,
+					[out] ULONG *pCeltFetched);
+
+		HRESULT Skip(
+					[in] ULONG celt);
+
+		HRESULT Reset();
+
+		HRESULT Clone(
+					[out] IEnumVARIANT **ppEnum);
+	}
+
+#if (STDOLE_TLB_VERSION > 1)
+	/* from ocidl.idl / olectl.h */
+    typedef [uuid(66504301-BE0F-101A-8BBB-00AA00300CAB), public] DWORD OLE_COLOR;
+	typedef [uuid(66504302-BE0F-101A-8BBB-00AA00300CAB), public] long OLE_XPOS_PIXELS;
+    typedef [uuid(66504303-BE0F-101A-8BBB-00AA00300CAB), public] long OLE_YPOS_PIXELS;
+    typedef [uuid(66504304-BE0F-101A-8BBB-00AA00300CAB), public] long OLE_XSIZE_PIXELS;
+    typedef [uuid(66504305-BE0F-101A-8BBB-00AA00300CAB), public] long OLE_YSIZE_PIXELS;
+    typedef [uuid(66504306-BE0F-101A-8BBB-00AA00300CAB), public] long OLE_XPOS_HIMETRIC;
+    typedef [uuid(66504307-BE0F-101A-8BBB-00AA00300CAB), public] long OLE_YPOS_HIMETRIC;
+    typedef [uuid(66504308-BE0F-101A-8BBB-00AA00300CAB), public] long OLE_XSIZE_HIMETRIC;
+    typedef [uuid(66504309-BE0F-101A-8BBB-00AA00300CAB), public] long OLE_YSIZE_HIMETRIC;
+
+	/* from olectl.h */
+	typedef [uuid(BF030640-9069-101B-AE2D-08002B2EC713), public] float OLE_XPOS_CONTAINER;
+	typedef [uuid(BF030641-9069-101B-AE2D-08002B2EC713), public] float OLE_YPOS_CONTAINER;
+	typedef [uuid(BF030642-9069-101B-AE2D-08002B2EC713), public] float OLE_XSIZE_CONTAINER;
+	typedef [uuid(BF030643-9069-101B-AE2D-08002B2EC713), public] float OLE_YSIZE_CONTAINER;
+
+	/* from ocidl.idl */
+    typedef [uuid(66504313-BE0F-101A-8BBB-00AA00300CAB), public] UINT OLE_HANDLE;
+
+	/* from olectl.h */
+	typedef [uuid(6650430B-BE0F-101A-8BBB-00AA00300CAB), public] VARIANT_BOOL OLE_OPTEXCLUSIVE;
+	typedef [uuid(BF030644-9069-101B-AE2D-08002B2EC713), public] VARIANT_BOOL OLE_CANCELBOOL;
+	typedef [uuid(BF030645-9069-101B-AE2D-08002B2EC713), public] VARIANT_BOOL OLE_ENABLEDEFAULTBOOL;
+
+	/* from ocidl.idl */
+	typedef [uuid(6650430A-BE0F-101A-8BBB-00AA00300CAB)] enum { triUnchecked = 0, triChecked = 1, triGray = 2 } OLE_TRISTATE;
+
+	/* from stdole2.tlb */
+    typedef [uuid(6650430D-BE0F-101A-8BBB-00AA00300CAB), public] BSTR FONTNAME;
+    typedef [uuid(6650430E-BE0F-101A-8BBB-00AA00300CAB), public] CURRENCY FONTSIZE;
+    typedef [uuid(6650430F-BE0F-101A-8BBB-00AA00300CAB), public] VARIANT_BOOL FONTBOLD;
+    typedef [uuid(66504310-BE0F-101A-8BBB-00AA00300CAB), public] VARIANT_BOOL FONTITALIC;
+    typedef [uuid(66504311-BE0F-101A-8BBB-00AA00300CAB), public] VARIANT_BOOL FONTUNDERSCORE;
+    typedef [uuid(66504312-BE0F-101A-8BBB-00AA00300CAB), public] VARIANT_BOOL FONTSTRIKETHROUGH;
+	
+
+	/* from ocidl.idl */	
+	[
+		odl,
+		uuid(BEF6E002-A874-101A-8BBA-00AA00300CAB)
+	]
+	interface IFont : IUnknown
+	{
+		typedef OLE_HANDLE HFONT;
+
+		HRESULT get_Name([out] BSTR *pName);
+
+		HRESULT put_Name([in] BSTR name);
+
+		HRESULT get_Size([out] CY *pSize);
+
+		HRESULT put_Size([in] CY size);
+
+		HRESULT get_Bold([out] BOOL *pBold);
+
+		HRESULT put_Bold([in] BOOL bold);
+
+		HRESULT get_Italic([out] BOOL *pItalic);
+
+		HRESULT put_Italic([in] BOOL italic);
+
+		HRESULT get_Underline([out] BOOL *pUnderline);
+
+		HRESULT put_Underline([in] BOOL underline);
+
+		HRESULT get_Strikethrough([out] BOOL *pStrikethrough);
+
+		HRESULT put_Strikethrough([in] BOOL strikethrough);
+
+		HRESULT get_Weight([out] SHORT *pWeight);
+
+		HRESULT put_Weight([in] SHORT weight);
+
+		HRESULT get_Charset([out] SHORT *pCharset);
+
+		HRESULT put_Charset([in] SHORT charset);
+
+		HRESULT get_hFont([out] HFONT *phFont);
+
+		HRESULT Clone([out] IFont **ppFont);
+
+		HRESULT IsEqual([in] IFont *pFontOther);
+
+		HRESULT SetRatio(
+					[in] LONG cyLogical,
+					[in] LONG cyHimetric);
+
+		/* why is this one not included in the type library? */
+		/* HRESULT QueryTextMetrics([out] TEXTMETRICOLE * pTM); */
+
+		HRESULT AddRefHfont([in] HFONT hFont);
+
+		HRESULT ReleaseHfont([in] HFONT hFont);
+	}
+
+	/* from stdole2.tlb */
+    [
+      uuid(BEF6E003-A874-101A-8BBA-00AA00300CAB)
+    ]
+    dispinterface Font {
+        properties:
+            [id(0)] BSTR Name;
+            [id(2)] CURRENCY Size;
+            [id(3)] VARIANT_BOOL Bold;
+            [id(4)] VARIANT_BOOL Italic;
+            [id(5)] VARIANT_BOOL Underline;
+            [id(6)] VARIANT_BOOL Strikethrough;
+            [id(7)] short Weight;
+            [id(8)] short Charset;
+        methods:
+    };
+    typedef [public] Font IFontDisp;
+
+	/* from stdole2.tlb */	
+    [
+      uuid(0BE35203-8F91-11CE-9DE3-00AA004BB851)
+    ]
+    coclass StdFont {
+        [default] dispinterface Font;
+        [default, source] dispinterface FontEvents;
+        interface IFont;
+    };
+
+	/* from ocidl.idl */
+	[
+		odl,
+		uuid(7BF80980-BF32-101A-8BBB-00AA00300CAB)
+	]
+	interface IPicture : IUnknown
+	{
+		typedef IPicture * LPPICTURE;
+
+		typedef enum tagPictureAttributes {
+			PICTURE_SCALABLE    = 1,
+			PICTURE_TRANSPARENT = 2
+		} PICTUREATTRIBUTES;
+
+		HRESULT get_Handle([out] OLE_HANDLE *pHandle);
+
+		HRESULT get_hPal([out] OLE_HANDLE *phPal);
+
+		HRESULT get_Type([out] SHORT *pType);
+
+		HRESULT get_Width([out] OLE_XSIZE_HIMETRIC *pWidth);
+
+		HRESULT get_Height([out] OLE_YSIZE_HIMETRIC *pHeight);
+
+		HRESULT Render(
+					[in] HDC hDC,
+					[in] LONG x,
+					[in] LONG y,
+					[in] LONG cx,
+					[in] LONG cy,
+					[in] OLE_XPOS_HIMETRIC xSrc,
+					[in] OLE_YPOS_HIMETRIC ySrc,
+					[in] OLE_XSIZE_HIMETRIC cxSrc,
+					[in] OLE_YSIZE_HIMETRIC cySrc,
+					[in] LPCRECT pRcWBounds);
+
+		HRESULT set_hPal([in] OLE_HANDLE hPal);
+
+		HRESULT get_CurDC([out] HDC *phDC);
+
+		HRESULT SelectPicture(
+					[in] HDC hDCIn,
+					[out] HDC * phDCOut,
+					[out] OLE_HANDLE * phBmpOut);
+
+		HRESULT get_KeepOriginalFormat([out] BOOL *pKeep);
+
+		HRESULT put_KeepOriginalFormat([in] BOOL keep);
+
+		HRESULT PictureChanged(void);
+
+		HRESULT SaveAsFile(
+					[in] LPSTREAM pStream,
+					[in] BOOL fSaveMemCopy,
+					[out] LONG * pCbSize);
+
+		HRESULT get_Attributes([out] DWORD *pDwAttr);
+
+		/* this is not in the standard idl definition of this interface */
+		HRESULT SetHdc([in] HDC hDC);
+	}
+
+	/* from stdole2.tlb */	
+    [
+      uuid(7BF80981-BF32-101A-8BBB-00AA00300CAB)
+    ]
+    dispinterface Picture {
+        properties:
+            [id(0), readonly] OLE_HANDLE Handle;
+            [id(2)]           OLE_HANDLE hPal;
+            [id(3), readonly] short Type;
+            [id(4), readonly] OLE_XSIZE_HIMETRIC Width;
+            [id(5), readonly] OLE_YSIZE_HIMETRIC Height;
+        methods:
+            [id(6)]
+            void Render(
+                            int hdc, 
+                            long x, 
+                            long y, 
+                            long cx, 
+                            long cy, 
+                            OLE_XPOS_HIMETRIC xSrc, 
+                            OLE_YPOS_HIMETRIC ySrc, 
+                            OLE_XSIZE_HIMETRIC cxSrc, 
+                            OLE_YSIZE_HIMETRIC cySrc, 
+                            LPCRECT prcWBounds);
+    };
+
+	/* from stdole2.tlb */
+    typedef [public] Picture IPictureDisp;
+
+	/* from stdole2.tlb */
+    [
+      uuid(0BE35204-8F91-11CE-9DE3-00AA004BB851)
+    ]
+    coclass StdPicture {
+        [default] dispinterface Picture;
+        interface IPicture;
+    };
+
+	/* from stdole2.tlb */
+    typedef [uuid(E6C8FA08-BD9F-11D0-985E-00C04FC29993)]
+    enum {
+        Default = 0,
+        Monochrome = 1,
+        VgaColor = 2,
+        Color = 4
+    } LoadPictureConstants;
+
+	/* from stdole2.tlb */
+    [
+      dllname("oleaut32.dll"),
+      uuid(91209AC0-60F6-11CF-9C5D-00AA00C1489E)
+    ]
+    module StdFunctions {
+        [entry("OleLoadPictureFileEx")]
+        HRESULT _stdcall LoadPicture(
+                        [in] VARIANT filename, 
+                        [in] int widthDesired, 
+                        [in] int heightDesired, 
+                        [in] LoadPictureConstants flags, 
+                        [out, retval] IPictureDisp **retval);
+/* not sure what the entry is meant to be - it doesn't work when calling it in VB */
+/*        [entry(0x60000001)]
+        HRESULT _stdcall SavePicture(
+                        [in] IPictureDisp* Picture, 
+                        [in] BSTR filename);*/
+    };
+	
+	/* from stdole2.tlb */	
+    [
+      uuid(4EF6100A-AF88-11D0-9846-00C04FC29993)
+    ]
+    dispinterface FontEvents {
+        properties:
+        methods:
+            [id(9)] void FontChanged([in] BSTR PropertyName);
+    };
+
+	/* from stdole2.tlb */	
+    typedef [public] FontEvents IFontEventsDisp;
+#endif /* STDOLE_TLB_VERSION > 1 */
+};

--- /dev/null	Mon Jun 24 01:53:01 2002
+++ dlls/oleaut32/typelib.rc	Wed Jan 22 10:52:21 2003
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2003 Robert Shearman
+ *
+ * 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
+ */
+
+1 TYPELIB "stdole2.tlb.resource"

-------------- next part --------------
A non-text attachment was scrubbed...
Name: stdole2.tlb.resource
Type: application/octet-stream
Size: 15492 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20030131/6a9c392e/stdole2.tlb.obj


More information about the wine-patches mailing list