Recovery of release 990110 after disk crash.
See Changelog for changes between 990103 and 990110.

diff --git a/include/acconfig.h b/include/acconfig.h
index 35c7acf..19e6bba 100644
--- a/include/acconfig.h
+++ b/include/acconfig.h
@@ -63,6 +63,9 @@
 /* Define if we can use curses (if no ncurses) for full-screen access */
 #undef HAVE_LIBCURSES
 
+/* Define if ncurses have the new resizeterm function */
+#undef HAVE_RESIZETERM
+
 /* Define if we can a compatible xterm program */
 #undef XTERM_PROGRAM
 
diff --git a/include/commctrl.h b/include/commctrl.h
index 00e0953..49c888b 100644
--- a/include/commctrl.h
+++ b/include/commctrl.h
@@ -93,6 +93,7 @@
 
 #define I_IMAGECALLBACK          (-1)
 #define I_INDENTCALLBACK         (-1)
+#define I_CHILDRENCALLBACK       (-1)
 
 
 /* owner drawn types */
@@ -117,6 +118,66 @@
 #define SNDMSG WINELIB_NAME_AW(SendMessage)
 
 
+
+/* Custom Draw messages */
+
+#define CDRF_DODEFAULT          0x0
+#define CDRF_NEWFONT            0x00000002
+#define CDRF_SKIPDEFAULT        0x00000004
+#define CDRF_NOTIFYPOSTPAINT    0x00000010
+#define CDRF_NOTIFYITEMDRAW     0x00000020
+#define CDRF_NOTIFYSUBITEMDRAW  0x00000020
+#define CDRF_NOTIFYPOSTERASE    0x00000040
+/* #define CDRF_NOTIFYITEMERASE    0x00000080          obsolete ? */
+
+
+/* drawstage flags */
+
+#define CDDS_PREPAINT           1
+#define CDDS_POSTPAINT          2
+#define CDDS_PREERASE           3
+#define CDDS_POSTERASE          4
+
+#define CDDS_ITEM				0x00010000
+#define CDDS_ITEMPREPAINT		(CDDS_ITEM | CDDS_PREPAINT)
+#define CDDS_ITEMPOSTPAINT		(CDDS_ITEM | CDDS_POSTPAINT)
+#define CDDS_ITEMPREERASE		(CDDS_ITEM | CDDS_PREERASE)
+#define CDDS_ITEMPOSTERASE		(CDDS_ITEM | CDDS_POSTERASE)
+#define CDDS_SUBITEM            0x00020000
+
+/* itemState flags */
+
+#define CDIS_SELECTED	 	0x0001
+#define CDIS_GRAYED			0x0002
+#define CDIS_DISABLED		0x0004
+#define CDIS_CHECKED		0x0008
+#define CDIS_FOCUS			0x0010
+#define CDIS_DEFAULT		0x0020
+#define CDIS_HOT			0x0040
+#define CDIS_MARKED         0x0080
+#define CDIS_INDETERMINATE  0x0100
+
+
+typedef struct tagNMCUSTOMDRAWINFO
+{
+	NMHDR	hdr;
+	DWORD	dwDrawStage;
+	HDC32	hdc;
+	RECT32	rc;
+	DWORD	dwItemSpec; 
+	UINT32	uItemState;
+	LPARAM	lItemlParam;
+} NMCUSTOMDRAW, *LPNMCUSTOMDRAW;
+
+typedef struct tagNMTTCUSTOMDRAW
+{
+	NMCUSTOMDRAW nmcd;
+	UINT32		 uDrawFlags;
+} NMTTCUSTOMDRAW, *LPNMTTCUSTOMDRAW;
+
+
+
+
 /* StatusWindow */
 
 #define STATUSCLASSNAME16	"msctls_statusbar"
@@ -395,6 +456,28 @@
 #define ImageList_RemoveAll(himl) ImageList_Remove(himl,-1)
 
 
+/* Flat Scrollbar control */
+
+#define FLATSB_CLASS16        "flatsb_class"
+#define FLATSB_CLASS32A       "flatsb_class32"
+#define FLATSB_CLASS32W       L"flatsb_class32"
+#define FLATSB_CLASS          WINELIB_NAME_AW(FLATSB_CLASS)
+
+BOOL32  WINAPI FlatSB_EnableScrollBar(HWND32, INT32, UINT32);
+BOOL32  WINAPI FlatSB_ShowScrollBar(HWND32, INT32, BOOL32);
+BOOL32  WINAPI FlatSB_GetScrollRange(HWND32, INT32, LPINT32, LPINT32);
+BOOL32  WINAPI FlatSB_GetScrollInfo(HWND32, INT32, LPSCROLLINFO);
+INT32   WINAPI FlatSB_GetScrollPos(HWND32, INT32);
+BOOL32  WINAPI FlatSB_GetScrollProp(HWND32, INT32, LPINT32);
+INT32   WINAPI FlatSB_SetScrollPos(HWND32, INT32, INT32, BOOL32);
+INT32   WINAPI FlatSB_SetScrollInfo(HWND32, INT32, LPSCROLLINFO, BOOL32);
+INT32   WINAPI FlatSB_SetScrollRange(HWND32, INT32, INT32, INT32, BOOL32);
+BOOL32  WINAPI FlatSB_SetScrollProp(HWND32, UINT32, INT32, BOOL32);
+BOOL32  WINAPI InitializeFlatSB(HWND32);
+HRESULT WINAPI UninitializeFlatSB(HWND32);
+
+
+
 /* Header control */
 
 #define WC_HEADER16		"SysHeader" 
@@ -2307,9 +2390,15 @@
 #define TCM_GETIMAGELIST        (TCM_FIRST + 2)
 #define TCM_SETIMAGELIST        (TCM_FIRST + 3)
 #define TCM_GETITEMCOUNT	(TCM_FIRST + 4)
-#define TCM_GETITEM             (TCM_FIRST + 5)
-#define TCM_SETITEM             (TCM_FIRST + 6)
-#define	TCM_INSERTITEM		(TCM_FIRST + 7)
+#define TCM_GETITEM				WINELIB_NAME_AW(TCM_GETITEM)
+#define TCM_GETITEM32A			(TCM_FIRST + 5)
+#define TCM_GETITEM32W			(TCM_FIRST + 60)
+#define TCM_SETITEM32A			(TCM_FIRST + 6)
+#define TCM_SETITEM32W			(TCM_FIRST + 61)
+#define TCM_SETITEM				WINELIB_NAME_AW(TCM_SETITEM)
+#define TCM_INSERTITEM32A		(TCM_FIRST + 7)
+#define TCM_INSERTITEM32W		(TCM_FIRST + 62)
+#define TCM_INSERTITEM			WINELIB_NAME_AW(TCM_INSERTITEM)
 #define TCM_DELETEITEM          (TCM_FIRST + 8)
 #define TCM_DELETEALLITEMS      (TCM_FIRST + 9)
 #define TCM_GETITEMRECT         (TCM_FIRST + 10)
@@ -2328,27 +2417,51 @@
 #define TCM_SETCURFOCUS         (TCM_FIRST + 48)
 #define TCM_SETMINTTABWIDTH     (TCM_FIRST + 49)
 #define TCM_DESELECTALL         (TCM_FIRST + 50)
+#define TCM_HIGHLIGHTITEM		(TCM_FIRST + 51)
+#define TCM_SETEXTENDEDSTYLE	(TCM_FIRST + 52)
+#define TCM_GETEXTENDEDSTYLE	(TCM_FIRST + 53)
+#define TCM_SETUNICODEFORMAT	CCM_SETUNICODEFORMAT
+#define TCM_GETUNICODEFORMAT	CCM_GETUNICODEFORMAT
+
 
 #define TCIF_TEXT		0x0001
 #define TCIF_IMAGE		0x0002
 #define TCIF_RTLREADING		0x0004
 #define TCIF_PARAM		0x0008
+#define TCIF_STATE		0x0010
 
-typedef struct tagTCITEM {
+
+typedef struct tagTCITEM32A {
     UINT32 mask;
-    UINT32 lpReserved1;
-    UINT32 lpReserved2;
+    UINT32 dwState;
+    UINT32 dwStateMask;
     LPSTR  pszText;
     int    cchTextMax;
     int    iImage;
     LPARAM lParam;
-} TCITEM, *LPTCITEM;
+} TCITEM32A, *LPTCITEM32A;
+
+typedef struct tagTCITEM32W
+{
+    UINT32 mask;
+    DWORD  dwState;
+    DWORD  dwStateMask;
+    LPWSTR pszText;
+    INT32  cchTextMax;
+    INT32  iImage;
+    LPARAM lParam;
+} TCITEM32W, *LPTCITEM32W;
+
+#define TCITEM   WINELIB_NAME_AW(TCITEM)
+#define LPTCITEM WINELIB_NAME_AW(LPTCITEM)
+
 
 #define TCN_FIRST               (0U-550U)
 #define TCN_LAST                (0U-580U)
 #define TCN_KEYDOWN             (TCN_FIRST - 0)
 #define TCN_SELCHANGE		(TCN_FIRST - 1)
 #define TCN_SELCHANGING         (TCN_FIRST - 2)
+#define TCN_GETOBJECT      (TCN_FIRST - 3)
 
 
 /* ComboBoxEx control */
@@ -2522,6 +2635,36 @@
 #define DATETIMEPICK_CLASS32W	L"SysDateTimePick32"
 #define DATETIMEPICK_CLASS	WINELIB_NAME_AW(DATETIMEPICK_CLASS)
 
+#define DTM_FIRST        0x1000
+
+#define DTM_GETSYSTEMTIME	(DTM_FIRST+1)
+#define DTM_SETSYSTEMTIME	(DTM_FIRST+2)
+#define DTM_GETRANGE		(DTM_FIRST+3)
+#define DTM_SETRANGE		(DTM_FIRST+4)
+#define DTM_SETFORMAT32A	(DTM_FIRST+5)
+#define DTM_SETFORMAT32W	(DTM_FIRST + 50)
+#define DTM_SETFORMAT		WINELIB_NAME_AW(DTM_SETFORMAT)
+#define DTM_SETMCCOLOR		(DTM_FIRST+6)
+#define DTM_GETMCCOLOR		(DTM_FIRST+7)
+
+#define DTM_GETMONTHCAL		(DTM_FIRST+8)
+
+#define DTM_SETMCFONT		(DTM_FIRST+9)
+#define DTM_GETMCFONT		(DTM_FIRST+10)
+
+
+
+
+#define GDT_ERROR    -1
+#define GDT_VALID    0
+#define GDT_NONE     1
+
+#define GDTR_MIN     0x0001
+#define GDTR_MAX     0x0002
+
+
+
+
 
 /**************************************************************************
  *  UNDOCUMENTED functions
@@ -2624,6 +2767,13 @@
 /*
  * Property sheet support (callback procs)
  */
+
+
+#define WC_PROPSHEET32A      "SysPager"
+#define WC_PROPSHEET32W      L"SysPager"
+#define WC_PROPSHEET         WINELIB_NAME_AW(WC_PROPSHEET)
+
+
 struct _PROPSHEETPAGE32A;  /** need to forward declare those structs **/
 struct _PROPSHEETPAGE32W;
 struct _PSP;
diff --git a/include/compobj.h b/include/compobj.h
index ecd57eb..e1b372b 100644
--- a/include/compobj.h
+++ b/include/compobj.h
@@ -1,43 +1,8 @@
-#ifndef COMPOBJ_H
-#define COMPOBJ_H
+#ifndef __WINE_COMPOBJ_H
+#define __WINE_COMPOBJ_H
 
-#include "ole.h"
+/* "compobj.h" is obsolete, you should include "objbase.h" instead */
 
-struct tagGUID
-{
-    DWORD Data1;
-    WORD  Data2;
-    WORD  Data3;
-    BYTE  Data4[8];
-};
+#include "objbase.h"
 
-typedef struct tagGUID	GUID,*LPGUID,*REFGUID;
-typedef struct tagGUID	CLSID,*LPCLSID,*REFCLSID;
-typedef struct tagGUID	IID,*REFIID,*LPIID;
-
-OLESTATUS WINAPI StringFromCLSID16(const CLSID *id, LPOLESTR16*);
-OLESTATUS WINAPI StringFromCLSID32(const CLSID *id, LPOLESTR32*);
-#define StringFromCLSID WINELIB_NAME(StringFromCLSID)
-OLESTATUS WINAPI CLSIDFromString16(LPCOLESTR16, CLSID *);
-OLESTATUS WINAPI CLSIDFromString32(LPCOLESTR32, CLSID *);
-#define CLSIDFromString WINELIB_NAME(CLSIDFromString)
-
-OLESTATUS WINAPI WINE_StringFromCLSID(const CLSID *id, LPSTR);
-
-INT32 WINAPI StringFromGUID2(REFGUID id, LPOLESTR32 str, INT32 cmax);
-
-
-#ifdef INITGUID
-#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
-        const GUID name =\
-	{ l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }
-#else
-#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
-    extern const GUID name
-#endif
-
-#define DEFINE_OLEGUID(name, l, w1, w2) \
-	DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
-
-#define DEFINE_SHLGUID(name, l, w1, w2) DEFINE_OLEGUID(name,l,w1,w2)
-#endif
+#endif /* __WINE_COMPOBJ_H */
diff --git a/include/config.h.in b/include/config.h.in
index 75367e9..9f12234 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -69,6 +69,9 @@
 /* Define if the struct statfs is defined by <sys/mount.h> */
 #undef STATFS_DEFINED_BY_SYS_MOUNT
 
+/* Define if ncurses have the new resizeterm function */
+#undef HAVE_RESIZETERM
+
 /* Define if IPX should use netipx/ipx.h from libc */
 #undef HAVE_IPX_GNU
 
@@ -153,6 +156,9 @@
 /* Define if you have the <sys/cdio.h> header file.  */
 #undef HAVE_SYS_CDIO_H
 
+/* Define if you have the <sys/file.h> header file.  */
+#undef HAVE_SYS_FILE_H
+
 /* Define if you have the <sys/filio.h> header file.  */
 #undef HAVE_SYS_FILIO_H
 
diff --git a/include/d3d.h b/include/d3d.h
index d572933..34e0cac 100644
--- a/include/d3d.h
+++ b/include/d3d.h
@@ -41,6 +41,65 @@
 typedef struct IDirect3DExecuteBuffer IDirect3DExecuteBuffer, *LPDIRECT3DEXECUTEBUFFER;
 
 /* ********************************************************************
+   Error Codes
+   ******************************************************************** */
+#define D3D_OK                          DD_OK
+#define D3DERR_BADMAJORVERSION          MAKE_DDHRESULT(700)
+#define D3DERR_BADMINORVERSION          MAKE_DDHRESULT(701)
+#define D3DERR_INVALID_DEVICE           MAKE_DDHRESULT(705)
+#define D3DERR_INITFAILED               MAKE_DDHRESULT(706)
+#define D3DERR_DEVICEAGGREGATED         MAKE_DDHRESULT(707)
+#define D3DERR_EXECUTE_CREATE_FAILED    MAKE_DDHRESULT(710)
+#define D3DERR_EXECUTE_DESTROY_FAILED   MAKE_DDHRESULT(711)
+#define D3DERR_EXECUTE_LOCK_FAILED      MAKE_DDHRESULT(712)
+#define D3DERR_EXECUTE_UNLOCK_FAILED    MAKE_DDHRESULT(713)
+#define D3DERR_EXECUTE_LOCKED           MAKE_DDHRESULT(714)
+#define D3DERR_EXECUTE_NOT_LOCKED       MAKE_DDHRESULT(715)
+#define D3DERR_EXECUTE_FAILED           MAKE_DDHRESULT(716)
+#define D3DERR_EXECUTE_CLIPPED_FAILED   MAKE_DDHRESULT(717)
+#define D3DERR_TEXTURE_NO_SUPPORT       MAKE_DDHRESULT(720)
+#define D3DERR_TEXTURE_CREATE_FAILED    MAKE_DDHRESULT(721)
+#define D3DERR_TEXTURE_DESTROY_FAILED   MAKE_DDHRESULT(722)
+#define D3DERR_TEXTURE_LOCK_FAILED      MAKE_DDHRESULT(723)
+#define D3DERR_TEXTURE_UNLOCK_FAILED    MAKE_DDHRESULT(724)
+#define D3DERR_TEXTURE_LOAD_FAILED      MAKE_DDHRESULT(725)
+#define D3DERR_TEXTURE_SWAP_FAILED      MAKE_DDHRESULT(726)
+#define D3DERR_TEXTURE_LOCKED           MAKE_DDHRESULT(727)
+#define D3DERR_TEXTURE_NOT_LOCKED       MAKE_DDHRESULT(728)
+#define D3DERR_TEXTURE_GETSURF_FAILED   MAKE_DDHRESULT(729)
+#define D3DERR_MATRIX_CREATE_FAILED     MAKE_DDHRESULT(730)
+#define D3DERR_MATRIX_DESTROY_FAILED    MAKE_DDHRESULT(731)
+#define D3DERR_MATRIX_SETDATA_FAILED    MAKE_DDHRESULT(732)
+#define D3DERR_MATRIX_GETDATA_FAILED    MAKE_DDHRESULT(733)
+#define D3DERR_SETVIEWPORTDATA_FAILED   MAKE_DDHRESULT(734)
+#define D3DERR_INVALIDCURRENTVIEWPORT   MAKE_DDHRESULT(735)
+#define D3DERR_INVALIDPRIMITIVETYPE     MAKE_DDHRESULT(736)
+#define D3DERR_INVALIDVERTEXTYPE        MAKE_DDHRESULT(737)
+#define D3DERR_TEXTURE_BADSIZE          MAKE_DDHRESULT(738)
+#define D3DERR_INVALIDRAMPTEXTURE       MAKE_DDHRESULT(739)
+#define D3DERR_MATERIAL_CREATE_FAILED   MAKE_DDHRESULT(740)
+#define D3DERR_MATERIAL_DESTROY_FAILED  MAKE_DDHRESULT(741)
+#define D3DERR_MATERIAL_SETDATA_FAILED  MAKE_DDHRESULT(742)
+#define D3DERR_MATERIAL_GETDATA_FAILED  MAKE_DDHRESULT(743)
+#define D3DERR_INVALIDPALETTE           MAKE_DDHRESULT(744)
+#define D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY MAKE_DDHRESULT(745)
+#define D3DERR_ZBUFF_NEEDS_VIDEOMEMORY  MAKE_DDHRESULT(746)
+#define D3DERR_SURFACENOTINVIDMEM       MAKE_DDHRESULT(747)
+#define D3DERR_LIGHT_SET_FAILED         MAKE_DDHRESULT(750)
+#define D3DERR_LIGHTHASVIEWPORT         MAKE_DDHRESULT(751)
+#define D3DERR_LIGHTNOTINTHISVIEWPORT   MAKE_DDHRESULT(752)
+#define D3DERR_SCENE_IN_SCENE           MAKE_DDHRESULT(760)
+#define D3DERR_SCENE_NOT_IN_SCENE       MAKE_DDHRESULT(761)
+#define D3DERR_SCENE_BEGIN_FAILED       MAKE_DDHRESULT(762)
+#define D3DERR_SCENE_END_FAILED         MAKE_DDHRESULT(763)
+#define D3DERR_INBEGIN                  MAKE_DDHRESULT(770)
+#define D3DERR_NOTINBEGIN               MAKE_DDHRESULT(771)
+#define D3DERR_NOVIEWPORTS              MAKE_DDHRESULT(772)
+#define D3DERR_VIEWPORTDATANOTSET       MAKE_DDHRESULT(773)
+#define D3DERR_VIEWPORTHASNODEVICE      MAKE_DDHRESULT(774)
+#define D3DERR_NOCURRENTVIEWPORT        MAKE_DDHRESULT(775)
+
+/* ********************************************************************
    Enums
    ******************************************************************** */
 #define D3DNEXT_NEXT 0x01l
@@ -1202,7 +1261,12 @@
 struct IDirect3DTexture2 {
   LPDIRECT3DTEXTURE2_VTABLE  lpvtbl;
   DWORD                      ref;
-  
+
+  void *D3Ddevice; /* I put (void *) to use the same pointer for both
+		      Direct3D and Direct3D2 */
+#ifdef HAVE_MESAGL
+  GLuint tex_name;
+#endif  
   LPDIRECTDRAWSURFACE3       surface;
 };
 
diff --git a/include/ddraw.h b/include/ddraw.h
index 4b5e917..fdb74dc 100644
--- a/include/ddraw.h
+++ b/include/ddraw.h
@@ -1,6 +1,8 @@
 #ifndef __WINE_DDRAW_H
 #define __WINE_DDRAW_H
 
+#include "wine/obj_base.h"
+
 #include "config.h"
 
 #ifndef X_DISPLAY_MISSING
@@ -14,7 +16,6 @@
 #define	DIRECTDRAW_VERSION	0x0500
 #endif /* DIRECTDRAW_VERSION */
 
-
 DEFINE_GUID( CLSID_DirectDraw,		0xD7B70EE0,0x4340,0x11CF,0xB0,0x63,0x00,0x20,0xAF,0xC2,0xCD,0x35 );
 DEFINE_GUID( CLSID_DirectDrawClipper,	0x593817A0,0x7DB3,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xb9,0x33,0x56 );
 DEFINE_GUID( IID_IDirectDraw,		0x6C14DB80,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 );
@@ -900,6 +901,7 @@
        We need it also in DGA mode to make some games (for example Monkey Island III work) */
     ATOM		winclass;
     HWND32		window;
+    Window		drawable;
     PAINTSTRUCT32	ps;
 };
 
@@ -910,7 +912,6 @@
 };
 
 struct _xlib_directdrawdata {
-    Window		drawable;
     int			paintable;
 
 #ifdef HAVE_LIBXXSHM
diff --git a/include/debug.h b/include/debug.h
index f5e6447..8d0ea7a 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -101,57 +101,58 @@
 #define dbch_profile 93
 #define dbch_progress 94
 #define dbch_prop 95
-#define dbch_psapi 96
-#define dbch_psdrv 97
-#define dbch_ras 98
-#define dbch_rebar 99
-#define dbch_reg 100
-#define dbch_region 101
-#define dbch_relay 102
-#define dbch_resource 103
-#define dbch_scroll 104
-#define dbch_security 105
-#define dbch_segment 106
-#define dbch_selector 107
-#define dbch_sem 108
-#define dbch_sendmsg 109
-#define dbch_server 110
-#define dbch_shell 111
-#define dbch_shm 112
-#define dbch_snoop 113
-#define dbch_sound 114
-#define dbch_static 115
-#define dbch_statusbar 116
-#define dbch_stress 117
-#define dbch_string 118
-#define dbch_syscolor 119
-#define dbch_system 120
-#define dbch_tab 121
-#define dbch_task 122
-#define dbch_text 123
-#define dbch_thread 124
-#define dbch_thunk 125
-#define dbch_timer 126
-#define dbch_toolbar 127
-#define dbch_toolhelp 128
-#define dbch_tooltips 129
-#define dbch_trackbar 130
-#define dbch_treeview 131
-#define dbch_tweak 132
-#define dbch_uitools 133
-#define dbch_updown 134
-#define dbch_ver 135
-#define dbch_virtual 136
-#define dbch_vxd 137
-#define dbch_wave 138
-#define dbch_win 139
-#define dbch_win16drv 140
-#define dbch_win32 141
-#define dbch_wing 142
-#define dbch_winsock 143
-#define dbch_wnet 144
-#define dbch_x11 145
-#define dbch_x11drv 146
+#define dbch_propsheet 96
+#define dbch_psapi 97
+#define dbch_psdrv 98
+#define dbch_ras 99
+#define dbch_rebar 100
+#define dbch_reg 101
+#define dbch_region 102
+#define dbch_relay 103
+#define dbch_resource 104
+#define dbch_scroll 105
+#define dbch_security 106
+#define dbch_segment 107
+#define dbch_selector 108
+#define dbch_sem 109
+#define dbch_sendmsg 110
+#define dbch_server 111
+#define dbch_shell 112
+#define dbch_shm 113
+#define dbch_snoop 114
+#define dbch_sound 115
+#define dbch_static 116
+#define dbch_statusbar 117
+#define dbch_stress 118
+#define dbch_string 119
+#define dbch_syscolor 120
+#define dbch_system 121
+#define dbch_tab 122
+#define dbch_task 123
+#define dbch_text 124
+#define dbch_thread 125
+#define dbch_thunk 126
+#define dbch_timer 127
+#define dbch_toolbar 128
+#define dbch_toolhelp 129
+#define dbch_tooltips 130
+#define dbch_trackbar 131
+#define dbch_treeview 132
+#define dbch_tweak 133
+#define dbch_uitools 134
+#define dbch_updown 135
+#define dbch_ver 136
+#define dbch_virtual 137
+#define dbch_vxd 138
+#define dbch_wave 139
+#define dbch_win 140
+#define dbch_win16drv 141
+#define dbch_win32 142
+#define dbch_wing 143
+#define dbch_winsock 144
+#define dbch_wnet 145
+#define dbch_x11 146
+#define dbch_x11drv 147
 /* Definitions for classes identifiers */
 #define dbcl_fixme 0
 #define dbcl_err 1
diff --git a/include/debugdefs.h b/include/debugdefs.h
index ea469b5..cd1a472 100644
--- a/include/debugdefs.h
+++ b/include/debugdefs.h
@@ -4,7 +4,7 @@
 #include "debugtools.h"
 #endif
 
-#define DEBUG_CHANNEL_COUNT 147
+#define DEBUG_CHANNEL_COUNT 148
 #ifdef DEBUG_RUNTIME
 short debug_msg_enabled[][DEBUG_CLASS_COUNT] = {
 {1, 1, 0, 0},
@@ -154,6 +154,7 @@
 {1, 1, 0, 0},
 {1, 1, 0, 0},
 {1, 1, 0, 0},
+{1, 1, 0, 0},
 };
 const char* debug_ch_name[] = {
 "accel",
@@ -252,6 +253,7 @@
 "profile",
 "progress",
 "prop",
+"propsheet",
 "psapi",
 "psdrv",
 "ras",
diff --git a/include/dinput.h b/include/dinput.h
index 03978e2..0bf86c3 100644
--- a/include/dinput.h
+++ b/include/dinput.h
@@ -1,6 +1,8 @@
 #ifndef _WINE_DINPUT_H
 #define _WINE_DINPUT_H
 
+#include "unknwn.h"
+
 #define STDMETHOD(xfn) HRESULT (CALLBACK *fn##xfn)
 #define STDMETHOD_(ret,xfn) ret (CALLBACK *fn##xfn)
 #define PURE
diff --git a/include/dosexe.h b/include/dosexe.h
index 4f5c16b..530cdd7 100644
--- a/include/dosexe.h
+++ b/include/dosexe.h
@@ -51,5 +51,7 @@
 extern HINSTANCE16 MZ_CreateProcess( LPCSTR name, LPCSTR cmdline, LPCSTR env, BOOL32 inherit,
                                      LPSTARTUPINFO32A startup, LPPROCESS_INFORMATION info );
 extern int DOSVM_Enter( PCONTEXT context );
+extern void DOSVM_SetTimer( unsigned ticks );
+extern unsigned DOSVM_GetTimer( void );
 
 #endif /* __WINE_DOSEXE_H */
diff --git a/include/dplay.h b/include/dplay.h
index fd9552e..d6d5506 100644
--- a/include/dplay.h
+++ b/include/dplay.h
@@ -2,6 +2,8 @@
 #ifndef __WINE_DPLAY_H
 #define __WINE_DPLAY_H
 
+#include "unknwn.h"
+
 #pragma pack(1)
 
 /* Return Values for Direct Play */
diff --git a/include/dsound.h b/include/dsound.h
index 2b2bcca..e944fab 100644
--- a/include/dsound.h
+++ b/include/dsound.h
@@ -3,7 +3,6 @@
 
 #include "windows.h"
 #include "winbase.h"
-#include "compobj.h"
 #include "mmsystem.h"
 #include "d3d.h"			/*FIXME: Need to break out d3dtypes.h */
 
diff --git a/include/flatsb.h b/include/flatsb.h
new file mode 100644
index 0000000..2103ada
--- /dev/null
+++ b/include/flatsb.h
@@ -0,0 +1,20 @@
+/*
+ * Date and time picker class extra info
+ *
+ * Copyright 1998 Eric Kohl
+ */
+
+#ifndef __WINE_FLATSB_H
+#define __WINE_FLATSB_H
+
+typedef struct tagFLATSB_INFO
+{
+    DWORD dwDummy;  /* just to keep the compiler happy ;-) */
+
+} FLATSB_INFO, *LPFLATSB_INFO;
+
+
+extern VOID FLATSB_Register (VOID);
+extern VOID FLATSB_Unregister (VOID);
+
+#endif  /* __WINE_FLATSB_H */
diff --git a/include/interfaces.h b/include/interfaces.h
index 26f28d5..a7621f6 100644
--- a/include/interfaces.h
+++ b/include/interfaces.h
@@ -48,7 +48,6 @@
 #include "objbase.h"
 
 #define THIS LPCLASSFACTORY this
-typedef struct IClassFactory *LPCLASSFACTORY,IClassFactory;
 typedef struct {
 	STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID FAR* ppvObj) PURE;
 	STDMETHOD_(ULONG,AddRef) (THIS) PURE;
@@ -57,14 +56,9 @@
 	STDMETHOD(LockServer) (THIS_ BOOL32) PURE;
 } *LPCLASSFACTORY_VTABLE,IClassFactory_VTable;
 
-struct IClassFactory {
-	LPCLASSFACTORY_VTABLE	lpvtbl;
-	DWORD			ref;
-};
 #undef THIS
 
 #define THIS LPMALLOC32 this
-typedef struct IMalloc32 *LPMALLOC32,IMalloc32;
 typedef struct {
 	STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID FAR* ppvObj) PURE;
 	STDMETHOD_(ULONG,AddRef) (THIS) PURE;
@@ -78,14 +72,9 @@
 	STDMETHOD_(LPVOID,HeapMinimize) ( THIS );
 } *LPMALLOC32_VTABLE,IMalloc32_VTable;
 
-struct IMalloc32 {
-	LPMALLOC32_VTABLE	lpvtbl;
-	DWORD			ref;
-};
 #undef THIS
 
 #define THIS LPMALLOC16 this
-typedef struct IMalloc16 *LPMALLOC16,IMalloc16;
 typedef struct {
 	STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID FAR* ppvObj) PURE;
 	STDMETHOD_(ULONG,AddRef) (THIS) PURE;
@@ -99,14 +88,6 @@
 	STDMETHOD_(LPVOID,HeapMinimize) ( THIS );
 } *LPMALLOC16_VTABLE,IMalloc16_VTable;
 
-struct IMalloc16 {
-	LPMALLOC16_VTABLE	lpvtbl;
-	DWORD			ref;
-	/* Gmm, I think one is not enough, we should probably manage a list of
-	 * heaps
-	 */
-	HGLOBAL16		heap;
-};
 #undef THIS
 
 /* private prototypes for the constructors */
diff --git a/include/main.h b/include/main.h
index dc0762a..8e4af75 100644
--- a/include/main.h
+++ b/include/main.h
@@ -12,6 +12,9 @@
 extern int MAIN_GetLanguageID(char*lang, char*country, char*charset, char*dialect);
 
 extern BOOL32 RELAY_Init(void);
+extern int RELAY_ShowDebugmsgRelay(const char *func);
 extern void* CALL32_Init(void);
 
+extern BOOL32 THUNK_Init(void);
+
 #endif  /* __WINE_MAIN_H */
diff --git a/include/miscemu.h b/include/miscemu.h
index 9b2598b..558f841 100644
--- a/include/miscemu.h
+++ b/include/miscemu.h
@@ -11,7 +11,10 @@
 #include "winnt.h"
 #include "ldt.h"
 
-  /* msdos/dosmem.c */
+/* msdos/dosconf.c */
+extern int DOSCONF_ReadConfig(void);
+
+/* msdos/dosmem.c */
 extern HANDLE16 DOSMEM_BiosSeg;
 extern DWORD DOSMEM_CollateTable;
 
diff --git a/include/msdos.h b/include/msdos.h
index dccb072..ca68cf2 100644
--- a/include/msdos.h
+++ b/include/msdos.h
@@ -196,4 +196,25 @@
 void do_mscdex( CONTEXT *context );
 void do_mscdex_dd (CONTEXT * context, int dorealmode);
 
+#define DOSCONF_MEM_HIGH        0x0001
+#define DOSCONF_MEM_UMB         0x0002
+#define DOSCONF_NUMLOCK         0x0004
+#define DOSCONF_KEYB_CONV       0x0008
+
+typedef struct {
+        char lastdrive;
+        int brk_flag;
+        int files;
+        int stacks_nr;
+        int stacks_sz;
+        int buf;
+        int buf2;
+        int fcbs;
+        int flags;
+        char *shell;
+        char *country;
+} DOSCONF;
+
+extern DOSCONF DOSCONF_config;
+
 #endif /* __WINE_MSDOS_H */
diff --git a/include/multimedia.h b/include/multimedia.h
index 4d97843..11ac6a4 100644
--- a/include/multimedia.h
+++ b/include/multimedia.h
@@ -58,8 +58,8 @@
 extern UINT16 		MCI_NextDevID(UINT16 wDevID);
 extern BOOL32 		MCI_DevIDValid(UINT16 wDevID);
 
-extern int			MCI_MapMsg16To32A(WORD uDevType, WORD wMsg, DWORD* lParam);
-extern int			MCI_UnMapMsg16To32A(WORD uDevTyp, WORD wMsg, DWORD lParam);
+extern int		MCI_MapMsg16To32A(WORD uDevType, WORD wMsg, DWORD* lParam);
+extern int		MCI_UnMapMsg16To32A(WORD uDevTyp, WORD wMsg, DWORD lParam);
 
 typedef LONG		(*MCIPROC16)(DWORD, HDRVR16,  WORD, DWORD, DWORD);
 typedef LONG		(*MCIPROC32)(DWORD, HDRVR16, DWORD, DWORD, DWORD);
@@ -69,7 +69,9 @@
 extern DWORD		MCI_WriteString(LPSTR lpDstStr, DWORD dstSize, LPCSTR lpSrcStr);
 extern const char* MCI_CommandToString(UINT16 wMsg);
 
-extern DWORD		MCI_SendCommandAsync32(UINT32 wDevID, UINT32 wMsg, DWORD dwParam1, DWORD dwParam2);
+
+extern DWORD MCI_SendCommand32(UINT32 wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2);
+extern DWORD MCI_SendCommandAsync32(UINT32 wDevID, UINT32 wMsg, DWORD dwParam1, DWORD dwParam2);
 
 LONG MCIWAVE_DriverProc32(DWORD dwDevID, HDRVR16 hDriv, DWORD wMsg, 
 			  DWORD dwParam1, DWORD dwParam2);
diff --git a/include/objbase.h b/include/objbase.h
index f7c5697..38a540c 100644
--- a/include/objbase.h
+++ b/include/objbase.h
@@ -2,467 +2,115 @@
 #define __WINE_OBJBASE_H
 
 
-/*
- * The goal of the following set of definitions is to provide a way to use the same 
- * header file definitions to provide both a C interface and a C++ object oriented 
- * interface to COM interfaces. The type of interface is selected automatically 
- * depending on the language but it is always possible to get the C interface in C++ 
- * by defining CINTERFACE.
- *
- * It is based on the following assumptions:
- *  - all COM interfaces derive from IUnknown, this should not be a problem.
- *  - the header file only defines the interface, the actual fields are defined 
- *    separately in the C file implementing the interface.
- *  - no COM method returns void. This seems to be the case but otherwise we could support this 
- *    case by having one more set of macros.
- *
- * The natural approach to this problem would be to make sure we get a C++ class and 
- * virtual methods in C++ and a structure with a table of pointer to functions in C.
- * Unfortunately the layout of the virtual table is compiler specific, the layout of 
- * g++ virtual tables is not the same as that of an egcs virtual table which is not the 
- * same as that generated by Visual C+. There are workarounds to make the virtual tables 
- * compatible via padding but unfortunately the one which is imposed to the WINE emulator
- * by the Windows binaries, i.e. the Visual C++ one, is the most compact of all.
- *
- * So the solution I finally adopted does not use virtual tables. Instead I use inline 
- * non virtual methods that dereference the method pointer themselves and perform the call.
- *
- * Let's take Direct3D as an example:
- *
- *    #define ICOM_INTERFACE IDirect3D
- *    ICOM_BEGIN(IDirect3D,IUnknown)
- *        ICOM_METHOD1(HRESULT,Initialize,    REFIID,);
- *        ICOM_METHOD2(HRESULT,EnumDevices,   LPD3DENUMDEVICESCALLBACK,, LPVOID,);
- *        ICOM_METHOD2(HRESULT,CreateLight,   LPDIRECT3DLIGHT*,, IUnknown*,);
- *        ICOM_METHOD2(HRESULT,CreateMaterial,LPDIRECT3DMATERIAL*,, IUnknown*,);
- *        ICOM_METHOD2(HRESULT,CreateViewport,LPDIRECT3DVIEWPORT*,, IUnknown*,);
- *        ICOM_METHOD2(HRESULT,FindDevice,    LPD3DFINDDEVICESEARCH,, LPD3DFINDDEVICERESULT,);
- *    ICOM_END(IDirect3D)
- *    #undef ICOM_INTERFACE
- *
- *    #if !defined(__cplusplus) || defined(CINTERFACE)
- *    // *** IUnknown methods *** //
- *    #define IDirect3D_QueryInterface(p,a,b) ICOM_ICALL2(IUnknown,QueryInterface,p,a,b)
- *    #define IDirect3D_AddRef(p)             ICOM_ICALL (IUnknown,AddRef,p)
- *    #define IDirect3D_Release(p)            ICOM_ICALL (IUnknown,Release,p)
- *    // *** IDirect3D methods *** //
- *    #define IDirect3D_Initialize(p,a)       ICOM_CALL1(Initialize,p,a)
- *    #define IDirect3D_EnumDevices(p,a,b)    ICOM_CALL2(EnumDevice,p,a,b)
- *    #define IDirect3D_CreateLight(p,a,b)    ICOM_CALL2(CreateLight,p,a,b)
- *    #define IDirect3D_CreateMaterial(p,a,b) ICOM_CALL2(CreateMaterial,p,a,b)
- *    #define IDirect3D_CreateViewport(p,a,b) ICOM_CALL2(CreateViewport,p,a,b)
- *    #define IDirect3D_FindDevice(p,a,b)     ICOM_CALL2(FindDevice,p,a,b)
- *    #endif
- *
- * Comments:
- *  - The ICOM_INTERFACE is used in the ICOM_METHOD macros for the 'this' pointer and to cast 
- *    pointers. Defining this macro here saves us the trouble of having to repeat the interface 
- *    name everywhere. Note haowever that because of the way macros work a macro like ICOM_METHOD1 
- *    cannot use 'ICOM_INTERFACE##_VTABLE' because this would give 'ICOM_INTERFACE_VTABLE' and not 
- *    'IDirect3D_VTABLE'.
- *  - ICOM_BEGIN and ICOM_END are responsible for generating whatever structure is appropriate for 
- *    representing the interface in the current language. In C this is a couple of structs in C++ 
- *    it's a class. The first parameter is the interface name and the second one is the interface 
- *    we inherit from. The reason why you have to repeat the interface name is because that's the 
- *    only way these macro can successfully output "IDirect3D_VTABLE'. Trying to use ICOM_INTERFACE 
- *    would, as in ICOM_METHOD, only yield 'ICOM_INTERFACE_VTABLE'.
- *  - With the way ICOM_BEGIN works you don't have to repeat the definitions of the methods of the 
- *    parent interface. They are automatically inherited both in C and in C++.
- *  - In C++ the ICOM_METHOD macros generate a function prototype and a call to a function pointer 
- *    method. This means using once 't1 p1, t2 p2, ...' and once 'p1, p2' without the types. The 
- *    only way I found to handle this is to have one ICOM_METHOD macro per number of parameters and 
- *    to have it take only the type information (with const if necessary) as parameters.
- *    The 'undef ICOM_INTERFACE' is here to remind you that using ICOM_INTERFACE in the following 
- *    macros will not work. This time it's because the ICOM_CALL macro expansion is done only once 
- *    the 'IDirect3D_Xxx' macro is expanded. And by that time ICOM_INTERFACE will be long gone 
- *    anyway.
- *  - You may have noticed the double commas after each parameter type. This allows you to put the 
- *    name of that parameter which I think is good for documentation. It is not required and since 
- *    I did not know what to put there for this example (I could only find doc about IDirect3D2), 
- *    I left them blank.
- *  - Finally the set of 'IDirect3D_Xxx' macros is a standard set of macros defined to ease access 
- *    to the interface methods in C. Unfortunately I don't see any way to avoid having to duplicate 
- *    the inherited method definitions there. We must use ICOM_ICALL to invoke inherited methods, 
- *    because in C we have to cast the virtual table pointer, and we should use the ICOM_CALL 
- *    method in the other cases. This time I could have used a trick to use only one macro whatever 
- *    the number of parameters but I prefered to have it work the same way as above.
- *  - You probably have noticed that we don't define the fields we need to actually implement this 
- *    interface: reference count, pointer to other resources and miscellaneous fields. That's 
- *    because it's not needed, and the user will anyway only manipulate pointers to this structure
- *    so he does not need to know its real size. Of course on the implementation side we have the 
- *    real definition of the interface structure and they should match what the macros yield in 
- *    each language (or conversely).
- *
- *
- * In C this gives:
- *    typedef struct IDirect3D_VTABLE IDirect3D_VTABLE;
- *    struct IDirect3D {
- *        IDirect3D_VTABLE* lpvtbl;
- *    };
- *    struct IDirect3D_VTABLE {
- *        IUnknown_VTABLE bvt;
- *        HRESULT (*fnInitialize)(IDirect3D* me, REFIID a);
- *        HRESULT (*fnEnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b);
- *        HRESULT (*fnCreateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b);
- *        HRESULT (*fnCreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b);
- *        HRESULT (*fnCreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b);
- *        HRESULT (*fnFindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b);
- *    }; 
- *
- *    #if !defined(__cplusplus) || defined(CINTERFACE)
- *    // *** IUnknown methods *** //
- *    #define IDirect3D_QueryInterface(p,a,b) ((IUnknown_VTABLE*)(p)->lpvtbl)->fnQueryInterface((IUnknown*)p,a,b)
- *    #define IDirect3D_AddRef(p)             ((IUnknown_VTABLE*)(p)->lpvtbl)->fnAddRef((IUnknown*)p)
- *    #define IDirect3D_Release(p)            ((IUnknown_VTABLE*)(p)->lpvtbl)->fnRelease((IUnknown*)p)
- *    // *** IDirect3D methods *** //
- *    #define IDirect3D_Initialize(p,a)       (p)->lpvtbl->fnInitialize(p,a)
- *    #define IDirect3D_EnumDevices(p,a,b)    (p)->lpvtbl->fnEnumDevice(p,a,b)
- *    #define IDirect3D_CreateLight(p,a,b)    (p)->lpvtbl->fnCreateLight(p,a,b)
- *    #define IDirect3D_CreateMaterial(p,a,b) (p)->lpvtbl->fnCreateMaterial(p,a,b)
- *    #define IDirect3D_CreateViewport(p,a,b) (p)->lpvtbl->fnCreateViewport(p,a,b)
- *    #define IDirect3D_FindDevice(p,a,b)     (p)->lpvtbl->fnFindDevice(p,a,b)
- *    #endif
- *
- * Comments:
- *  - IDirect3D only contains a pointer to the IDirect3D virtual/jump table. This is the only thing 
- *    the user needs to know to use the interface. Of course the structure we will define to 
- *    implement this interface will have more fields but the first one will match this pointer.
- *  - The code generated by ICOM_BEGIN goes up to the bvt field in the IDirect3D virtual table. 
- *    This bvt field is what saves us from having to duplicate the inherited method definitions.
- *    It's a shame that C (gcc) will not allow unnamed structs. If this was possible we could 
- *    seamlessly inherit and use the parent's interface function pointers.
- *  - What follows is just a bunch of function pointer definitions generated by the ICOM_METHOD 
- *    macros. The implementation will fill this jump table with appropriate values in a static 
- *    variable and initialize the lpvtbl field to point to this variable.
- *  - The IDirect3D_Xxx macros then just derefence the lpvtbl pointer and use the function pointer 
- *    corresponding to the macro name. This emulates the behavior of a virtual table and should be 
- *    about as fast. In the case of inherited methods we have some additional casting to do to 
- *    because the inherited methods are defined in the bvt field or maybe further imbricated. Since 
- *    the effect of the bvt field is that we inherit the parent virtual table fields this cast is 
- *    relatively inocuous. A similar cast must be performed on the interface pointer before the 
- *    invoked method will accept it. Despite all these casts there is little chance that you call a 
- *    method on the wrong type of interface because the function names still have to match. But this 
- *    is the only thing that will make the compilation fail.
- *
- *
- * And in C++ (with gcc's g++):
- *
- *    typedef struct IDirect3D: public IUnknown {
- *        private: HRESULT (*fnInitialize)(IDirect3D* me, REFIID a);
- *        public: inline HRESULT Initialize(REFIID a) { return ((IDirect3D*)t.lpvtbl)->fnInitialize(this,a); };
- *        private: HRESULT (*fnEnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b);
- *        public: inline HRESULT EnumDevices(LPD3DENUMDEVICESCALLBACK a, LPVOID b)
- *            { return ((IDirect3D*)t.lpvtbl)->fnEnumDevices(this,a,b); };
- *        private: HRESULT (*fnCreateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b);
- *        public: inline HRESULT CreateLight(LPDIRECT3DLIGHT* a, IUnknown* b)
- *            { return ((IDirect3D*)t.lpvtbl)->fnCreateLight(this,a,b); };
- *        private: HRESULT (*fnCreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b);
- *        public: inline HRESULT CreateMaterial(LPDIRECT3DMATERIAL* a, IUnknown* b)
- *            { return ((IDirect3D*)t.lpvtbl)->fnCreateMaterial(this,a,b); };
- *        private: HRESULT (*fnCreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b);
- *        public: inline HRESULT CreateViewport(LPDIRECT3DVIEWPORT* a, IUnknown* b)
- *            { return ((IDirect3D*)t.lpvtbl)->fnCreateViewport(this,a,b); };
- *        private:  HRESULT (*fnFindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b);
- *        public: inline HRESULT FindDevice(LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b)
- *            { return ((IDirect3D*)t.lpvtbl)->fnFindDevice(this,a,b); };
- *    }; 
- *
- * Comments:
- *  - In C++ IDirect3D does double duty as both the virtual/jump table and as the interface 
- *    definition. The reason for this is to avoid having to duplicate the mehod definitions: once 
- *    to have the function pointers in the jump table and once to have the methods in the interface 
- *    class. Here one macro can generate both. This means though that the first pointer, t.lpvtbl 
- *    defined in IUnknown,  must be interpreted as the jump table pointer if we interpret the 
- *    structure as the the interface class, and as the function pointer to the QueryInterface 
- *    method, t.fnQueryInterface, if we interpret the structure as the jump table. Fortunately this 
- *    gymnastic is entirely taken care of in the header of IUnknown.
- *  - Of course in C++ we use inheritance so that we don't have to duplicate the method definitions. 
- *  - Since IDirect3D does double duty, each ICOM_METHOD macro defines both a function pointer and 
- *    a non-vritual inline method which dereferences it and calls it. This way this method behaves 
- *    just like a virtual method but does not create a true C++ virtual table which would break the 
- *    structure layout. If you look at the implementation of these methods you'll notice that they 
- *    would not work for void functions. We have to return something and fortunately this seems to 
- *    be what all the COM methods do (otherwise we would need another set of macros).
- *  - Note how the ICOM_METHOD generates both function prototypes mixing types and formal parameter 
- *    names and the method invocation using only the formal parameter name. This is the reason why 
- *    we need different macros to handle different numbers of parameters.
- *  - Finally there is no IDirect3D_Xxx macro. These are not needed in C++ unless the CINTERFACE 
- *    macro is defined in which case we would not be here.
- *
- *
- * Implementing a COM interface.
- *
- * This continues the above example.I assume the implementation is in C but it would probably 
- * be similar in C++.
- *
- *    typedef struct _IDirect3D {
- *        void* lpvtbl;
- *        // ...
- *
- *    } _IDirect3D;
- *
- *    static ICOM_VTABLE(IDirect3D) d3dvt;
- *
- *    // implement the IDirect3D methods here
- *
- *    int IDirect3D_fnQueryInterface(LPUNKNOWN me)
- *    {
- *        ICOM_THIS(IDirect3D,me);
- *        // ...
- *    }
- *
- *    // ...
- *
- *    static ICOM_VTABLE(IDirect3D) d3dvt = {
- *        {
- *            IDirect3D_fnQueryInterface,
- *            IUnknown_fnAdd,
- *            IUnknown_fnAdd2
- *        },
- *        IDirect3D_fnInitialize,
- *        IDirect3D_fnSetWidth
- *    };
- *
- * Comments:
- *  - We first define what the interface really contains. This is th e_IDirect3D structure. The 
- *    first field must of course be the virtual table pointer. Everything else is free.
- *  - Then we predeclare our static virtual table variable, we will need its address in some 
- *    methods to initialize the virtual table pointer of the returned interface objects.
- *  - Then we implement the interface methods. To match what has been declared in the header file 
- *    they must take a pointer to a IDirect3D structure so we must cast it to an _IDirect3D so that 
- *    we can manipulate the fields. This is performed by the ICOM_THIS macro.
- *  - Finally we initialize the virtual table. The inherited methods must be in curly brackets to 
- *    match the parent interface's virtual table definition.
+#include "wine/obj_base.h"
+
+/* the following depend only on obj_base.h */
+#include "wine/obj_misc.h"
+#include "wine/obj_channel.h"
+#include "wine/obj_clientserver.h"
+#include "wine/obj_marshal.h"
+#include "wine/obj_storage.h"
+
+/* the following depend on obj_storage.h */
+#include "wine/obj_moniker.h"
+#include "wine/obj_propertystorage.h"
+
+/* the following depend on obj_moniker.h */
+#include "wine/obj_dataobject.h"
+
+/* FIXME: the following should be moved to one of the wine/obj_XXX.h headers */
+
+/*****************************************************************************
+ * CoXXX API
+ */
+/* FIXME: more CoXXX functions are missing */
+DWORD WINAPI CoBuildVersion(void);
+
+typedef enum tagCOINIT
+{
+    COINIT_APARTMENTTHREADED  = 0x2, /* Apartment model */
+    COINIT_MULTITHREADED      = 0x0, /* OLE calls objects on any thread */
+    COINIT_DISABLE_OLE1DDE    = 0x4, /* Don't use DDE for Ole1 support */
+    COINIT_SPEED_OVER_MEMORY  = 0x8  /* Trade memory for speed */
+} COINIT;
+
+HRESULT WINAPI CoInitialize16(LPVOID lpReserved);
+HRESULT WINAPI CoInitialize32(LPVOID lpReserved);
+#define CoInitialize WINELIB_NAME(CoInitialize)
+
+HRESULT WINAPI CoInitializeEx32(LPVOID lpReserved, DWORD dwCoInit);
+#define CoInitializeEx WINELIB_NAME(CoInitializeEx)
+
+void WINAPI CoUninitialize(void);
+
+
+HRESULT WINAPI CoCreateGuid(GUID *pguid);
+
+/* class registration flags; passed to CoRegisterClassObject */
+typedef enum tagREGCLS
+{
+    REGCLS_SINGLEUSE = 0,
+    REGCLS_MULTIPLEUSE = 1,
+    REGCLS_MULTI_SEPARATE = 2,
+    REGCLS_SUSPENDED = 4
+} REGCLS;
+
+HRESULT WINAPI CoRegisterClassObject16(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister);
+HRESULT WINAPI CoRegisterClassObject32(REFCLSID rclsid,LPUNKNOWN pUnk,DWORD dwClsContext,DWORD flags,LPDWORD lpdwRegister);
+#define CoRegisterClassObject WINELIB_NAME(CoRegisterClassObject)
+
+HRESULT WINAPI CoRevokeClassObject(DWORD dwRegister);
+HRESULT WINAPI CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext,LPVOID pvReserved, const REFIID iid, LPVOID *ppv);
+
+
+HRESULT WINAPI CoCreateInstance(REFCLSID rclsid,LPUNKNOWN pUnkOuter,DWORD dwClsContext,REFIID iid,LPVOID *ppv);
+void WINAPI CoFreeLibrary(HINSTANCE32 hLibrary);
+void WINAPI CoFreeAllLibraries(void);
+void WINAPI CoFreeUnusedLibraries(void);
+HRESULT WINAPI CoFileTimeNow(FILETIME *lpFileTime);
+LPVOID WINAPI CoTaskMemAlloc(ULONG size);
+void WINAPI CoTaskMemFree(LPVOID ptr);
+HINSTANCE32 WINAPI CoLoadLibrary(LPOLESTR16 lpszLibName, BOOL32 bAutoFree);
+
+HRESULT WINAPI CoLockObjectExternal16(LPUNKNOWN pUnk,BOOL16 fLock,BOOL16 fLastUnlockReleases);
+HRESULT WINAPI CoLockObjectExternal32(LPUNKNOWN pUnk,BOOL32 fLock,BOOL32 fLastUnlockReleases);
+#define CoLockObjectExternal WINELIB_NAME(CoLockObjectExternal)
+
+
+/* internal Wine stuff */
+
+
+/*****************************************************************************
+ * IClassFactory interface
  */
 
+typedef struct _IClassFactory {
+    /* IUnknown fields */
+    ICOM_VTABLE(IClassFactory)* lpvtbl;
+    DWORD                       ref;
+} _IClassFactory;
 
-#define ICOM_VTABLE(iface)       iface##_VTABLE
+HRESULT WINE_StringFromCLSID(const CLSID *id, LPSTR);
 
 
-#if defined(__cplusplus) && !defined(CINTERFACE)
-/* C++ interface */
-
-#define ICOM_BEGIN(iface,ibase) \
-    typedef struct iface: public ibase {
-
-#define ICOM_METHOD(ret,xfn) \
-    private: ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me); \
-    public: inline ret (CALLBACK xfn)(void) { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this); };
-
-#define ICOM_METHOD1(ret,xfn,ta,na) \
-    private: ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a); \
-    public: inline ret (CALLBACK xfn)(ta a) { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a); };
-
-#define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \
-    private: ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b); \
-    public: inline ret (CALLBACK xfn)(ta a,tb b) { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b); };
-
-#define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
-    private: ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c); \
-    public: inline ret (CALLBACK xfn)(ta a,tb b,tc c) { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c); };
-
-#define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
-    private: ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d); \
-    public: inline ret (CALLBACK xfn)(ta a,tb b,tc c,td d) { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d); };
-
-#define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
-    private: ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e); \
-    public: inline ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e) { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d,e); };
-
-#define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
-    private: ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f); \
-    public: inline ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f) { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d,e,f); };
-
-#define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
-    private: ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g); \
-    public: inline ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d,e,f,g); };
-
-
-#define ICOM_CMETHOD(ret,xfn) \
-    private: ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me); \
-    public: inline ret (CALLBACK xfn)(void) const { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this); };
-
-#define ICOM_CMETHOD1(ret,xfn,ta,na) \
-    private: ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a); \
-    public: inline ret (CALLBACK xfn)(ta a) const { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a); };
-
-#define ICOM_CMETHOD2(ret,xfn,ta,na,tb,nb) \
-    private: ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b); \
-    public: inline ret (CALLBACK xfn)(ta a,tb b) const { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b); };
-
-#define ICOM_CMETHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
-    private: ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c); \
-    public: inline ret (CALLBACK xfn)(ta a,tb b,tc c) const { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c); };
-
-#define ICOM_CMETHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
-    private: ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d); \
-    public: inline ret (CALLBACK xfn)(ta a,tb b,tc c,td d) const { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d); };
-
-#define ICOM_CMETHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
-    private: ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e); \
-    public: inline ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e) const { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d,e); };
-
-#define ICOM_CMETHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
-    private: ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f); \
-    public: inline ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f) const { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d,e,f); };
-
-#define ICOM_CMETHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
-    private: ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g); \
-    public: inline ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) const { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d,e,f,g); };
-
-
-#define ICOM_END(iface) \
-    };
-
-#define ICOM_ICALL(ibase, xfn, p)                this_is_a_syntax_error
-#define ICOM_ICALL1(ibase, xfn, p,a)             this_is_a_syntax_error
-#define ICOM_ICALL2(ibase, xfn, p,a,b)           this_is_a_syntax_error
-#define ICOM_ICALL3(ibase, xfn, p,a,b,c)         this_is_a_syntax_error
-#define ICOM_ICALL4(ibase, xfn, p,a,b,c,d)       this_is_a_syntax_error
-#define ICOM_ICALL5(ibase, xfn, p,a,b,c,d,e)     this_is_a_syntax_error
-#define ICOM_ICALL6(ibase, xfn, p,a,b,c,d,e,f)   this_is_a_syntax_error
-#define ICOM_ICALL7(ibase, xfn, p,a,b,c,d,e,f,g) this_is_a_syntax_error
-
-#define ICOM_CALL(xfn, p)                        this_is_a_syntax_error
-#define ICOM_CALL1(xfn, p,a)                     this_is_a_syntax_error
-#define ICOM_CALL2(xfn, p,a,b)                   this_is_a_syntax_error
-#define ICOM_CALL3(xfn, p,a,b,c)                 this_is_a_syntax_error
-#define ICOM_CALL4(xfn, p,a,b,c,d)               this_is_a_syntax_error
-#define ICOM_CALL5(xfn, p,a,b,c,d,e)             this_is_a_syntax_error
-#define ICOM_CALL6(xfn, p,a,b,c,d,e,f)           this_is_a_syntax_error
-#define ICOM_CALL7(xfn, p,a,b,c,d,e,f,g)         this_is_a_syntax_error
-
-
-#else
-/* C interface */
-
-
-#define ICOM_BEGIN(iface,ibase) \
-    typedef struct ICOM_VTABLE(iface) ICOM_VTABLE(iface); \
-    struct iface { \
-        const ICOM_VTABLE(iface)* lpvtbl; \
-    }; \
-    struct ICOM_VTABLE(iface) { \
-        ICOM_VTABLE(ibase) bvt;
-
-#define ICOM_METHOD(ret, xfn) \
-    ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me);
-
-#define ICOM_METHOD1(ret,xfn,ta,na) \
-    ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a);
-
-#define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \
-    ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b);
-
-#define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
-    ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c);
-
-#define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
-    ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
-
-#define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
-    ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
-
-#define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
-    ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
-
-#define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
-    ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
-
-
-#define ICOM_CMETHOD(ret, xfn) \
-        ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me);
-
-#define ICOM_CMETHOD1(ret,xfn,ta,na) \
-    ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a);
-
-#define ICOM_CMETHOD2(ret,xfn,ta,na,tb,nb) \
-    ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b);
-
-#define ICOM_CMETHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
-    ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c);
-
-#define ICOM_CMETHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
-    ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
-
-#define ICOM_CMETHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
-    ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
-
-#define ICOM_CMETHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
-    ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
-
-#define ICOM_CMETHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
-    ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
-
-#define ICOM_END(iface) \
-    };
-
-#define ICOM_ICALL(ibase, xfn, p)  ((ICOM_VTABLE(ibase)*)(p)->lpvtbl)->fn##xfn((ibase*)p)
-#define ICOM_ICALL1(ibase, xfn, p,a) ((ICOM_VTABLE(ibase)*)(p)->lpvtbl)->fn##xfn((ibase*)p,a)
-#define ICOM_ICALL2(ibase, xfn, p,a,b) ((ICOM_VTABLE(ibase)*)(p)->lpvtbl)->fn##xfn((ibase*)p,a,b)
-#define ICOM_ICALL3(ibase, xfn, p,a,b,c) ((ICOM_VTABLE(ibase)*)(p)->lpvtbl)->fn##xfn((ibase*)p,a,b,c)
-#define ICOM_ICALL4(ibase, xfn, p,a,b,c,d) ((ICOM_VTABLE(ibase)*)(p)->lpvtbl)->fn##xfn((ibase*)p,a,b,c,d)
-#define ICOM_ICALL5(ibase, xfn, p,a,b,c,d,e) ((ICOM_VTABLE(ibase)*)(p)->lpvtbl)->fn##xfn((ibase*)p,a,b,c,d,e)
-#define ICOM_ICALL6(ibase, xfn, p,a,b,c,d,e,f) ((ICOM_VTABLE(ibase)*)(p)->lpvtbl)->fn##xfn((ibase*)p,a,b,c,d,e,f)
-#define ICOM_ICALL7(ibase, xfn, p,a,b,c,d,e,f,g) ((ICOM_VTABLE(ibase)*)(p)->lpvtbl)->fn##xfn((ibase*)p,a,b,c,d,e,f,g)
-
-#define ICOM_CALL(xfn, p)  (p)->lpvtbl->fn##xfn(p)
-#define ICOM_CALL1(xfn, p,a) (p)->lpvtbl->fn##xfn(p,a)
-#define ICOM_CALL2(xfn, p,a,b) (p)->lpvtbl->fn##xfn(p,a,b)
-#define ICOM_CALL3(xfn, p,a,b,c) (p)->lpvtbl->fn##xfn(p,a,b,c)
-#define ICOM_CALL4(xfn, p,a,b,c,d) (p)->lpvtbl->fn##xfn(p,a,b,c,d)
-#define ICOM_CALL5(xfn, p,a,b,c,d,e) (p)->lpvtbl->fn##xfn(p,a,b,c,d,e)
-#define ICOM_CALL6(xfn, p,a,b,c,d,e,f) (p)->lpvtbl->fn##xfn(p,a,b,c,d,e,f)
-#define ICOM_CALL7(xfn, p,a,b,c,d,e,f,g) (p)->lpvtbl->fn##xfn(p,a,b,c,d,e,f,g)
-
-
-#define ICOM_THIS(iface,me)          struct _##iface* this=(struct _##iface*)me
-#define ICOM_CTHIS(iface,me)         const _##iface* this=(const _##iface*)me
-
-#endif
-
-
-/* FIXME: compobj.h seems to be obsolete (replaced by objbase.h!) but it still contains REFIID */
-#include "compobj.h"
-
-typedef struct IUnknown      IUnknown ,*LPUNKNOWN;
+/*****************************************************************************
+ * IMalloc interface
+ */
+/* private prototypes for the constructors */
+LPMALLOC16	IMalloc16_Constructor(void);
+LPMALLOC32	IMalloc32_Constructor(void);
 
 
 /*****************************************************************************
  * IUnknown interface
  */
-#define ICOM_INTERFACE IUnknown
-#if defined(__cplusplus) && !defined(CINTERFACE)
-struct IUnknown {
-    union {
-        const void* lpvtbl;
-        HRESULT (CALLBACK *fnQueryInterface)(IUnknown* me, REFIID riid, LPVOID* ppvObj);
-    } t;
-    inline int QueryInterface(REFIID a, LPVOID* b) { return ((IUnknown*)t.lpvtbl)->t.fnQueryInterface(this,a,b); }
-#else
-typedef struct ICOM_VTABLE(IUnknown) ICOM_VTABLE(IUnknown);
-struct IUnknown {
+
+typedef struct _IUnknown {
+    /* IUnknown fields */
     ICOM_VTABLE(IUnknown)* lpvtbl;
-};
-struct ICOM_VTABLE(IUnknown) {
-    ICOM_METHOD2(HRESULT,QueryInterface,REFIID,riid, LPVOID*,ppvObj)
-#endif
+    DWORD                  ref;
+} _IUnknown;
 
-    ICOM_METHOD (ULONG,AddRef)
-    ICOM_METHOD (ULONG,Release)
-#ifdef __WRC__
-}; /* FIXME: WRC does not support function macros and it is ICOM_END that is supposed to close the class */
-#else
-ICOM_END(IUnknown)
-#endif
-#undef ICOM_INTERFACE
-
-#if !defined(__cplusplus) || defined(CINTERFACE)
-/*** IUnknown methods ***/
-#define IUnknown_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
-#define IUnknown_AddRef(p)             ICOM_CALL (AddRef,p)
-#define IUnknown_Release(p)            ICOM_CALL (Release,p)
-#endif
-
+LPUNKNOWN	IUnknown_Constructor(void);
 
 #endif /* __WINE_OBJBASE_H */
diff --git a/include/objidl.h b/include/objidl.h
new file mode 100644
index 0000000..a923c1e
--- /dev/null
+++ b/include/objidl.h
@@ -0,0 +1,22 @@
+#ifndef __WINE_OBJIDL_H
+#define __WINE_OBJIDL_H
+
+
+#include "wine/obj_base.h"
+
+/* the following depend only on obj_base.h */
+#include "wine/obj_misc.h"
+#include "wine/obj_channel.h"
+#include "wine/obj_clientserver.h"
+#include "wine/obj_marshal.h"
+#include "wine/obj_storage.h"
+
+/* the following depend on obj_storage.h */
+#include "wine/obj_moniker.h"
+#include "wine/obj_propertystorage.h"
+
+/* the following depend on obj_moniker.h */
+#include "wine/obj_dataobject.h"
+
+
+#endif /* __WINE_OBJIDL_H */
diff --git a/include/ole.h b/include/ole.h
index 0a368ef..e5d4fab 100644
--- a/include/ole.h
+++ b/include/ole.h
@@ -7,37 +7,18 @@
 
 #include "wingdi.h"
 
-typedef CHAR		OLECHAR16;
-typedef OLECHAR16	*BSTR16;
-typedef BSTR16		*LPBSTR16;
-typedef LPSTR		LPOLESTR16;
-typedef LPCSTR		LPCOLESTR16;
-typedef WCHAR		OLECHAR32;
-typedef OLECHAR32	*BSTR32;
-typedef BSTR32		*LPBSTR32;
-typedef LPWSTR		LPOLESTR32;
-typedef LPCWSTR		LPCOLESTR32;
-DECL_WINELIB_TYPE(OLECHAR)
-DECL_WINELIB_TYPE(LPOLESTR)
-DECL_WINELIB_TYPE(LPCOLESTR)
-DECL_WINELIB_TYPE(BSTR)
-DECL_WINELIB_TYPE(LPBSTR)
+/* FIXME: we need to include wtypes.h mainly, it seems, because we need BSTR. 
+ * Normally none of the APIs in ole.h depend on it. It is most likey that they should 
+ * be moved to ole2.h (which includes objbase.h and thus wtypes.h) or some other 
+ * OLE include
+ */
+#include "wtypes.h"
+
 
 #define OLESTR16(x) x
 #define OLESTR32(x) L##x	/* probably wrong */
 #define OLESTR WINELIB_NAME(OLESTR)
 
-typedef enum tagCLSCTX
-{
-    CLSCTX_INPROC_SERVER   = 0x1,
-    CLSCTX_INPROC_HANDLER  = 0x2,
-    CLSCTX_LOCAL_SERVER    = 0x4,
-    CLSCTX_REMOTE_SERVER   = 0x10
-} CLSCTX;
-
-#define CLSCTX_SERVER (CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER|CLSCTX_REMOTE_SERVER)
-#define CLSCTX_ALL    (CLSCTX_INPROC_HANDLER|CLSCTX_SERVER)
-
 typedef unsigned short VARTYPE;
 typedef LONG DISPID;
 
diff --git a/include/ole2.h b/include/ole2.h
index dc604c4..c91c9ae 100644
--- a/include/ole2.h
+++ b/include/ole2.h
@@ -6,18 +6,15 @@
 #define __WINE_OLE2_H
 
 /* to be implemented */
-typedef LPVOID LPMESSAGEFILTER;
+/* FIXME: this should be defined somewhere in oleidl.h instead, should it be repeated here ? */
 typedef LPVOID LPDROPTARGET;
-typedef struct tagMONIKER *LPMONIKER, IMoniker;
 
-#define S_OK	0
-#define S_FALSE	1
 
 /* OLE version */
 #define rmm             23
 #define rup            639
 
-/* FIXME should be in oleidl.h*/
+/* FIXME: should be in oleidl.h */
 typedef struct  tagOleMenuGroupWidths
 { LONG width[ 6 ];
 } OLEMENUGROUPWIDTHS32;
diff --git a/include/oleobj.h b/include/oleobj.h
index ab21084..d846d97 100644
--- a/include/oleobj.h
+++ b/include/oleobj.h
@@ -3,8 +3,10 @@
 
 #include "ole.h"
 #include "ole2.h"
-#include "compobj.h"
-/* #include "interfaces.h" */
+#include "wine/obj_base.h"
+#include "wine/obj_storage.h"
+#include "wine/obj_moniker.h"
+#include "wine/obj_dataobject.h"
 
 #define STDMETHOD(xfn) HRESULT (CALLBACK *fn##xfn)
 #define STDMETHOD_(type,xfn) type (CALLBACK *fn##xfn)
@@ -14,8 +16,6 @@
 
 /* forward declaration of the objects*/
 typedef struct tagOLEADVISEHOLDER	*LPOLEADVISEHOLDER,	IOleAdviseHolder;
-typedef struct tagADVISESINK		*LPADVISESINK,		IAdviseSink;
-typedef struct tagENUMSTATDATA		*LPENUMSTATDATA,	IEnumSTATDATA;
 
 
 /****************************************************************************
diff --git a/include/options.h b/include/options.h
index 9a09ecb..84150fc 100644
--- a/include/options.h
+++ b/include/options.h
@@ -92,6 +92,7 @@
 extern char* PROFILE_GetStringItem( char* );
 
 /* Version functions */
-extern void VERSION_ParseVersion( char *arg );
+extern void VERSION_ParseWinVersion( const char *arg );
+extern void VERSION_ParseDosVersion( const char *arg );
 
 #endif  /* __WINE_OPTIONS_H */
diff --git a/include/propsheet.h b/include/propsheet.h
new file mode 100644
index 0000000..0a42159
--- /dev/null
+++ b/include/propsheet.h
@@ -0,0 +1,21 @@
+/*
+ * Property sheet class extra info
+ *
+ * Copyright 1998 Anders Carlsson
+ */
+
+#ifndef __WINE_PROPSHEET_H  
+#define __WINE_PROPSHEET_H
+
+typedef struct tagPROPSHEET_INFO
+{
+    DWORD dwDummy;  /* just to keep the compiler happy ;-) */
+
+} PROPSHEET_INFO, *LPPROPSHEET_INFO;
+
+
+
+extern VOID PROPSHEET_Register (VOID);
+extern VOID PROPSHEET_UnRegister (VOID);
+
+#endif  /* __WINE_PROPSHEET_H */
diff --git a/include/servprov.h b/include/servprov.h
new file mode 100644
index 0000000..6df57b3
--- /dev/null
+++ b/include/servprov.h
@@ -0,0 +1,34 @@
+#ifndef __WINE_SERVPROV_H
+#define __WINE_SERVPROV_H
+
+
+#include "unknwn.h"
+
+
+/*****************************************************************************
+ * Predeclare the interfaces
+ */
+DEFINE_GUID   (IID_IServiceProvider,	0x6d5140c1L, 0x7436, 0x11ce, 0x80, 0x34, 0x00, 0xaa, 0x00, 0x60, 0x09, 0xfa);
+typedef struct IServiceProvider IServiceProvider,*LPSERVICEPROVIDER;
+
+
+/*****************************************************************************
+ * IServiceProvider interface
+ */
+#define ICOM_INTERFACE IServiceProvider
+ICOM_BEGIN(IServiceProvider,IUnknown)
+    ICOM_METHOD3(HRESULT,QueryService, REFGUID,guidService, REFIID,riid, void**,ppvObject);
+ICOM_END(IServiceProvider)
+#undef ICOM_INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+/*** IUnknown methods ***/
+#define IServiceProvider_QueryInterface(p,a,b) ICOM_ICALL2(IUnknown,QueryInterface,p,a,b)
+#define IServiceProvider_AddRef(p)             ICOM_ICALL (IUnknown,AddRef,p)
+#define IServiceProvider_Release(p)            ICOM_ICALL (IUnknown,Release,p)
+/*** IServiceProvider methods ***/
+#define IServiceProvider_QueryService(p,a,b,c) ICOM_CALL3(QueryService,p,a,b,c)
+#endif
+
+
+#endif /* __WINE_SERVPROV_H */
diff --git a/include/shell.h b/include/shell.h
index c19af49..2b5cdf6 100644
--- a/include/shell.h
+++ b/include/shell.h
@@ -4,13 +4,10 @@
 #ifndef __WINE_SHELL_H
 #define __WINE_SHELL_H
 
-#include "wintypes.h"
+#include "windows.h"
 #include "winreg.h"
 #include "imagelist.h"
 
-#ifndef MAX_PATH
-#define MAX_PATH 260
-#endif
 
 /****************************************************************************
 * shell 16
@@ -247,6 +244,11 @@
 /****************************************************************************
 *  string and path functions
 */
+BOOL32 WINAPI PathIsRoot32A(LPCSTR x);
+BOOL32 WINAPI PathIsRoot32W(LPCWSTR x);
+#define  PathIsRoot WINELIB_NAME_AW(PathIsRoot)
+BOOL32 WINAPI PathIsRoot32AW(LPCVOID x);
+
 LPSTR  WINAPI PathAddBackslash32A(LPSTR path);	
 LPWSTR WINAPI PathAddBackslash32W(LPWSTR path);	
 #define  PathAddBackslash WINELIB_NAME_AW(PathAddBackslash)
diff --git a/include/shlguid.h b/include/shlguid.h
new file mode 100644
index 0000000..3f6a853
--- /dev/null
+++ b/include/shlguid.h
@@ -0,0 +1,13 @@
+#ifndef __WINE_SHLGUID_H
+#define __WINE_SHLGUID_H
+
+
+/* This file defines the GUID of the shell objects. In WINE we define
+ * the GUIDs where the interface is declared so this file just 
+ * includes shlobj.h
+ */
+
+#include "shlobj.h"
+
+
+#endif /* __WINE_SHLGUID_H */
diff --git a/include/shlobj.h b/include/shlobj.h
index 8f82309..c741985 100644
--- a/include/shlobj.h
+++ b/include/shlobj.h
@@ -1,15 +1,13 @@
-#ifndef _WINE_SHLOBJ_H
-#define _WINE_SHLOBJ_H
+#ifndef __WINE_SHLOBJ_H
+#define __WINE_SHLOBJ_H
 
+#include "wine/obj_base.h"
 #include "shell.h"
 #include "ole.h"
 #include "ole2.h"
-#include "compobj.h"
 #include "oleobj.h"
-#include "storage.h"
 #include "commctrl.h"
 #include "wintypes.h"
-#include "interfaces.h"
 
 #define STDMETHOD(xfn) HRESULT (CALLBACK *fn##xfn)
 #define STDMETHOD_(type,xfn) type (CALLBACK *fn##xfn)
@@ -23,22 +21,19 @@
 DWORD WINAPI SHELL32_DllGetClassObject(LPCLSID,REFIID,LPVOID*);
 
 
-typedef LPVOID	LPBC; /* *IBindCtx really */
 
 /* foreward declaration of the objects*/
-typedef struct tagPERSISTFILE	*LPPERSISTFILE,	IPersistFile;
 typedef struct tagCONTEXTMENU	*LPCONTEXTMENU,	IContextMenu;
 typedef struct tagSHELLEXTINIT	*LPSHELLEXTINIT,IShellExtInit;
 typedef struct tagENUMIDLIST	*LPENUMIDLIST,	IEnumIDList;
 typedef struct tagSHELLFOLDER	*LPSHELLFOLDER,	IShellFolder;
 typedef struct tagSHELLVIEW	*LPSHELLVIEW,	IShellView;
 typedef struct tagSHELLBROWSER	*LPSHELLBROWSER,IShellBrowser;
-typedef struct tagDATAOBJECT	*LPDATAOBJECT,	IDataObject;
 typedef struct tagSHELLICON	*LPSHELLICON,	IShellIcon;
 typedef struct tagDOCKINGWINDOWFRAME	*LPDOCKINGWINDOWFRAME,	IDockingWindowFrame;
-typedef struct tagSERVICEPROVIDER	*LPSERVICEPROVIDER,	IServiceProvider;
 typedef struct tagCOMMDLGBROWSER	*LPCOMMDLGBROWSER,	ICommDlgBrowser;
-typedef struct tagENUMFORMATETC	*LPENUMFORMATETC,	IEnumFORMATETC;
+ 
+
  
 /****************************************************************************
 *  SHELL ID
@@ -47,24 +42,13 @@
 DEFINE_GUID (IID_MyComputer,		0x20D04FE0L, 0x3AEA, 0x1069, 0xA2, 0xD8, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D);
 
 /* strange Objects */
-DEFINE_SHLGUID(IID_IEnumUnknown,	0x00000100L, 0, 0);
-DEFINE_SHLGUID(IID_IEnumString,		0x00000101L, 0, 0);
-DEFINE_SHLGUID(IID_IEnumMoniker,	0x00000102L, 0, 0);
-DEFINE_SHLGUID(IID_IEnumFORMATETC,	0x00000103L, 0, 0);
 DEFINE_SHLGUID(IID_IEnumOLEVERB,	0x00000104L, 0, 0);
-DEFINE_SHLGUID(IID_IEnumSTATDATA,	0x00000105L, 0, 0);
 
-DEFINE_SHLGUID(IID_IPersistStream,	0x00000109L, 0, 0);
-DEFINE_SHLGUID(IID_IPersistStorage,	0x0000010AL, 0, 0);
-DEFINE_SHLGUID(IID_IPersistFile,	0x0000010BL, 0, 0);
-DEFINE_SHLGUID(IID_IPersist,		0x0000010CL, 0, 0);
 DEFINE_SHLGUID(IID_IViewObject,		0x0000010DL, 0, 0);
-DEFINE_SHLGUID(IID_IDataObject,		0x0000010EL, 0, 0);
 
 DEFINE_SHLGUID(IID_IDropSource,		0x00000121L, 0, 0);
 DEFINE_SHLGUID(IID_IDropTarget,		0x00000122L, 0, 0);
 
-DEFINE_GUID (IID_IServiceProvider,	0x6D5140C1L, 0x7436, 0x11CE, 0x80, 0x34, 0x00, 0xAA, 0x00, 0x60, 0x09, 0xFA);
 DEFINE_GUID (IID_IDockingWindow,	0x012dd920L, 0x7B26, 0x11D0, 0x8C, 0xA9, 0x00, 0xA0, 0xC9, 0x2D, 0xBF, 0xE8);
 DEFINE_GUID (IID_IDockingWindowSite,	0x2A342FC2L, 0x7B26, 0x11D0, 0x8C, 0xA9, 0x00, 0xA0, 0xC9, 0x2D, 0xBF, 0xE8);
 DEFINE_GUID (IID_IDockingWindowFrame,	0x47D2657AL, 0x7B27, 0x11D0, 0x8C, 0xA9, 0x00, 0xA0, 0xC9, 0x2D, 0xBF, 0xE8);
@@ -127,31 +111,8 @@
     WCHAR	cStrW[MAX_PATH];
   }u;
 } STRRET,*LPSTRRET;
-/*****************************************************************************
- * IPersistFile interface
- */
-#define THIS LPPERSISTFILE this
-typedef struct IPersistFile_VTable
-{   /* *** IUnknown methods *** */
-    STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
-    STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
-    STDMETHOD_(ULONG,Release) (THIS) PURE;
 
-    STDMETHOD(GetClassID )(THIS_ CLSID *pClassID) PURE;
-    STDMETHOD(IsDirty )(THIS) PURE;
-    STDMETHOD(Load )(THIS_ LPCOLESTR32 pszFileName, DWORD dwMode) PURE;
-    STDMETHOD(Save )(THIS_ LPCOLESTR32 pszFileName, BOOL32 fRemember) PURE;
-    STDMETHOD(SaveCompleted )(THIS_ LPCOLESTR32 pszFileName) PURE;
-    STDMETHOD(GetCurFile )(THIS_ LPOLESTR32 *ppszFileName) PURE;
 
-} IPersistFile_VTable,*LPPERSISTFILE_VTABLE;
-
-struct tagPERSISTFILE
-{ LPPERSISTFILE_VTABLE	lpvtbl;
-  DWORD			ref;
-};
-
-#undef THIS
 /*****************************************************************************
  * IContextMenu interface
  */
@@ -282,52 +243,6 @@
         DVASPECT_DOCPRINT	= 8
 } DVASPECT;
 
-typedef enum tagTYMED
-{	TYMED_HGLOBAL   = 1,
-	TYMED_FILE      = 2,
-	TYMED_ISTREAM   = 4,
-	TYMED_ISTORAGE  = 8,
-	TYMED_GDI       = 16,
-	TYMED_MFPICT    = 32,
-	TYMED_ENHMF     = 64,
-	TYMED_NULL      = 0
-} TYMED;
-  
-typedef struct
-{	DWORD tdSize;
-	WORD tdDriverNameOffset;
-	WORD tdDeviceNameOffset;
-	WORD tdPortNameOffset;
-	WORD tdExtDevmodeOffset;
-	BYTE tdData[ 1 ];
-} DVTARGETDEVICE32;
-
-typedef WORD CLIPFORMAT32, *LPCLIPFORMAT32;
-
-/* dataobject as answer to a request */
-typedef struct 
-{	DWORD tymed;
-	union 
-	{ HBITMAP32 hBitmap;
-	  /*HMETAFILEPICT32 hMetaFilePict;*/
-	  /*HENHMETAFILE32 hEnhMetaFile;*/
-	  HGLOBAL32 hGlobal;
-	  LPOLESTR32 lpszFileName;
-	  IStream32 *pstm;
-	  IStorage32 *pstg;
-        } u;
-	IUnknown *pUnkForRelease;
-} STGMEDIUM32;   
-
-/* wished data format */
-typedef struct 
-{	CLIPFORMAT32 cfFormat;
-	DVTARGETDEVICE32 *ptd;
-	DWORD dwAspect;
-	LONG lindex;
-	DWORD tymed;
-} FORMATETC32, *LPFORMATETC32;
-
 /* shell specific clipboard formats */
 
 /* DATAOBJECT_InitShellIDList*/
@@ -399,65 +314,6 @@
 extern LPIDLLIST IDLList_Constructor (UINT32 uStep);
 extern void IDLList_Destructor(LPIDLLIST this);
 #undef THIS
-/*****************************************************************************
- * IEnumFORMATETC interface
- */
-#define THIS LPENUMFORMATETC this
-
-typedef struct IEnumFORMATETC_VTable 
-{    /* IUnknown methods */
-	STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
-	STDMETHOD_(ULONG,AddRef) (THIS) PURE;
-	STDMETHOD_(ULONG,Release) (THIS) PURE;
-
-	/* IEnumFORMATETC methods */
-	STDMETHOD (Next)(THIS_ ULONG celt, FORMATETC32 *rgelt, ULONG *pceltFethed) PURE;
-	STDMETHOD (Skip)(THIS_ ULONG celt) PURE;
-	STDMETHOD (Reset)(THIS) PURE;
-	STDMETHOD (Clone)(THIS_ IEnumFORMATETC ** ppenum) PURE;
-} IEnumFORMATETC_VTable,*LPENUMFORMATETC_VTABLE;
-
-struct tagENUMFORMATETC
-{	LPENUMFORMATETC_VTABLE	lpvtbl;
-	DWORD			 ref;
-        UINT32	posFmt;
-        UINT32	countFmt;
-        LPFORMATETC32 pFmt;
-};
-
-#undef THIS
-
-/*****************************************************************************
- * IDataObject interface
- */
-#define THIS LPDATAOBJECT this
-
-typedef struct IDataObject_VTable 
-{	/*** IUnknown methods ***/
-	STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
-	STDMETHOD_(ULONG,AddRef) (THIS) PURE;
-	STDMETHOD_(ULONG,Release) (THIS) PURE;
-
-	STDMETHOD (GetData )(THIS_ LPFORMATETC32 pformatetcIn, STGMEDIUM32 *pmedium) PURE;
-	STDMETHOD (GetDataHere)(THIS_ LPFORMATETC32 pformatetc, STGMEDIUM32 *pmedium) PURE;
-        STDMETHOD (QueryGetData)(THIS_ LPFORMATETC32 pformatetc) PURE;
-        STDMETHOD (GetCanonicalFormatEtc)(THIS_ LPFORMATETC32 pformatectIn, LPFORMATETC32 pformatetcOut) PURE;
-        STDMETHOD (SetData)(THIS_ LPFORMATETC32 pformatetc, STGMEDIUM32 *pmedium, BOOL32 fRelease) PURE;
-        STDMETHOD (EnumFormatEtc)(THIS_ DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc) PURE;
-        STDMETHOD (DAdvise )(THIS_ LPFORMATETC32 *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection) PURE;
-        STDMETHOD (DUnadvise)(THIS_ DWORD dwConnection) PURE;
-        STDMETHOD (EnumDAdvise)(THIS_ IEnumSTATDATA **ppenumAdvise) PURE;
-} IDataObject_VTable,*LPDATAOBJECT_VTABLE;
-
-struct tagDATAOBJECT
-{	LPDATAOBJECT_VTABLE	lpvtbl;
-	DWORD	ref;
-	LPSHELLFOLDER	psf;
-	LPIDLLIST  lpill;	/* the data of the dataobject */
-	LPITEMIDLIST  pidl;	
-};
-
-#undef THIS
 
 
 /*****************************************************************************
@@ -1108,24 +964,6 @@
 
 #undef THIS
 /****************************************************************************
- * IServiceProvider interface
- */
-#define THIS LPSERVICEPROVIDER this
-
-typedef struct IServiceProvider_VTable
-{	/*** IUnknown methods ***/
-	STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
-	STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
-	STDMETHOD_(ULONG,Release) (THIS) PURE;
-
-	STDMETHOD(QueryService)(THIS_ REFGUID guidService, REFIID riid, void **ppvObject);
-} IServiceProvider_VTable, *LPSERVICEPROVIDER_VTABLE;
-
-struct tagSERVICEPROVIDER
-{	LPSERVICEPROVIDER_VTABLE lpvtbl;
-	DWORD ref;
-};           
-/****************************************************************************
  * Shell Execute API
  */
 #define SE_ERR_FNF              2       /* file not found */
@@ -1389,4 +1227,5 @@
 #undef THIS_
 #undef STDMETHOD
 #undef STDMETHOD_
-#endif /*_WINE_SHLOBJ_H*/
+
+#endif /* __WINE_SHLOBJ_H */
diff --git a/include/storage.h b/include/storage.h
index 678ea76..10fd693 100644
--- a/include/storage.h
+++ b/include/storage.h
@@ -1,254 +1,8 @@
 #ifndef __WINE_STORAGE_H
 #define __WINE_STORAGE_H
 
+/* "storage.h" is obsolete, you should include "objbase.h" instead */
+  
 #include "objbase.h"
-#include "windows.h"
-
-/* Does this look like a cellar to you? */
-
-struct storage_header {
-	BYTE	magic[8];	/* 00: magic */
-	BYTE	unknown1[36];	/* 08: unknown */
-	DWORD	num_of_bbd_blocks;/* 2C: length of big datablocks */
-	DWORD	root_startblock;/* 30: root storage first big block */
-	DWORD	unknown2[2];	/* 34: unknown */
-	DWORD	sbd_startblock;	/* 3C: small block depot first big block */
-	DWORD	unknown3[3];	/* 40: unknown */
-	DWORD	bbd_list[109];	/* 4C: big data block list (up to end of sector)*/
-};
-struct storage_pps_entry {
-	WCHAR	pps_rawname[32];/* 00: \0 terminated widechar name */
-	WORD	pps_sizeofname;	/* 40: namelength in bytes */
-	BYTE	pps_type;	/* 42: flags, 1 storage/dir, 2 stream, 5 root */
-	BYTE	pps_unknown0;	/* 43: unknown */
-	DWORD	pps_prev;	/* 44: previous pps */
-	DWORD	pps_next;	/* 48: next pps */
-	DWORD	pps_dir;	/* 4C: directory pps */
-	GUID	pps_guid;	/* 50: class ID */
-	DWORD	pps_unknown1;	/* 60: unknown */
-	FILETIME pps_ft1;	/* 64: filetime1 */
-	FILETIME pps_ft2;	/* 70: filetime2 */
-	DWORD	pps_sb;		/* 74: data startblock */
-	DWORD	pps_size;	/* 78: datalength. (<0x1000)?small:big blocks*/
-	DWORD	pps_unknown2;	/* 7C: unknown */
-};
-
-#define STORAGE_CHAINENTRY_FAT		0xfffffffd
-#define STORAGE_CHAINENTRY_ENDOFCHAIN	0xfffffffe
-#define STORAGE_CHAINENTRY_FREE		0xffffffff
-
-typedef LPOLESTR16 *SNB16;
-typedef LPOLESTR32 *SNB32;
-DECL_WINELIB_TYPE(SNB)
-
-typedef struct IStorage16 IStorage16,*LPSTORAGE16;
-typedef struct IStorage32 IStorage32,*LPSTORAGE32;
-typedef struct IStream16 IStream16,*LPSTREAM16;
-typedef struct IStream32 IStream32,*LPSTREAM32;
-
-typedef struct IEnumSTATSTG IEnumSTATSTG,*LPENUMSTATSTG;
-
-typedef struct {
-    LPOLESTR16	pwcsName;
-    DWORD	type;
-    ULARGE_INTEGER cbSize;
-    FILETIME	mtime;
-    FILETIME	ctime;
-    FILETIME	atime;
-    DWORD	grfMode;
-    DWORD	grfLocksSupported;
-    CLSID	clsid;
-    DWORD	grfStateBits;
-    DWORD	reserved;
-} STATSTG;
-
-#define STGM_DIRECT		0x00000000
-#define STGM_TRANSACTED		0x00010000
-#define STGM_SIMPLE		0x08000000
-#define STGM_READ		0x00000000
-#define STGM_WRITE		0x00000001
-#define STGM_READWRITE		0x00000002
-#define STGM_SHARE_DENY_NONE	0x00000040
-#define STGM_SHARE_DENY_READ	0x00000030
-#define STGM_SHARE_DENY_WRITE	0x00000020
-#define STGM_SHARE_EXCLUSIVE	0x00000010
-#define STGM_PRIORITY		0x00040000
-#define STGM_DELETEONRELEASE	0x04000000
-#define STGM_NOSCRATCH		0x00100000
-#define STGM_CREATE		0x00001000
-#define STGM_CONVERT		0x00020000
-#define STGM_FAILIFTHERE	0x00000000
-
-
-/*****************************************************************************
- * IStorage16 interface
- */
-#define ICOM_INTERFACE IStorage16
-ICOM_BEGIN(IStorage16,IUnknown)
-    ICOM_METHOD5(HRESULT,CreateStream,   LPCOLESTR16,pwcsName, DWORD,grfMode, DWORD,reserved1, DWORD,reserved2, IStream16**,ppstm)
-    ICOM_METHOD5(HRESULT,OpenStream,     LPCOLESTR16,pwcsName, void*,reserved1, DWORD,grfMode, DWORD,reserved2, IStream16**,ppstm)
-    ICOM_METHOD5(HRESULT,CreateStorage,  LPCOLESTR16,pwcsName, DWORD,grfMode, DWORD,dwStgFmt, DWORD,reserved2, IStorage16**,ppstg)
-    ICOM_METHOD6(HRESULT,OpenStorage,    LPCOLESTR16,pwcsName, IStorage16*,pstgPriority, DWORD,grfMode, SNB16,snb16Exclude, DWORD,reserved, IStorage16**,ppstg)
-    ICOM_METHOD4(HRESULT,CopyTo,         DWORD,ciidExclude, const IID*,rgiidExclude, SNB16,snb16Exclude, IStorage16*,pstgDest)
-    ICOM_METHOD4(HRESULT,MoveElementTo,  LPCOLESTR16,pwcsName, IStorage16*,pstgDest, LPCOLESTR16,pwcsNewName, DWORD,grfFlags)
-    ICOM_METHOD1(HRESULT,Commit,         DWORD,grfCommitFlags)
-    ICOM_METHOD (HRESULT,Revert)
-    ICOM_METHOD4(HRESULT,EnumElements,   DWORD,reserved1, void*,reserved2, DWORD,reserved3, IEnumSTATSTG**,ppenum)
-    ICOM_METHOD1(HRESULT,DestroyElement, LPCOLESTR16,pwcsName)
-    ICOM_METHOD2(HRESULT,RenameElement,  LPCOLESTR16,pwcsOldName, LPCOLESTR16,pwcsNewName)
-    ICOM_METHOD4(HRESULT,SetElementTimes,LPCOLESTR16,pwcsName, const FILETIME*,pctime, const FILETIME*,patime, const FILETIME*,pmtime)
-    ICOM_METHOD1(HRESULT,SetClass,       REFCLSID,clsid)
-    ICOM_METHOD2(HRESULT,SetStateBits,   DWORD,grfStateBits, DWORD,grfMask)
-    ICOM_METHOD2(HRESULT,Stat,           STATSTG*,pstatstg, DWORD,grfStatFlag)
-ICOM_END(IStorage16)
-#undef ICOM_INTERFACE
-
-#if !defined(__cplusplus) || defined(CINTERFACE)
-/*** IUnknown methods ***/
-#define IStorage16_QueryInterface(p,a,b) ICOM_ICALL2(QueryInterface,p,a,b)
-#define IStorage16_AddRef(p)             ICOM_ICALL (AddRef,p)
-#define IStorage16_Release(p)            ICOM_ICALL (Release,p)
-/*** IStorage16 methods ***/
-#define IStorage16_CreateStream(p,a,b,c,d,e)  ICOM_CALL5(CreateStream,p,a,b,c,d,e)
-#define IStorage16_OpenStream(p,a,b,c,d,e)    ICOM_CALL5(OpenStream,p,a,b,c,d,e)
-#define IStorage16_CreateStorage(p,a,b,c,d,e) ICOM_CALL5(CreateStorage,p,a,b,c,d,e)
-#define IStorage16_OpenStorage(p,a,b,c,d,e,f) ICOM_CALL6(OpenStorage,p,a,b,c,d,e,f)
-#define IStorage16_CopyTo(p,a,b,c,d)          ICOM_CALL4(CopyTo,p,a,b,c,d)
-#define IStorage16_MoveElementTo(p,a,b,c,d)   ICOM_CALL4(MoveElementTo,p,a,b,c,d)
-#define IStorage16_Commit(p,a)                ICOM_CALL1(Commit,p,a)
-#define IStorage16_Revert(p)                  ICOM_CALL (Revert,p)
-#define IStorage16_EnumElements(p,a,b,c,d)    ICOM_CALL4(EnumElements,p,a,b,c,d)
-#define IStorage16_DestroyElement(p,a)        ICOM_CALL1(DestroyElement,p,a)
-#define IStorage16_RenameElement(p,a,b)       ICOM_CALL2(RenameElement,p,a,b)
-#define IStorage16_SetElementTimes(p,a,b,c,d) ICOM_CALL4(SetElementTimes,p,a,b,c,d)
-#define IStorage16_SetClass(p,a)              ICOM_CALL1(SetClass,p,a)
-#define IStorage16_SetStateBits(p,a,b)        ICOM_CALL2(SetStateBits,p,a,b)
-#define IStorage16_Stat(p,a,b)                ICOM_CALL2(Stat,p,a,b)
-#endif
-
-
-/*****************************************************************************
- * IStorage32 interface
- */
-#define ICOM_INTERFACE IStorage32
-ICOM_BEGIN(IStorage32,IUnknown)
-    ICOM_METHOD5(HRESULT,CreateStream,   LPCOLESTR32,pwcsName, DWORD,grfMode, DWORD,reserved1, DWORD,reserved2, IStream32**,ppstm)
-    ICOM_METHOD5(HRESULT,OpenStream,     LPCOLESTR32,pwcsName, void*,reserved1, DWORD,grfMode, DWORD,reserved2, IStream32**,ppstm)
-    ICOM_METHOD5(HRESULT,CreateStorage,  LPCOLESTR32,pwcsName, DWORD,grfMode, DWORD,dwStgFmt, DWORD,reserved2, IStorage32**,ppstg)
-    ICOM_METHOD6(HRESULT,OpenStorage,    LPCOLESTR32,pwcsName, IStorage32*,pstgPriority, DWORD,grfMode, SNB32,snb16Exclude, DWORD,reserved, IStorage32**,ppstg)
-    ICOM_METHOD4(HRESULT,CopyTo,         DWORD,ciidExclude, const IID*,rgiidExclude, SNB32,snb16Exclude, IStorage32*,pstgDest)
-    ICOM_METHOD4(HRESULT,MoveElementTo,  LPCOLESTR32,pwcsName, IStorage32*,pstgDest, LPCOLESTR32,pwcsNewName, DWORD,grfFlags)
-    ICOM_METHOD1(HRESULT,Commit,         DWORD,grfCommitFlags)
-    ICOM_METHOD (HRESULT,Revert)
-    ICOM_METHOD4(HRESULT,EnumElements,   DWORD,reserved1, void*,reserved2, DWORD,reserved3, IEnumSTATSTG**,ppenum)
-    ICOM_METHOD1(HRESULT,DestroyElement, LPCOLESTR32,pwcsName)
-    ICOM_METHOD2(HRESULT,RenameElement,  LPCOLESTR32,pwcsOldName, LPCOLESTR32,pwcsNewName)
-    ICOM_METHOD4(HRESULT,SetElementTimes,LPCOLESTR32,pwcsName, const FILETIME*,pctime, const FILETIME*,patime, const FILETIME*,pmtime)
-    ICOM_METHOD1(HRESULT,SetClass,       REFCLSID,clsid)
-    ICOM_METHOD2(HRESULT,SetStateBits,   DWORD,grfStateBits, DWORD,grfMask)
-    ICOM_METHOD2(HRESULT,Stat,           STATSTG*,pstatstg, DWORD,grfStatFlag)
-ICOM_END(IStorage32)
-#undef ICOM_INTERFACE
-
-#if !defined(__cplusplus) || defined(CINTERFACE)
-/*** IUnknown methods ***/
-#define IStorage32_QueryInterface(p,a,b) ICOM_ICALL2(QueryInterface,p,a,b)
-#define IStorage32_AddRef(p)             ICOM_ICALL (AddRef,p)
-#define IStorage32_Release(p)            ICOM_ICALL (Release,p)
-/*** IStorage32 methods ***/
-#define IStorage32_CreateStream(p,a,b,c,d,e)  ICOM_CALL5(CreateStream,p,a,b,c,d,e)
-#define IStorage32_OpenStream(p,a,b,c,d,e)    ICOM_CALL5(OpenStream,p,a,b,c,d,e)
-#define IStorage32_CreateStorage(p,a,b,c,d,e) ICOM_CALL5(CreateStorage,p,a,b,c,d,e)
-#define IStorage32_OpenStorage(p,a,b,c,d,e,f) ICOM_CALL6(OpenStorage,p,a,b,c,d,e,f)
-#define IStorage32_CopyTo(p,a,b,c,d)          ICOM_CALL4(CopyTo,p,a,b,c,d)
-#define IStorage32_MoveElementTo(p,a,b,c,d)   ICOM_CALL4(MoveElementTo,p,a,b,c,d)
-#define IStorage32_Commit(p,a)                ICOM_CALL1(Commit,p,a)
-#define IStorage32_Revert(p)                  ICOM_CALL (Revert,p)
-#define IStorage32_EnumElements(p,a,b,c,d)    ICOM_CALL4(EnumElements,p,a,b,c,d)
-#define IStorage32_DestroyElement(p,a)        ICOM_CALL1(DestroyElement,p,a)
-#define IStorage32_RenameElement(p,a,b)       ICOM_CALL2(RenameElement,p,a,b)
-#define IStorage32_SetElementTimes(p,a,b,c,d) ICOM_CALL4(SetElementTimes,p,a,b,c,d)
-#define IStorage32_SetClass(p,a)              ICOM_CALL1(SetClass,p,a)
-#define IStorage32_SetStateBits(p,a,b)        ICOM_CALL2(SetStateBits,p,a,b)
-#define IStorage32_Stat(p,a,b)                ICOM_CALL2(Stat,p,a,b)
-#endif
-
-
-/*****************************************************************************
- * IStream16 interface
- */
-#define ICOM_INTERFACE IStream16
-ICOM_BEGIN(IStream16,IUnknown)
-    ICOM_METHOD3(HRESULT,Read,        void*,pv, ULONG,cb, ULONG*,pcbRead)
-    ICOM_METHOD3(HRESULT,Write,       const void*,pv, ULONG,cb, ULONG*,pcbWritten)
-    ICOM_METHOD3(HRESULT,Seek,        LARGE_INTEGER,dlibMove, DWORD,dwOrigin, ULARGE_INTEGER*,plibNewPosition)
-    ICOM_METHOD1(HRESULT,SetSize,     ULARGE_INTEGER,libNewSize)
-    ICOM_METHOD4(HRESULT,CopyTo,      IStream16*,pstm, ULARGE_INTEGER,cb, ULARGE_INTEGER*,pcbRead, ULARGE_INTEGER*,pcbWritten)
-    ICOM_METHOD1(HRESULT,Commit,      DWORD,grfCommitFlags)
-    ICOM_METHOD (HRESULT,Revert)
-    ICOM_METHOD3(HRESULT,LockRegion,  ULARGE_INTEGER,libOffset, ULARGE_INTEGER,cb, DWORD,dwLockType)
-    ICOM_METHOD3(HRESULT,UnlockRegion,ULARGE_INTEGER,libOffset, ULARGE_INTEGER,cb, DWORD,dwLockType)
-    ICOM_METHOD2(HRESULT,Stat,        STATSTG*,pstatstg, DWORD,grfStatFlag)
-    ICOM_METHOD1(HRESULT,Clone,       IStream16**,ppstm)
-ICOM_END(IStream16)
-#undef ICOM_INTERFACE
-
-#if !defined(__cplusplus) || defined(CINTERFACE)
-/*** IUnknown methods ***/
-#define IStream16_QueryInterface(p,a,b) ICOM_ICALL2(QueryInterface,p,a,b)
-#define IStream16_AddRef(p)             ICOM_ICALL (AddRef,p)
-#define IStream16_Release(p)            ICOM_ICALL (Release,p)
-/*** IStream16 methods ***/
-#define IStream16_Read(p,a,b,c)         ICOM_CALL3(Read,p,a,b,c)
-#define IStream16_Write(p,a,b,c)        ICOM_CALL3(Write,p,a,b,c)
-#define IStream16_Seek(p)               ICOM_CALL3(Seek,p)
-#define IStream16_SetSize(p,a,b)        ICOM_CALL1(SetSize,p,a,b)
-#define IStream16_CopyTo(pa,b,c,d)      ICOM_CALL4(CopyTo,pa,b,c,d)
-#define IStream16_Commit(p,a)           ICOM_CALL1(Commit,p,a)
-#define IStream16_Revert(p)             ICOM_CALL (Revert,p)
-#define IStream16_LockRegion(pa,b,c)    ICOM_CALL3(LockRegion,pa,b,c)
-#define IStream16_UnlockRegion(p,a,b,c) ICOM_CALL3(UnlockRegion,p,a,b,c)
-#define IStream16_Stat(p,a,b)           ICOM_CALL2(Stat,p,a,b)
-#define IStream16_Clone(p,a)            ICOM_CALL1(Clone,p,a)
-#endif
-
-
-/*****************************************************************************
- * IStream32 interface
- */
-#define ICOM_INTERFACE IStream32
-ICOM_BEGIN(IStream32,IUnknown)
-    ICOM_METHOD3(HRESULT,Read,        void*,pv, ULONG,cb, ULONG*,pcbRead)
-    ICOM_METHOD3(HRESULT,Write,       const void*,pv, ULONG,cb, ULONG*,pcbWritten)
-    ICOM_METHOD3(HRESULT,Seek,        LARGE_INTEGER,dlibMove, DWORD,dwOrigin, ULARGE_INTEGER*,plibNewPosition)
-    ICOM_METHOD1(HRESULT,SetSize,     ULARGE_INTEGER,libNewSize)
-    ICOM_METHOD4(HRESULT,CopyTo,      IStream32*,pstm, ULARGE_INTEGER,cb, ULARGE_INTEGER*,pcbRead, ULARGE_INTEGER*,pcbWritten)
-    ICOM_METHOD1(HRESULT,Commit,      DWORD,grfCommitFlags)
-    ICOM_METHOD (HRESULT,Revert)
-    ICOM_METHOD3(HRESULT,LockRegion,  ULARGE_INTEGER,libOffset, ULARGE_INTEGER,cb, DWORD,dwLockType)
-    ICOM_METHOD3(HRESULT,UnlockRegion,ULARGE_INTEGER,libOffset, ULARGE_INTEGER,cb, DWORD,dwLockType)
-    ICOM_METHOD2(HRESULT,Stat,        STATSTG*,pstatstg, DWORD,grfStatFlag)
-    ICOM_METHOD1(HRESULT,Clone,       IStream32**,ppstm)
-ICOM_END(IStream32)
-#undef ICOM_INTERFACE
-
-#if !defined(__cplusplus) || defined(CINTERFACE)
-/*** IUnknown methods ***/
-#define IStream32_QueryInterface(p,a,b) ICOM_ICALL2(QueryInterface,p,a,b)
-#define IStream32_AddRef(p)             ICOM_ICALL (AddRef,p)
-#define IStream32_Release(p)            ICOM_ICALL (Release,p)
-/*** IStream32 methods ***/
-#define IStream32_Read(p,a,b,c)         ICOM_CALL3(Read,p,a,b,c)
-#define IStream32_Write(p,a,b,c)        ICOM_CALL3(Write,p,a,b,c)
-#define IStream32_Seek(p)               ICOM_CALL3(Seek,p)
-#define IStream32_SetSize(p,a,b)        ICOM_CALL1(SetSize,p,a,b)
-#define IStream32_CopyTo(pa,b,c,d)      ICOM_CALL4(CopyTo,pa,b,c,d)
-#define IStream32_Commit(p,a)           ICOM_CALL1(Commit,p,a)
-#define IStream32_Revert(p)             ICOM_CALL (Revert,p)
-#define IStream32_LockRegion(pa,b,c)    ICOM_CALL3(LockRegion,pa,b,c)
-#define IStream32_UnlockRegion(p,a,b,c) ICOM_CALL3(UnlockRegion,p,a,b,c)
-#define IStream32_Stat(p,a,b)           ICOM_CALL2(Stat,p,a,b)
-#define IStream32_Clone(p,a)            ICOM_CALL1(Clone,p,a)
-#endif
 
 #endif
diff --git a/include/tab.h b/include/tab.h
index 81b7248..40f6e36 100644
--- a/include/tab.h
+++ b/include/tab.h
@@ -9,11 +9,10 @@
 
 typedef struct tagTAB_ITEM
 {
-    UINT32	mask;
-    UINT32	lpReserved1;
-    UINT32	lpReserved2;
+	UINT32  mask;
+	DWORD	dwState;
     LPSTR	pszText;
-    INT32	cchTextMax;
+	INT32   cchTextMax;
     INT32	iImage;
     LPARAM	lParam;
     RECT32   	rect;		/* bounding rectangle of the item */
@@ -21,13 +20,15 @@
 
 typedef struct tagTAB_INFO
 {
-    UINT32	uNumItem;	/* number of tab items */
-    INT32	nHeight;	/* height of the tab row */
-    HFONT32	hFont;		/* handle to the current font */
+    UINT32	    uNumItem;	/* number of tab items */
+    INT32	    nHeight;	/* height of the tab row */
+    HFONT32	    hFont;		/* handle to the current font */
     HCURSOR32	hcurArrow;	/* handle to the current cursor */
-    INT32	iSelected;	/* the currently selected item */
+	HIMAGELIST  himl;       /* handle to a image list (may be 0) */
+	UINT32		cchTextMax;
+    INT32	    iSelected;	/* the currently selected item */
     TAB_ITEM	*items;		/* pointer to an array of TAB_ITEM's */
-    RECT32	rect;
+    RECT32	    rect;
 } TAB_INFO;
 
 
diff --git a/include/unknwn.h b/include/unknwn.h
new file mode 100644
index 0000000..1803cb2
--- /dev/null
+++ b/include/unknwn.h
@@ -0,0 +1,8 @@
+#ifndef __WINE_UNKNWN_H
+#define __WINE_UNKNWN_H
+
+
+#include "wine/obj_base.h"
+
+
+#endif /* __WINE_UNKNWN_H */
diff --git a/include/version.h b/include/version.h
index 6d6aa5a..cf4f0e4 100644
--- a/include/version.h
+++ b/include/version.h
@@ -1 +1 @@
-#define WINE_RELEASE_INFO "Wine release 990103"
+#define WINE_RELEASE_INFO "Wine release 990110"
diff --git a/include/winbase.h b/include/winbase.h
index 8668da9..8df2d66 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -302,6 +302,7 @@
 void      WINAPI EnterCriticalSection(CRITICAL_SECTION *lpCrit);
 void      WINAPI InitializeCriticalSection(CRITICAL_SECTION *lpCrit);
 void      WINAPI LeaveCriticalSection(CRITICAL_SECTION *lpCrit);
+void      WINAPI MakeCriticalSectionGlobal(CRITICAL_SECTION *lpCrit);
 HANDLE32  WINAPI OpenProcess(DWORD access, BOOL32 inherit, DWORD id);
 BOOL32    WINAPI GetProcessWorkingSetSize(HANDLE32,LPDWORD,LPDWORD);
 BOOL32    WINAPI SetProcessWorkingSetSize(HANDLE32,DWORD,DWORD);
diff --git a/include/windows.h b/include/windows.h
index db13b18..3b602c4 100644
--- a/include/windows.h
+++ b/include/windows.h
@@ -12,8 +12,14 @@
 #include "wintypes.h"
 #include "winbase.h"  
 
-/* FIXME: Maybe we should try to get something from the Unix headers instead, this should be in windef.h by the way */
+/* FIXME: Maybe MAX_PATH and _MAX_PATH should be computed from the Unix headers instead
+ * and by the way, _MAX_PATH should be defined in stdlib.h and MAX_PATH in windef.h 
+ * and mapiwin.h
+ */
+#define _MAX_PATH 260
+#ifndef MAX_PATH
 #define MAX_PATH 260
+#endif
 
 #ifndef DONT_INCLUDE_WINGDI
 #include "winbase.h"
@@ -3836,6 +3842,8 @@
 VOID        WINAPI PostEvent(HTASK16);
 WORD        WINAPI PrestoChangoSelector(WORD,WORD);
 BOOL32      WINAPI RegisterShellHook(HWND16,UINT16);
+/* NOTE: This is SYSTEM.3, not USER.182, which is also named KillSystemTimer */
+WORD        WINAPI SYSTEM_KillSystemTimer( WORD );
 WORD        WINAPI SelectorAccessRights(WORD,WORD,WORD);
 VOID        WINAPI SetPriority(HTASK16,INT16);
 FARPROC16   WINAPI SetResourceHandler(HINSTANCE16,SEGPTR,FARPROC16);
@@ -3857,6 +3865,7 @@
 BOOL32      WINAPI Beep(DWORD,DWORD);
 BOOL32      WINAPI CloseHandle(HANDLE32);
 BOOL32      WINAPI CloseServiceHandle(HANDLE32);
+HANDLE32    WINAPI ConvertToGlobalHandle(HANDLE32 hSrc);
 BOOL32      WINAPI CopyFile32A(LPCSTR,LPCSTR,BOOL32);
 BOOL32      WINAPI CopyFile32W(LPCWSTR,LPCWSTR,BOOL32);
 #define     CopyFile WINELIB_NAME_AW(CopyFile)
@@ -4135,6 +4144,7 @@
 LONG        WINAPI RegUnLoadKey32A(HKEY,LPCSTR);
 LONG        WINAPI RegUnLoadKey32W(HKEY,LPCWSTR);
 #define     RegUnLoadKey WINELIB_NAME_AW(RegUnLoadKey)
+BOOL32      WINAPI ReleaseMutex(HANDLE32);
 BOOL32      WINAPI ReleaseSemaphore(HANDLE32,LONG,LPLONG);
 BOOL32      WINAPI ResetEvent(HANDLE32);
 DWORD       WINAPI ResumeThread(HANDLE32);
diff --git a/include/wine/obj_base.h b/include/wine/obj_base.h
new file mode 100644
index 0000000..d03d1e9
--- /dev/null
+++ b/include/wine/obj_base.h
@@ -0,0 +1,749 @@
+/*
+ * This file defines the macros and types necessary to define COM interfaces, 
+ * and the three most basic COM interfaces: IUnknown, IMalloc and IClassFactory.
+ */
+
+#ifndef __WINE_WINE_OBJ_BASE_H
+#define __WINE_WINE_OBJ_BASE_H
+
+
+/*****************************************************************************
+ * Defines the basic types
+ */
+#include "wtypes.h"
+
+
+/*****************************************************************************
+ * Macros to declare the GUIDs
+ */
+#ifdef INITGUID
+#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
+        const GUID name = \
+	{ l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }
+#else
+#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
+    extern const GUID name
+#endif
+
+#define DEFINE_OLEGUID(name, l, w1, w2) \
+	DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
+
+#define DEFINE_SHLGUID(name, l, w1, w2) DEFINE_OLEGUID(name,l,w1,w2)
+
+
+/*****************************************************************************
+ * GUID API
+ */
+HRESULT WINAPI StringFromCLSID16(const CLSID *id, LPOLESTR16*);
+HRESULT WINAPI StringFromCLSID32(const CLSID *id, LPOLESTR32*);
+#define StringFromCLSID WINELIB_NAME(StringFromCLSID)
+HRESULT WINAPI CLSIDFromString16(LPCOLESTR16, CLSID *);
+HRESULT WINAPI CLSIDFromString32(LPCOLESTR32, CLSID *);
+#define CLSIDFromString WINELIB_NAME(CLSIDFromString)
+HRESULT WINAPI CLSIDFromProgID16(LPCOLESTR16 progid, LPCLSID riid);
+HRESULT WINAPI CLSIDFromProgID32(LPCOLESTR32 progid, LPCLSID riid);
+#define CLSIDFromProgID WINELIB_NAME(CLSIDFromProgID)
+
+INT32 WINAPI StringFromGUID2(REFGUID id, LPOLESTR32 str, INT32 cmax);
+
+BOOL16 WINAPI IsEqualGUID16(GUID* g1,GUID* g2);
+BOOL32 WINAPI IsEqualGUID32(REFGUID rguid1,REFGUID rguid2);
+/*#define IsEqualGUID WINELIB_NAME(IsEqualGUID)*/
+#define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
+#define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
+#define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
+
+
+/*****************************************************************************
+ * Macros to define a COM interface
+ */
+/*
+ * The goal of the following set of definitions is to provide a way to use the same 
+ * header file definitions to provide both a C interface and a C++ object oriented 
+ * interface to COM interfaces. The type of interface is selected automatically 
+ * depending on the language but it is always possible to get the C interface in C++ 
+ * by defining CINTERFACE.
+ *
+ * It is based on the following assumptions:
+ *  - all COM interfaces derive from IUnknown, this should not be a problem.
+ *  - the header file only defines the interface, the actual fields are defined 
+ *    separately in the C file implementing the interface.
+ *
+ * The natural approach to this problem would be to make sure we get a C++ class and 
+ * virtual methods in C++ and a structure with a table of pointer to functions in C.
+ * Unfortunately the layout of the virtual table is compiler specific, the layout of 
+ * g++ virtual tables is not the same as that of an egcs virtual table which is not the 
+ * same as that generated by Visual C+. There are workarounds to make the virtual tables 
+ * compatible via padding but unfortunately the one which is imposed to the WINE emulator
+ * by the Windows binaries, i.e. the Visual C++ one, is the most compact of all.
+ *
+ * So the solution I finally adopted does not use virtual tables. Instead I use inline 
+ * non virtual methods that dereference the method pointer themselves and perform the call.
+ *
+ * Let's take Direct3D as an example:
+ *
+ *    #define ICOM_INTERFACE IDirect3D
+ *    ICOM_BEGIN(IDirect3D,IUnknown)
+ *        ICOM_METHOD1(HRESULT,Initialize,    REFIID,);
+ *        ICOM_METHOD2(HRESULT,EnumDevices,   LPD3DENUMDEVICESCALLBACK,, LPVOID,);
+ *        ICOM_METHOD2(HRESULT,CreateLight,   LPDIRECT3DLIGHT*,, IUnknown*,);
+ *        ICOM_METHOD2(HRESULT,CreateMaterial,LPDIRECT3DMATERIAL*,, IUnknown*,);
+ *        ICOM_METHOD2(HRESULT,CreateViewport,LPDIRECT3DVIEWPORT*,, IUnknown*,);
+ *        ICOM_METHOD2(HRESULT,FindDevice,    LPD3DFINDDEVICESEARCH,, LPD3DFINDDEVICERESULT,);
+ *    ICOM_END(IDirect3D)
+ *    #undef ICOM_INTERFACE
+ *
+ *    #if !defined(__cplusplus) || defined(CINTERFACE)
+ *    // *** IUnknown methods *** //
+ *    #define IDirect3D_QueryInterface(p,a,b) ICOM_ICALL2(IUnknown,QueryInterface,p,a,b)
+ *    #define IDirect3D_AddRef(p)             ICOM_ICALL (IUnknown,AddRef,p)
+ *    #define IDirect3D_Release(p)            ICOM_ICALL (IUnknown,Release,p)
+ *    // *** IDirect3D methods *** //
+ *    #define IDirect3D_Initialize(p,a)       ICOM_CALL1(Initialize,p,a)
+ *    #define IDirect3D_EnumDevices(p,a,b)    ICOM_CALL2(EnumDevice,p,a,b)
+ *    #define IDirect3D_CreateLight(p,a,b)    ICOM_CALL2(CreateLight,p,a,b)
+ *    #define IDirect3D_CreateMaterial(p,a,b) ICOM_CALL2(CreateMaterial,p,a,b)
+ *    #define IDirect3D_CreateViewport(p,a,b) ICOM_CALL2(CreateViewport,p,a,b)
+ *    #define IDirect3D_FindDevice(p,a,b)     ICOM_CALL2(FindDevice,p,a,b)
+ *    #endif
+ *
+ * Comments:
+ *  - The ICOM_INTERFACE is used in the ICOM_METHOD macros for the 'this' pointer and to cast 
+ *    pointers. Defining this macro here saves us the trouble of having to repeat the interface 
+ *    name everywhere. Note haowever that because of the way macros work a macro like ICOM_METHOD1 
+ *    cannot use 'ICOM_INTERFACE##_VTABLE' because this would give 'ICOM_INTERFACE_VTABLE' and not 
+ *    'IDirect3D_VTABLE'.
+ *  - ICOM_BEGIN and ICOM_END are responsible for generating whatever structure is appropriate for 
+ *    representing the interface in the current language. In C this is a couple of structs in C++ 
+ *    it's a class. The first parameter is the interface name and the second one is the interface 
+ *    we inherit from. The reason why you have to repeat the interface name is because that's the 
+ *    only way these macro can successfully output "IDirect3D_VTABLE'. Trying to use ICOM_INTERFACE 
+ *    would, as in ICOM_METHOD, only yield 'ICOM_INTERFACE_VTABLE'.
+ *  - With the way ICOM_BEGIN works you don't have to repeat the definitions of the methods of the 
+ *    parent interface. They are automatically inherited both in C and in C++.
+ *  - In C++ the ICOM_METHOD macros generate a function prototype and a call to a function pointer 
+ *    method. This means using once 't1 p1, t2 p2, ...' and once 'p1, p2' without the types. The 
+ *    only way I found to handle this is to have one ICOM_METHOD macro per number of parameters and 
+ *    to have it take only the type information (with const if necessary) as parameters.
+ *    The 'undef ICOM_INTERFACE' is here to remind you that using ICOM_INTERFACE in the following 
+ *    macros will not work. This time it's because the ICOM_CALL macro expansion is done only once 
+ *    the 'IDirect3D_Xxx' macro is expanded. And by that time ICOM_INTERFACE will be long gone 
+ *    anyway.
+ *  - You may have noticed the double commas after each parameter type. This allows you to put the 
+ *    name of that parameter which I think is good for documentation. It is not required and since 
+ *    I did not know what to put there for this example (I could only find doc about IDirect3D2), 
+ *    I left them blank.
+ *  - Finally the set of 'IDirect3D_Xxx' macros is a standard set of macros defined to ease access 
+ *    to the interface methods in C. Unfortunately I don't see any way to avoid having to duplicate 
+ *    the inherited method definitions there. We must use ICOM_ICALL to invoke inherited methods, 
+ *    because in C we have to cast the virtual table pointer, and we should use the ICOM_CALL 
+ *    method in the other cases. This time I could have used a trick to use only one macro whatever 
+ *    the number of parameters but I prefered to have it work the same way as above.
+ *  - You probably have noticed that we don't define the fields we need to actually implement this 
+ *    interface: reference count, pointer to other resources and miscellaneous fields. That's 
+ *    because it's not needed, and the user will anyway only manipulate pointers to this structure
+ *    so he does not need to know its real size. Of course on the implementation side we have the 
+ *    real definition of the interface structure and they should match what the macros yield in 
+ *    each language (or conversely).
+ *
+ *
+ * In C this gives:
+ *    typedef struct IDirect3D_VTABLE IDirect3D_VTABLE;
+ *    struct IDirect3D {
+ *        IDirect3D_VTABLE* lpvtbl;
+ *    };
+ *    struct IDirect3D_VTABLE {
+ *        IUnknown_VTABLE bvt;
+ *        HRESULT (*fnInitialize)(IDirect3D* me, REFIID a);
+ *        HRESULT (*fnEnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b);
+ *        HRESULT (*fnCreateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b);
+ *        HRESULT (*fnCreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b);
+ *        HRESULT (*fnCreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b);
+ *        HRESULT (*fnFindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b);
+ *    }; 
+ *
+ *    #if !defined(__cplusplus) || defined(CINTERFACE)
+ *    // *** IUnknown methods *** //
+ *    #define IDirect3D_QueryInterface(p,a,b) ((IUnknown_VTABLE*)(p)->lpvtbl)->fnQueryInterface((IUnknown*)p,a,b)
+ *    #define IDirect3D_AddRef(p)             ((IUnknown_VTABLE*)(p)->lpvtbl)->fnAddRef((IUnknown*)p)
+ *    #define IDirect3D_Release(p)            ((IUnknown_VTABLE*)(p)->lpvtbl)->fnRelease((IUnknown*)p)
+ *    // *** IDirect3D methods *** //
+ *    #define IDirect3D_Initialize(p,a)       (p)->lpvtbl->fnInitialize(p,a)
+ *    #define IDirect3D_EnumDevices(p,a,b)    (p)->lpvtbl->fnEnumDevice(p,a,b)
+ *    #define IDirect3D_CreateLight(p,a,b)    (p)->lpvtbl->fnCreateLight(p,a,b)
+ *    #define IDirect3D_CreateMaterial(p,a,b) (p)->lpvtbl->fnCreateMaterial(p,a,b)
+ *    #define IDirect3D_CreateViewport(p,a,b) (p)->lpvtbl->fnCreateViewport(p,a,b)
+ *    #define IDirect3D_FindDevice(p,a,b)     (p)->lpvtbl->fnFindDevice(p,a,b)
+ *    #endif
+ *
+ * Comments:
+ *  - IDirect3D only contains a pointer to the IDirect3D virtual/jump table. This is the only thing 
+ *    the user needs to know to use the interface. Of course the structure we will define to 
+ *    implement this interface will have more fields but the first one will match this pointer.
+ *  - The code generated by ICOM_BEGIN goes up to the bvt field in the IDirect3D virtual table. 
+ *    This bvt field is what saves us from having to duplicate the inherited method definitions.
+ *    It's a shame that C (gcc) will not allow unnamed structs. If this was possible we could 
+ *    seamlessly inherit and use the parent's interface function pointers.
+ *  - What follows is just a bunch of function pointer definitions generated by the ICOM_METHOD 
+ *    macros. The implementation will fill this jump table with appropriate values in a static 
+ *    variable and initialize the lpvtbl field to point to this variable.
+ *  - The IDirect3D_Xxx macros then just derefence the lpvtbl pointer and use the function pointer 
+ *    corresponding to the macro name. This emulates the behavior of a virtual table and should be 
+ *    about as fast. In the case of inherited methods we have some additional casting to do to 
+ *    because the inherited methods are defined in the bvt field or maybe further imbricated. Since 
+ *    the effect of the bvt field is that we inherit the parent virtual table fields this cast is 
+ *    relatively inocuous. A similar cast must be performed on the interface pointer before the 
+ *    invoked method will accept it. Despite all these casts there is little chance that you call a 
+ *    method on the wrong type of interface because the function names still have to match. But this 
+ *    is the only thing that will make the compilation fail.
+ *
+ *
+ * And in C++ (with gcc's g++):
+ *
+ *    typedef struct IDirect3D: public IUnknown {
+ *        private: HRESULT (*fnInitialize)(IDirect3D* me, REFIID a);
+ *        public: inline HRESULT Initialize(REFIID a) { return ((IDirect3D*)t.lpvtbl)->fnInitialize(this,a); };
+ *        private: HRESULT (*fnEnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b);
+ *        public: inline HRESULT EnumDevices(LPD3DENUMDEVICESCALLBACK a, LPVOID b)
+ *            { return ((IDirect3D*)t.lpvtbl)->fnEnumDevices(this,a,b); };
+ *        private: HRESULT (*fnCreateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b);
+ *        public: inline HRESULT CreateLight(LPDIRECT3DLIGHT* a, IUnknown* b)
+ *            { return ((IDirect3D*)t.lpvtbl)->fnCreateLight(this,a,b); };
+ *        private: HRESULT (*fnCreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b);
+ *        public: inline HRESULT CreateMaterial(LPDIRECT3DMATERIAL* a, IUnknown* b)
+ *            { return ((IDirect3D*)t.lpvtbl)->fnCreateMaterial(this,a,b); };
+ *        private: HRESULT (*fnCreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b);
+ *        public: inline HRESULT CreateViewport(LPDIRECT3DVIEWPORT* a, IUnknown* b)
+ *            { return ((IDirect3D*)t.lpvtbl)->fnCreateViewport(this,a,b); };
+ *        private:  HRESULT (*fnFindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b);
+ *        public: inline HRESULT FindDevice(LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b)
+ *            { return ((IDirect3D*)t.lpvtbl)->fnFindDevice(this,a,b); };
+ *    }; 
+ *
+ * Comments:
+ *  - In C++ IDirect3D does double duty as both the virtual/jump table and as the interface 
+ *    definition. The reason for this is to avoid having to duplicate the mehod definitions: once 
+ *    to have the function pointers in the jump table and once to have the methods in the interface 
+ *    class. Here one macro can generate both. This means though that the first pointer, t.lpvtbl 
+ *    defined in IUnknown,  must be interpreted as the jump table pointer if we interpret the 
+ *    structure as the the interface class, and as the function pointer to the QueryInterface 
+ *    method, t.fnQueryInterface, if we interpret the structure as the jump table. Fortunately this 
+ *    gymnastic is entirely taken care of in the header of IUnknown.
+ *  - Of course in C++ we use inheritance so that we don't have to duplicate the method definitions. 
+ *  - Since IDirect3D does double duty, each ICOM_METHOD macro defines both a function pointer and 
+ *    a non-vritual inline method which dereferences it and calls it. This way this method behaves 
+ *    just like a virtual method but does not create a true C++ virtual table which would break the 
+ *    structure layout. If you look at the implementation of these methods you'll notice that they 
+ *    would not work for void functions. We have to return something and fortunately this seems to 
+ *    be what all the COM methods do (otherwise we would need another set of macros).
+ *  - Note how the ICOM_METHOD generates both function prototypes mixing types and formal parameter 
+ *    names and the method invocation using only the formal parameter name. This is the reason why 
+ *    we need different macros to handle different numbers of parameters.
+ *  - Finally there is no IDirect3D_Xxx macro. These are not needed in C++ unless the CINTERFACE 
+ *    macro is defined in which case we would not be here.
+ *
+ *
+ * Implementing a COM interface.
+ *
+ * This continues the above example.I assume the implementation is in C but it would probably 
+ * be similar in C++.
+ *
+ *    typedef struct _IDirect3D {
+ *        void* lpvtbl;
+ *        // ...
+ *
+ *    } _IDirect3D;
+ *
+ *    static ICOM_VTABLE(IDirect3D) d3dvt;
+ *
+ *    // implement the IDirect3D methods here
+ *
+ *    int IDirect3D_fnQueryInterface(LPUNKNOWN me)
+ *    {
+ *        ICOM_THIS(IDirect3D,me);
+ *        // ...
+ *    }
+ *
+ *    // ...
+ *
+ *    static ICOM_VTABLE(IDirect3D) d3dvt = {
+ *        {
+ *            IDirect3D_fnQueryInterface,
+ *            IUnknown_fnAdd,
+ *            IUnknown_fnAdd2
+ *        },
+ *        IDirect3D_fnInitialize,
+ *        IDirect3D_fnSetWidth
+ *    };
+ *
+ * Comments:
+ *  - We first define what the interface really contains. This is th e_IDirect3D structure. The 
+ *    first field must of course be the virtual table pointer. Everything else is free.
+ *  - Then we predeclare our static virtual table variable, we will need its address in some 
+ *    methods to initialize the virtual table pointer of the returned interface objects.
+ *  - Then we implement the interface methods. To match what has been declared in the header file 
+ *    they must take a pointer to a IDirect3D structure so we must cast it to an _IDirect3D so that 
+ *    we can manipulate the fields. This is performed by the ICOM_THIS macro.
+ *  - Finally we initialize the virtual table. The inherited methods must be in curly brackets to 
+ *    match the parent interface's virtual table definition.
+ */
+
+
+#define ICOM_VTABLE(iface)       iface##_VTABLE
+
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+/* C++ interface */
+
+#define ICOM_BEGIN(iface,ibase) \
+    typedef struct iface: public ibase {
+
+
+#define ICOM_METHOD(ret,xfn) \
+    private: ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me); \
+    public: inline ret (CALLBACK xfn)(void) { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this); };
+
+#define ICOM_METHOD1(ret,xfn,ta,na) \
+    private: ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a); \
+    public: inline ret (CALLBACK xfn)(ta a) { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a); };
+
+#define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \
+    private: ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b); \
+    public: inline ret (CALLBACK xfn)(ta a,tb b) { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b); };
+
+#define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
+    private: ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c); \
+    public: inline ret (CALLBACK xfn)(ta a,tb b,tc c) { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c); };
+
+#define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
+    private: ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d); \
+    public: inline ret (CALLBACK xfn)(ta a,tb b,tc c,td d) { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d); };
+
+#define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
+    private: ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e); \
+    public: inline ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e) { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d,e); };
+
+#define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
+    private: ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f); \
+    public: inline ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f) { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d,e,f); };
+
+#define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
+    private: ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g); \
+    public: inline ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d,e,f,g); };
+
+
+#define ICOM_CMETHOD(ret,xfn) \
+    private: ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me); \
+    public: inline ret (CALLBACK xfn)(void) const { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this); };
+
+#define ICOM_CMETHOD1(ret,xfn,ta,na) \
+    private: ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a); \
+    public: inline ret (CALLBACK xfn)(ta a) const { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a); };
+
+#define ICOM_CMETHOD2(ret,xfn,ta,na,tb,nb) \
+    private: ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b); \
+    public: inline ret (CALLBACK xfn)(ta a,tb b) const { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b); };
+
+#define ICOM_CMETHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
+    private: ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c); \
+    public: inline ret (CALLBACK xfn)(ta a,tb b,tc c) const { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c); };
+
+#define ICOM_CMETHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
+    private: ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d); \
+    public: inline ret (CALLBACK xfn)(ta a,tb b,tc c,td d) const { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d); };
+
+#define ICOM_CMETHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
+    private: ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e); \
+    public: inline ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e) const { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d,e); };
+
+#define ICOM_CMETHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
+    private: ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f); \
+    public: inline ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f) const { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d,e,f); };
+
+#define ICOM_CMETHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
+    private: ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g); \
+    public: inline ret (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) const { return ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d,e,f,g); };
+
+
+#define ICOM_VMETHOD(xfn) \
+    private: void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me); \
+    public: inline void (CALLBACK xfn)(void) { ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this); };
+
+#define ICOM_VMETHOD1(xfn,ta,na) \
+    private: void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a); \
+    public: inline void (CALLBACK xfn)(ta a) { ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a); };
+
+#define ICOM_VMETHOD2(xfn,ta,na,tb,nb) \
+    private: void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b); \
+    public: inline void (CALLBACK xfn)(ta a,tb b) { ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b); };
+
+#define ICOM_VMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
+    private: void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c); \
+    public: inline void (CALLBACK xfn)(ta a,tb b,tc c) { ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c); };
+
+#define ICOM_VMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
+    private: void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d); \
+    public: inline void (CALLBACK xfn)(ta a,tb b,tc c,td d) { ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d); };
+
+#define ICOM_VMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
+    private: void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e); \
+    public: inline void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e) { ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d,e); };
+
+#define ICOM_VMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
+    private: void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f); \
+    public: inline void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f) { ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d,e,f); };
+
+#define ICOM_VMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
+    private: void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g); \
+    public: inline void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) { ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d,e,f,g); };
+
+
+#define ICOM_CVMETHOD(xfn) \
+    private: void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me); \
+    public: inline void (CALLBACK xfn)(void) const { ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this); };
+
+#define ICOM_CVMETHOD1(xfn,ta,na) \
+    private: void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a); \
+    public: inline void (CALLBACK xfn)(ta a) const { ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a); };
+
+#define ICOM_CVMETHOD2(xfn,ta,na,tb,nb) \
+    private: void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b); \
+    public: inline void (CALLBACK xfn)(ta a,tb b) const { ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b); };
+
+#define ICOM_CVMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
+    private: void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c); \
+    public: inline void (CALLBACK xfn)(ta a,tb b,tc c) const { ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c); };
+
+#define ICOM_CVMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
+    private: void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d); \
+    public: inline void (CALLBACK xfn)(ta a,tb b,tc c,td d) const { ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d); };
+
+#define ICOM_CVMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
+    private: void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e); \
+    public: inline void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e) const { ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d,e); };
+
+#define ICOM_CVMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
+    private: void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f); \
+    public: inline void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f) const { ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d,e,f); };
+
+#define ICOM_CVMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
+    private: void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g); \
+    public: inline void (CALLBACK xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) const { ((ICOM_INTERFACE*)t.lpvtbl)->fn##xfn(this,a,b,c,d,e,f,g); };
+
+
+#define ICOM_END(iface) \
+    };
+
+#define ICOM_ICALL(ibase, xfn, p)                this_is_a_syntax_error
+#define ICOM_ICALL1(ibase, xfn, p,a)             this_is_a_syntax_error
+#define ICOM_ICALL2(ibase, xfn, p,a,b)           this_is_a_syntax_error
+#define ICOM_ICALL3(ibase, xfn, p,a,b,c)         this_is_a_syntax_error
+#define ICOM_ICALL4(ibase, xfn, p,a,b,c,d)       this_is_a_syntax_error
+#define ICOM_ICALL5(ibase, xfn, p,a,b,c,d,e)     this_is_a_syntax_error
+#define ICOM_ICALL6(ibase, xfn, p,a,b,c,d,e,f)   this_is_a_syntax_error
+#define ICOM_ICALL7(ibase, xfn, p,a,b,c,d,e,f,g) this_is_a_syntax_error
+
+#define ICOM_CALL(xfn, p)                        this_is_a_syntax_error
+#define ICOM_CALL1(xfn, p,a)                     this_is_a_syntax_error
+#define ICOM_CALL2(xfn, p,a,b)                   this_is_a_syntax_error
+#define ICOM_CALL3(xfn, p,a,b,c)                 this_is_a_syntax_error
+#define ICOM_CALL4(xfn, p,a,b,c,d)               this_is_a_syntax_error
+#define ICOM_CALL5(xfn, p,a,b,c,d,e)             this_is_a_syntax_error
+#define ICOM_CALL6(xfn, p,a,b,c,d,e,f)           this_is_a_syntax_error
+#define ICOM_CALL7(xfn, p,a,b,c,d,e,f,g)         this_is_a_syntax_error
+
+
+#else
+/* C interface */
+
+
+#define ICOM_BEGIN(iface,ibase) \
+    typedef struct ICOM_VTABLE(iface) ICOM_VTABLE(iface); \
+    struct iface { \
+        const ICOM_VTABLE(iface)* lpvtbl; \
+    }; \
+    struct ICOM_VTABLE(iface) { \
+        ICOM_VTABLE(ibase) bvt;
+
+
+#define ICOM_METHOD(ret,xfn) \
+    ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me);
+
+#define ICOM_METHOD1(ret,xfn,ta,na) \
+    ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a);
+
+#define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \
+    ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b);
+
+#define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
+    ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c);
+
+#define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
+    ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
+
+#define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
+    ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
+
+#define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
+    ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
+
+#define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
+    ret (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
+
+
+#define ICOM_CMETHOD(ret,xfn) \
+        ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me);
+
+#define ICOM_CMETHOD1(ret,xfn,ta,na) \
+    ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a);
+
+#define ICOM_CMETHOD2(ret,xfn,ta,na,tb,nb) \
+    ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b);
+
+#define ICOM_CMETHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \
+    ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c);
+
+#define ICOM_CMETHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \
+    ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
+
+#define ICOM_CMETHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
+    ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
+
+#define ICOM_CMETHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
+    ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
+
+#define ICOM_CMETHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
+    ret (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
+
+
+#define ICOM_VMETHOD(xfn) \
+    void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me);
+
+#define ICOM_VMETHOD1(xfn,ta,na) \
+    void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a);
+
+#define ICOM_VMETHOD2(xfn,ta,na,tb,nb) \
+    void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b);
+
+#define ICOM_VMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
+    void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c);
+
+#define ICOM_VMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
+    void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
+
+#define ICOM_VMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
+    void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
+
+#define ICOM_VMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
+    void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
+
+#define ICOM_VMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
+    void (CALLBACK *fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
+
+
+#define ICOM_CVMETHOD(xfn) \
+        void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me);
+
+#define ICOM_CVMETHOD1(xfn,ta,na) \
+    void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a);
+
+#define ICOM_CVMETHOD2(xfn,ta,na,tb,nb) \
+    void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b);
+
+#define ICOM_CVMETHOD3(xfn,ta,na,tb,nb,tc,nc) \
+    void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c);
+
+#define ICOM_CVMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \
+    void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d);
+
+#define ICOM_CVMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \
+    void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e);
+
+#define ICOM_CVMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \
+    void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f);
+
+#define ICOM_CVMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \
+    void (CALLBACK *fn##xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g);
+
+
+#define ICOM_END(iface) \
+    };
+
+#define ICOM_ICALL(ibase, xfn, p)  ((ICOM_VTABLE(ibase)*)(p)->lpvtbl)->fn##xfn((ibase*)p)
+#define ICOM_ICALL1(ibase, xfn, p,a) ((ICOM_VTABLE(ibase)*)(p)->lpvtbl)->fn##xfn((ibase*)p,a)
+#define ICOM_ICALL2(ibase, xfn, p,a,b) ((ICOM_VTABLE(ibase)*)(p)->lpvtbl)->fn##xfn((ibase*)p,a,b)
+#define ICOM_ICALL3(ibase, xfn, p,a,b,c) ((ICOM_VTABLE(ibase)*)(p)->lpvtbl)->fn##xfn((ibase*)p,a,b,c)
+#define ICOM_ICALL4(ibase, xfn, p,a,b,c,d) ((ICOM_VTABLE(ibase)*)(p)->lpvtbl)->fn##xfn((ibase*)p,a,b,c,d)
+#define ICOM_ICALL5(ibase, xfn, p,a,b,c,d,e) ((ICOM_VTABLE(ibase)*)(p)->lpvtbl)->fn##xfn((ibase*)p,a,b,c,d,e)
+#define ICOM_ICALL6(ibase, xfn, p,a,b,c,d,e,f) ((ICOM_VTABLE(ibase)*)(p)->lpvtbl)->fn##xfn((ibase*)p,a,b,c,d,e,f)
+#define ICOM_ICALL7(ibase, xfn, p,a,b,c,d,e,f,g) ((ICOM_VTABLE(ibase)*)(p)->lpvtbl)->fn##xfn((ibase*)p,a,b,c,d,e,f,g)
+
+#define ICOM_CALL(xfn, p)  (p)->lpvtbl->fn##xfn(p)
+#define ICOM_CALL1(xfn, p,a) (p)->lpvtbl->fn##xfn(p,a)
+#define ICOM_CALL2(xfn, p,a,b) (p)->lpvtbl->fn##xfn(p,a,b)
+#define ICOM_CALL3(xfn, p,a,b,c) (p)->lpvtbl->fn##xfn(p,a,b,c)
+#define ICOM_CALL4(xfn, p,a,b,c,d) (p)->lpvtbl->fn##xfn(p,a,b,c,d)
+#define ICOM_CALL5(xfn, p,a,b,c,d,e) (p)->lpvtbl->fn##xfn(p,a,b,c,d,e)
+#define ICOM_CALL6(xfn, p,a,b,c,d,e,f) (p)->lpvtbl->fn##xfn(p,a,b,c,d,e,f)
+#define ICOM_CALL7(xfn, p,a,b,c,d,e,f,g) (p)->lpvtbl->fn##xfn(p,a,b,c,d,e,f,g)
+
+
+#define ICOM_THIS(iface,me)          struct _##iface* this=(struct _##iface*)me
+#define ICOM_CTHIS(iface,me)         const _##iface* this=(const _##iface*)me
+
+#endif
+
+
+/*****************************************************************************
+ * Predeclare the interfaces
+ */
+DEFINE_OLEGUID(IID_IClassFactory,	0x00000001L, 0, 0);
+typedef struct IClassFactory IClassFactory, *LPCLASSFACTORY;
+
+DEFINE_OLEGUID(IID_IMalloc,		0x00000002L, 0, 0);
+typedef struct IMalloc16 IMalloc16,*LPMALLOC16;
+typedef struct IMalloc32 IMalloc32,*LPMALLOC32;
+DECL_WINELIB_TYPE(IMalloc)
+DECL_WINELIB_TYPE(LPMALLOC)
+
+DEFINE_OLEGUID(IID_IUnknown,		0x00000000L, 0, 0);
+typedef struct IUnknown IUnknown, *LPUNKNOWN;
+
+
+/*****************************************************************************
+ * IUnknown interface
+ */
+#define ICOM_INTERFACE IUnknown
+#if defined(__cplusplus) && !defined(CINTERFACE)
+struct IUnknown {
+    union {
+        const void* lpvtbl;
+        HRESULT (CALLBACK *fnQueryInterface)(IUnknown* me, REFIID riid, LPVOID* ppvObj);
+    } t;
+    inline int QueryInterface(REFIID a, LPVOID* b) { return ((IUnknown*)t.lpvtbl)->t.fnQueryInterface(this,a,b); }
+#else
+typedef struct ICOM_VTABLE(IUnknown) ICOM_VTABLE(IUnknown);
+struct IUnknown {
+    ICOM_VTABLE(IUnknown)* lpvtbl;
+};
+struct ICOM_VTABLE(IUnknown) {
+    ICOM_METHOD2(HRESULT,QueryInterface,REFIID,riid, LPVOID*,ppvObj)
+#endif
+
+    ICOM_METHOD (ULONG,AddRef)
+    ICOM_METHOD (ULONG,Release)
+#ifdef __WRC__
+}; /* FIXME: WRC does not support function macros and it is ICOM_END that is supposed to close the class */
+#else
+ICOM_END(IUnknown)
+#endif
+#undef ICOM_INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+/*** IUnknown methods ***/
+#define IUnknown_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
+#define IUnknown_AddRef(p)             ICOM_CALL (AddRef,p)
+#define IUnknown_Release(p)            ICOM_CALL (Release,p)
+#endif
+
+
+/*****************************************************************************
+ * IClassFactory interface
+ */
+#define ICOM_INTERFACE IClassFactory
+ICOM_BEGIN(IClassFactory,IUnknown)
+    ICOM_METHOD3(HRESULT,CreateInstance, LPUNKNOWN,pUnkOuter, REFIID,riid, LPVOID*,ppvObject);
+    ICOM_METHOD1(HRESULT,LockServer,     BOOL32,fLock);
+ICOM_END(IClassFactory)
+#undef ICOM_INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+/*** IUnknown methods ***/
+#define IClassFactory_QueryInterface(p,a,b) ICOM_ICALL2(IUnknown,QueryInterface,p,a,b)
+#define IClassFactory_AddRef(p)             ICOM_ICALL (IUnknown,AddRef,p)
+#define IClassFactory_Release(p)            ICOM_ICALL (IUnknown,Release,p)
+/*** IClassFactory methods ***/
+#define IClassFactory_CreateInstance(p,a,b,c) ICOM_CALL3(CreateInstance,p,a,b,c)
+#define IClassFactory_LockServer(p,a)         ICOM_CALL1(LockServer,p,a)
+#endif
+
+
+/*****************************************************************************
+ * IMalloc interface
+ */
+#define ICOM_INTERFACE IMalloc16
+ICOM_BEGIN(IMalloc16,IUnknown)
+    ICOM_METHOD1 (LPVOID,Alloc,       DWORD,cb);
+    ICOM_METHOD2 (LPVOID,Realloc,     LPVOID,pv, DWORD,cb);
+    ICOM_VMETHOD1(       Free,        LPVOID,pv);
+    ICOM_CMETHOD1(DWORD, GetSize,     LPVOID,pv);
+    ICOM_CMETHOD1(INT16, DidAlloc,    LPVOID,pv);
+    ICOM_METHOD  (LPVOID,HeapMinimize);
+ICOM_END(IMalloc16)
+#undef ICOM_INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+/*** IUnknown methods ***/
+#define IMalloc16_QueryInterface(p,a,b) ICOM_ICALL2(IUnknown,QueryInterface,p,a,b)
+#define IMalloc16_AddRef(p)             ICOM_ICALL (IUnknown,AddRef,p)
+#define IMalloc16_Release(p)            ICOM_ICALL (IUnknown,Release,p)
+/*** IMalloc16 methods ***/
+#define IMalloc16_Alloc(p,a)      ICOM_CALL1(Alloc,p,a)
+#define IMalloc16_Realloc(p,a,b)  ICOM_CALL2(Realloc,p,a,b)
+#define IMalloc16_Free(p,a)       ICOM_CALL1(Free,p,a)
+#define IMalloc16_GetSize(p,a)    ICOM_CALL1(GetSize,p,a)
+#define IMalloc16_DidAlloc(p,a)   ICOM_CALL1(DidAlloc,p,a)
+#define IMalloc16_HeapMinimize(p) ICOM_CALL (HeapMinimize,p)
+#endif
+
+
+#define ICOM_INTERFACE IMalloc32
+ICOM_BEGIN(IMalloc32,IUnknown)
+    ICOM_METHOD1 (LPVOID,Alloc,       DWORD,cb);
+    ICOM_METHOD2 (LPVOID,Realloc,     LPVOID,pv, DWORD,cb);
+    ICOM_VMETHOD1(       Free,        LPVOID,pv);
+    ICOM_CMETHOD1(DWORD, GetSize,     LPVOID,pv);
+    ICOM_CMETHOD1(INT32, DidAlloc,    LPVOID,pv);
+    ICOM_METHOD  (LPVOID,HeapMinimize);
+ICOM_END(IMalloc32)
+#undef ICOM_INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+/*** IUnknown methods ***/
+#define IMalloc32_QueryInterface(p,a,b) ICOM_ICALL2(IUnknown,QueryInterface,p,a,b)
+#define IMalloc32_AddRef(p)             ICOM_ICALL (IUnknown,AddRef,p)
+#define IMalloc32_Release(p)            ICOM_ICALL (IUnknown,Release,p)
+/*** IMalloc32 methods ***/
+#define IMalloc32_Alloc(p,a)      ICOM_CALL1(Alloc,p,a)
+#define IMalloc32_Realloc(p,a,b)  ICOM_CALL2(Realloc,p,a,b)
+#define IMalloc32_Free(p,a)       ICOM_CALL1(Free,p,a)
+#define IMalloc32_GetSize(p,a)    ICOM_CALL1(GetSize,p,a)
+#define IMalloc32_DidAlloc(p,a)   ICOM_CALL1(DidAlloc,p,a)
+#define IMalloc32_HeapMinimize(p) ICOM_CALL (HeapMinimize,p)
+
+#ifndef __WINE__
+/* Duplicated for WINELIB */
+/*** IUnknown methods ***/
+#define IMalloc_QueryInterface(p,a,b) ICOM_ICALL2(IUnknown,QueryInterface,p,a,b)
+#define IMalloc_AddRef(p)             ICOM_ICALL (IUnknown,AddRef,p)
+#define IMalloc_Release(p)            ICOM_ICALL (IUnknown,Release,p)
+/*** IMalloc methods ***/
+#define IMalloc_Alloc(p,a)      ICOM_CALL1(Alloc,p,a)
+#define IMalloc_Realloc(p,a,b)  ICOM_CALL2(Realloc,p,a,b)
+#define IMalloc_Free(p,a)       ICOM_CALL1(Free,p,a)
+#define IMalloc_GetSize(p,a)    ICOM_CALL1(GetSize,p,a)
+#define IMalloc_DidAlloc(p,a)   ICOM_CALL1(DidAlloc,p,a)
+#define IMalloc_HeapMinimize(p) ICOM_CALL (HeapMinimize,p)
+#endif
+#endif
+
+
+HRESULT WINAPI CoCreateStandardMalloc16(DWORD dwMemContext, LPMALLOC16* lpMalloc);
+#define CoCreateStandardMalloc WINELIB_NAME(CoCreateStandardMalloc)
+
+HRESULT WINAPI CoGetMalloc16(DWORD dwMemContext,LPMALLOC16* lpMalloc);
+HRESULT WINAPI CoGetMalloc32(DWORD dwMemContext,LPMALLOC32* lpMalloc);
+#define CoGetMalloc WINELIB_NAME(CoGetMalloc)
+
+
+#endif /* __WINE_WINE_OBJ_BASE_H */
diff --git a/include/wine/obj_channel.h b/include/wine/obj_channel.h
new file mode 100644
index 0000000..e6372c4
--- /dev/null
+++ b/include/wine/obj_channel.h
@@ -0,0 +1,60 @@
+/*
+ * Defines undocumented Microsoft COM interfaces and APIs seemingly related to some 'channel' notion.
+ *
+ * Depends on 'obj_base.h'.
+ */
+
+#ifndef __WINE_WINE_OBJ_CHANNEL_H
+#define __WINE_WINE_OBJ_CHANNEL_H
+
+
+/*****************************************************************************
+ * Predeclare the interfaces
+ */
+DEFINE_GUID   (IID_IChannelHook,	0x1008c4a0L, 0x7613, 0x11cf, 0x9a, 0xf1, 0x00, 0x20, 0xaf, 0x6e, 0x72, 0xf4);
+typedef struct IChannelHook IChannelHook,*LPCHANNELHOOK;
+
+DEFINE_GUID   (IID_IPSFactoryBuffer,	0xd5f569d0L, 0x593b, 0x101a, 0xb5, 0x69, 0x08, 0x00, 0x2b, 0x2d, 0xbf, 0x7a);
+typedef struct IPSFactoryBuffer IPSFactoryBuffer,*LPPSFACTORYBUFFER;
+
+DEFINE_GUID   (IID_IRpcChannelBuffer,	0xd5f56b60L, 0x593b, 0x101a, 0xb5, 0x69, 0x08, 0x00, 0x2b, 0x2d, 0xbf, 0x7a);
+typedef struct IRpcChannelBuffer IRpcChannelBuffer,*LPRPCCHANNELBUFFER;
+
+DEFINE_GUID   (IID_IRpcProxyBuffer,	0xd5f56a34L, 0x593b, 0x101a, 0xb5, 0x69, 0x08, 0x00, 0x2b, 0x2d, 0xbf, 0x7a);
+typedef struct IRpcProxyBuffer IRpcProxyBuffer,*LPRPCPROXYBUFFER;
+
+DEFINE_GUID   (IID_IRpcStubBuffer,	0xd5f56afcL, 0x593b, 0x101a, 0xb5, 0x69, 0x08, 0x00, 0x2b, 0x2d, 0xbf, 0x7a);
+typedef struct IRpcStubBuffer IRpcStubBuffer,*LPRPCSTUBBUFFER;
+
+
+/*****************************************************************************
+ * IChannelHook interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IPSFactoryBuffer interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IRpcChannelBuffer interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IRpcProxyBuffer interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IRpcStubBuffer interface
+ */
+/* FIXME: not implemented */
+
+
+#endif /* __WINE_WINE_OBJ_CHANNEL_H */
diff --git a/include/wine/obj_clientserver.h b/include/wine/obj_clientserver.h
new file mode 100644
index 0000000..81aa7c9
--- /dev/null
+++ b/include/wine/obj_clientserver.h
@@ -0,0 +1,57 @@
+/*
+ * Defines the COM interfaces and APIs related to client/server aspects.
+ *
+ * Depends on 'obj_base.h'.
+ */
+
+#ifndef __WINE_WINE_OBJ_CLIENTSERVER_H
+#define __WINE_WINE_OBJ_CLIENTSERVER_H
+
+
+/*****************************************************************************
+ * Predeclare the interfaces
+ */
+DEFINE_OLEGUID(IID_IClientSecurity,	0x0000013dL, 0, 0);
+typedef struct IClientSecurity IClientSecurity,*LPCLIENTSECURITY;
+
+DEFINE_OLEGUID(IID_IExternalConnection,	0x00000019L, 0, 0);
+typedef struct IExternalConnection IExternalConnection,*LPEXTERNALCONNECTION;
+
+DEFINE_OLEGUID(IID_IMessageFilter,	0x00000016L, 0, 0);
+typedef struct IMessageFilter IMessageFilter,*LPMESSAGEFILTER;
+
+DEFINE_OLEGUID(IID_IServerSecurity,	0x0000013eL, 0, 0);
+typedef struct IServerSecurity IServerSecurity,*LPSERVERSECURITY;
+
+
+/*****************************************************************************
+ * IClientSecurity interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IExternalConnection interface
+ */
+/* FIXME: not implemented */
+
+HRESULT WINAPI CoDisconnectObject(LPUNKNOWN lpUnk, DWORD reserved);
+
+
+/*****************************************************************************
+ * IMessageFilter interface
+ */
+/* FIXME: not implemented */
+
+HRESULT WINAPI CoRegisterMessageFilter16(LPMESSAGEFILTER lpMessageFilter,LPMESSAGEFILTER *lplpMessageFilter);
+HRESULT WINAPI CoRegisterMessageFilter32(LPMESSAGEFILTER lpMessageFilter,LPMESSAGEFILTER *lplpMessageFilter);
+#define CoRegisterMessageFilter WINELIB_NAME(CoRegisterMessageFilter)
+
+
+/*****************************************************************************
+ * IServerSecurity interface
+ */
+/* FIXME: not implemented */
+
+
+#endif /* __WINE_WINE_OBJ_CLIENTSERVER_H */
diff --git a/include/wine/obj_dataobject.h b/include/wine/obj_dataobject.h
new file mode 100644
index 0000000..4bc3bac
--- /dev/null
+++ b/include/wine/obj_dataobject.h
@@ -0,0 +1,192 @@
+/*
+ * Defines the COM interfaces and APIs related to IDataObject.
+ *
+ * Depends on 'obj_moniker.h', 'obj_storage.h' and 'obj_base.h'.
+ */
+
+#ifndef __WINE_WINE_OBJ_DATAOBJECT_H
+#define __WINE_WINE_OBJ_DATAOBJECT_H
+
+
+/*****************************************************************************
+ * Predeclare the structures
+ */
+typedef struct DVTARGETDEVICE32 DVTARGETDEVICE32, *LPDVTARGETDEVICE32;
+DECL_WINELIB_TYPE(DVTARGETDEVICE)
+DECL_WINELIB_TYPE(LPDVTARGETDEVICE)
+
+typedef struct FORMATETC32 FORMATETC32, *LPFORMATETC32;
+DECL_WINELIB_TYPE(FORMATETC)
+DECL_WINELIB_TYPE(LPFORMATETC)
+
+typedef struct STGMEDIUM32 STGMEDIUM32, *LPSTGMEDIUM32;
+DECL_WINELIB_TYPE(STGMEDIUM)
+DECL_WINELIB_TYPE(LPSTGMEDIUM)
+
+
+/*****************************************************************************
+ * Predeclare the interfaces
+ */
+DEFINE_OLEGUID(IID_IAdviseSink,		0x0000010fL, 0, 0);
+typedef struct IAdviseSink IAdviseSink,*LPADVISESINK;
+
+DEFINE_OLEGUID(IID_IAdviseSink2,	0x00000125L, 0, 0);
+typedef struct IAdviseSink2 IAdviseSink2,*LPADVISESINK2;
+
+DEFINE_OLEGUID(IID_IDataAdviseHolder,	0x00000110L, 0, 0);
+typedef struct IDataAdviseHolder IDataAdviseHolder,*LPDATAADVISEHOLDER;
+
+DEFINE_OLEGUID(IID_IDataObject,		0x0000010EL, 0, 0);
+typedef struct IDataObject IDataObject,*LPDATAOBJECT;
+
+DEFINE_OLEGUID(IID_IEnumFORMATETC,	0x00000103L, 0, 0);
+typedef struct IEnumFORMATETC IEnumFORMATETC,*LPENUMFORMATETC;
+
+DEFINE_OLEGUID(IID_IEnumSTATDATA,	0x00000105L, 0, 0);
+typedef struct IEnumSTATDATA IEnumSTATDATA,*LPENUMSTATDATA;
+
+
+/*****************************************************************************
+ * DVTARGETDEVICE structure
+ */
+struct DVTARGETDEVICE32
+{
+    DWORD tdSize;
+    WORD tdDriverNameOffset;
+    WORD tdDeviceNameOffset;
+    WORD tdPortNameOffset;
+    WORD tdExtDevmodeOffset;
+    BYTE tdData[1];
+};
+
+
+/*****************************************************************************
+ * FORMATETC structure
+ */
+/* wished data format */
+struct FORMATETC32
+{
+    CLIPFORMAT32 cfFormat;
+    DVTARGETDEVICE32* ptd;
+    DWORD dwAspect;
+    LONG lindex;
+    DWORD tymed;
+};
+
+
+/*****************************************************************************
+ * STGMEDIUM structure
+ */
+typedef enum tagTYMED
+{	TYMED_HGLOBAL   = 1,
+	TYMED_FILE      = 2,
+	TYMED_ISTREAM   = 4,
+	TYMED_ISTORAGE  = 8,
+	TYMED_GDI       = 16,
+	TYMED_MFPICT    = 32,
+	TYMED_ENHMF     = 64,
+	TYMED_NULL      = 0
+} TYMED;
+  
+/* dataobject as answer to a request */
+struct STGMEDIUM32
+{
+    DWORD tymed;
+    union {
+        HBITMAP32 hBitmap;
+        HMETAFILEPICT32 hMetaFilePict;
+        HENHMETAFILE32 hEnhMetaFile;
+        HGLOBAL32 hGlobal;
+        LPOLESTR32 lpszFileName;
+        IStream32 *pstm;
+        IStorage32 *pstg;
+    } u;
+    IUnknown *pUnkForRelease;
+};   
+
+
+/*****************************************************************************
+ * IAdviseSink interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IAdviseSink2 interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IDataAdviseHolder interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IDataObject interface
+ */
+#define ICOM_INTERFACE IDataObject
+ICOM_BEGIN(IDataObject,IUnknown)
+    ICOM_METHOD2(HRESULT,GetData,               LPFORMATETC32,pformatetcIn, STGMEDIUM32*,pmedium);
+    ICOM_METHOD2(HRESULT,GetDataHere,           LPFORMATETC32,pformatetc, STGMEDIUM32*,pmedium);
+    ICOM_METHOD1(HRESULT,QueryGetData,          LPFORMATETC32,pformatetc);
+    ICOM_METHOD2(HRESULT,GetCanonicalFormatEtc, LPFORMATETC32,pformatectIn, LPFORMATETC32,pformatetcOut);
+    ICOM_METHOD3(HRESULT,SetData,               LPFORMATETC32,pformatetc, STGMEDIUM32*,pmedium, BOOL32,fRelease);
+    ICOM_METHOD2(HRESULT,EnumFormatEtc,         DWORD,dwDirection, IEnumFORMATETC**,ppenumFormatEtc);
+    ICOM_METHOD4(HRESULT,DAdvise,               LPFORMATETC32*,pformatetc, DWORD,advf, IAdviseSink*,pAdvSink, DWORD*,pdwConnection);
+    ICOM_METHOD1(HRESULT,DUnadvise,             DWORD,dwConnection);
+    ICOM_METHOD1(HRESULT,EnumDAdvise,           IEnumSTATDATA**,ppenumAdvise);
+ICOM_END(IDataObject)
+#undef ICOM_INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+/*** IUnknown methods ***/
+#define IDataObject_QueryInterface(p,a,b) ICOM_ICALL2(IUnknown,QueryInterface,p,a,b)
+#define IDataObject_AddRef(p)             ICOM_ICALL (IUnknown,AddRef,p)
+#define IDataObject_Release(p)            ICOM_ICALL (IUnknown,Release,p)
+/*** IDataObject methods ***/
+#define IDataObject_GetData(p,a,b)               ICOM_CALL2(GetData,p,a,b)
+#define IDataObject_GetDataHere(p,a,b)           ICOM_CALL2(GetDataHere,p,a,b)
+#define IDataObject_QueryGetData(p,a)            ICOM_CALL1(QueryGetData,p,a)
+#define IDataObject_GetCanonicalFormatEtc(p,a,b) ICOM_CALL2(GetCanonicalFormatEtc,p,a,b)
+#define IDataObject_SetData(p,a,b,c)             ICOM_CALL3(SetData,p,a,b,c)
+#define IDataObject_EnumFormatEtc(p,a,b)         ICOM_CALL2(EnumFormatEtc,p,a,b)
+#define IDataObject_DAdvise(p,a,b,c,d)           ICOM_CALL4(DAdvise,p,a,b,c,d)
+#define IDataObject_DUnadvise(p,a)               ICOM_CALL1(DUnadvise,p,a)
+#define IDataObject_EnumDAdvise(p,a)             ICOM_CALL1(EnumDAdvise,p,a)
+#endif
+
+
+/*****************************************************************************
+ * IEnumFORMATETC interface
+ */
+#define ICOM_INTERFACE IEnumFORMATETC
+ICOM_BEGIN(IEnumFORMATETC,IUnknown)
+    ICOM_METHOD3(HRESULT,Next,  ULONG,celt, FORMATETC32*,rgelt, ULONG*,pceltFethed);
+    ICOM_METHOD1(HRESULT,Skip,  ULONG,celt);
+    ICOM_METHOD (HRESULT,Reset);
+    ICOM_METHOD1(HRESULT,Clone, IEnumFORMATETC**,ppenum);
+ICOM_END(IEnumFORMATETC)
+#undef ICOM_INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+/*** IUnknown methods ***/
+#define IEnumFORMATETC_QueryInterface(p,a,b) ICOM_ICALL2(IUnknown,QueryInterface,p,a,b)
+#define IEnumFORMATETC_AddRef(p)             ICOM_ICALL (IUnknown,AddRef,p)
+#define IEnumFORMATETC_Release(p)            ICOM_ICALL (IUnknown,Release,p)
+/*** IEnumFORMATETC methods ***/
+#define IEnumFORMATETC_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c)
+#define IEnumFORMATETC_Skip(p,a)     ICOM_CALL1(Skip,p,a)
+#define IEnumFORMATETC_Reset(p)      ICOM_CALL (Reset,p)
+#define IEnumFORMATETC_Clone(p,a)    ICOM_CALL1(Clone,p,a)
+#endif
+
+
+/*****************************************************************************
+ * IEnumSTATDATA interface
+ */
+/* FIXME: not implemented */
+
+
+#endif /* __WINE_WINE_OBJ_DATAOBJECT_H */
diff --git a/include/wine/obj_marshal.h b/include/wine/obj_marshal.h
new file mode 100644
index 0000000..92fc243
--- /dev/null
+++ b/include/wine/obj_marshal.h
@@ -0,0 +1,34 @@
+/*
+ * Defines the COM interfaces and APIs that allow an interface to 
+ * specify a custom marshaling for its objects.
+ *
+ * Depends on 'obj_storage.h' and 'obj_base.h'.
+ */
+
+#ifndef __WINE_WINE_OBJ_MARSHAL_H
+#define __WINE_WINE_OBJ_MARSHAL_H
+
+
+/*****************************************************************************
+ * Predeclare the interfaces
+ */
+DEFINE_OLEGUID(IID_IMarshal,		0x00000003L, 0, 0);
+typedef struct IMarshal IMarshal,*LPMARSHAL;
+
+DEFINE_OLEGUID(IID_IStdMarshalInfo,	0x00000018L, 0, 0);
+typedef struct IStdMarshalInfo IStdMarshalInfo,*LPSTDMARSHALINFO;
+
+
+/*****************************************************************************
+ * IMarshal interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IStdMarshalInfo interface
+ */
+/* FIXME: not implemented */
+
+
+#endif /* __WINE_WINE_OBJ_MARSHAL_H */
diff --git a/include/wine/obj_misc.h b/include/wine/obj_misc.h
new file mode 100644
index 0000000..98dc1e4
--- /dev/null
+++ b/include/wine/obj_misc.h
@@ -0,0 +1,54 @@
+/*
+ * Defines miscellaneous COM interfaces and APIs defined in objidl.h.
+ * These did not really fit into the other categories, whould have 
+ * required their own specific category or are too rarely used to be 
+ * put in 'obj_base.h'.
+ *
+ * Depends on 'obj_base.h'.
+ */
+
+#ifndef __WINE_WINE_OBJ_MISC_H
+#define __WINE_WINE_OBJ_MISC_H
+
+
+/*****************************************************************************
+ * Predeclare the interfaces
+ */
+DEFINE_OLEGUID(IID_IEnumString,		0x00000101L, 0, 0);
+typedef struct IEnumString IEnumString,*LPENUMSTRING;
+
+DEFINE_OLEGUID(IID_IEnumUnknown,	0x00000100L, 0, 0);
+typedef struct IEnumUnknown IEnumUnknown,*LPENUMUNKNOWN;
+
+DEFINE_OLEGUID(IID_IMallocSpy,		0x0000001dL, 0, 0);
+typedef struct IMallocSpy IMallocSpy,*LPMALLOCSPY;
+
+DEFINE_OLEGUID(IID_IMultiQI,		0x00000020L, 0, 0);
+typedef struct IMultiQI IMultiQI,*LPMULTIQI;
+
+
+/*****************************************************************************
+ * IEnumString interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IEnumUnknown interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IMallocSpy interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IMultiQI interface
+ */
+/* FIXME: not implemented */
+
+
+#endif /* __WINE_WINE_OBJ_MISC_H */
diff --git a/include/wine/obj_moniker.h b/include/wine/obj_moniker.h
new file mode 100644
index 0000000..194ddd0
--- /dev/null
+++ b/include/wine/obj_moniker.h
@@ -0,0 +1,87 @@
+/*
+ * Defines the COM interfaces and APIs related to the moniker functionality.
+ *
+ * This file depends on 'obj_storage.h' and 'obj_base.h'.
+ */
+
+
+#ifndef __WINE_WINE_OBJ_MONIKER_H
+#define __WINE_WINE_OBJ_MONIKER_H
+
+
+/*****************************************************************************
+ * Predeclare the interfaces
+ */
+DEFINE_OLEGUID(IID_IBindCtx,0xe,0,0);
+typedef struct IBindCtx IBindCtx,*LPBINDCTX;
+typedef LPBINDCTX LPBC;
+
+DEFINE_OLEGUID(IID_IClassActivator,	0x00000140L, 0, 0);
+typedef struct IClassActivator IClassActivator,*LPCLASSACTIVATOR;
+
+DEFINE_OLEGUID(IID_IEnumMoniker,	0x00000102L, 0, 0);
+typedef struct IEnumMoniker IEnumMoniker,*LPENUMMONIKER;
+
+DEFINE_OLEGUID(IID_IMoniker,		0x0000000fL, 0, 0);
+typedef struct IMoniker IMoniker,*LPMONIKER;
+
+DEFINE_GUID   (IID_IROTData,		0xf29f6bc0L, 0x5021, 0x11ce, 0xaa, 0x15, 0x00, 0x00, 0x69, 0x01, 0x29, 0x3f);
+typedef struct IROTData IROTData,*LPROTDATA;
+
+DEFINE_OLEGUID(IID_IRunnableObject,	0x00000126L, 0, 0);
+typedef struct IRunnableObject IRunnableObject,*LPRUNNABLEOBJECT;
+
+DEFINE_OLEGUID(IID_IRunningObjectTable,	0x00000010L, 0, 0);
+typedef struct IRunningObjectTable IRunningObjectTable,*LPRUNNINGOBJECTTABLE;
+
+
+/*****************************************************************************
+ * IBindCtx interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IClassActivator interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IEnumMoniker interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IMoniker interface
+ */
+/* FIXME: not implemented */
+
+HRESULT WINAPI CreateFileMoniker16(LPCOLESTR16 lpszPathName,LPMONIKER* ppmk);
+HRESULT WINAPI CreateFileMoniker32(LPCOLESTR32 lpszPathName,LPMONIKER* ppmk);
+#define CreateFileMoniker WINELIB_NAME(CreateFileMoniker)
+
+HRESULT WINAPI CreateItemMoniker32(LPCOLESTR32 lpszDelim,LPCOLESTR32 lpszItem,LPMONIKER* ppmk);
+#define CreateItemMoniker WINELIB_NAME(CreateItemMoniker)
+
+
+/*****************************************************************************
+ * IROTData interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IRunnableObject interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IRunningObjectTable interface
+ */
+/* FIXME: not implemented */
+
+
+#endif /* __WINE_WINE_OBJ_MONIKER_H */
diff --git a/include/wine/obj_propertystorage.h b/include/wine/obj_propertystorage.h
new file mode 100644
index 0000000..837daa1
--- /dev/null
+++ b/include/wine/obj_propertystorage.h
@@ -0,0 +1,52 @@
+/*
+ * Defines the COM interfaces and APIs related to saving properties to file.
+ *
+ * Depends on 'obj_storage.h' and 'obj_base.h'.
+ */
+
+#ifndef __WINE_WINE_OBJ_PROPERTYSTORAGE_H
+#define __WINE_WINE_OBJ_PROPERTYSTORAGE_H
+
+
+/*****************************************************************************
+ * Predeclare the interfaces
+ */
+DEFINE_OLEGUID(IID_IEnumSTATPROPSETSTG,	0x0000013bL, 0, 0);
+typedef struct IEnumSTATPROPSETSTG IEnumSTATPROPSETSTG,*LPENUMSTATPROPSETSTG;
+
+DEFINE_OLEGUID(IID_IEnumSTATPROPSTG,	0x00000139L, 0, 0);
+typedef struct IEnumSTATPROPSTG IEnumSTATPROPSTG,*LPENUMSTATPROPSTG;
+
+DEFINE_OLEGUID(IID_IPropertySetStorage,	0x0000013aL, 0, 0);
+typedef struct IPropertySetStorage IPropertySetStorage,*LPPROPERTYSETSTORAGE;
+
+DEFINE_OLEGUID(IID_IPropertyStorage,	0x00000138L, 0, 0);
+typedef struct IPropertyStorage IPropertyStorage,*LPPROPERTYSTORAGE;
+
+
+/*****************************************************************************
+ * IEnumSTATPROPSETSTG interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IEnumSTATPROPSTG interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IPropertySetStorage interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IPropertyStorage interface
+ */
+/* FIXME: not implemented */
+
+
+
+#endif /* __WINE_WINE_OBJ_PROPERTYSTORAGE_H */
diff --git a/include/wine/obj_storage.h b/include/wine/obj_storage.h
new file mode 100644
index 0000000..88797d6
--- /dev/null
+++ b/include/wine/obj_storage.h
@@ -0,0 +1,459 @@
+/*
+ * Defines the COM interfaces and APIs related to structured data storage.
+ *
+ * Depends on 'obj_base.h'.
+ */
+
+#ifndef __WINE_WINE_OBJ_STORAGE_H
+#define __WINE_WINE_OBJ_STORAGE_H
+
+
+#include "winnt.h"
+
+
+/*****************************************************************************
+ * Predeclare the structures
+ */
+typedef LPOLESTR16 *SNB16;
+typedef LPOLESTR32 *SNB32;
+DECL_WINELIB_TYPE(SNB)
+
+typedef struct STATSTG STATSTG;
+
+
+/*****************************************************************************
+ * Predeclare the interfaces
+ */
+DEFINE_OLEGUID(IID_IEnumSTATSTG,	0x0000000dL, 0, 0);
+typedef struct IEnumSTATSTG IEnumSTATSTG,*LPENUMSTATSTG;
+
+DEFINE_GUID   (IID_IFillLockBytes,	0x99caf010L, 0x415e, 0x11cf, 0x88, 0x14, 0x00, 0xaa, 0x00, 0xb5, 0x69, 0xf5);
+typedef struct IFillLockBytes IFillLockBytes,*LPFILLLOCKBYTES;
+
+DEFINE_GUID   (IID_ILayoutStorage,	0x0e6d4d90L, 0x6738, 0x11cf, 0x96, 0x08, 0x00, 0xaa, 0x00, 0x68, 0x0d, 0xb4);
+typedef struct ILayoutStorage ILayoutStorage,*LPLAYOUTSTORAGE;
+
+DEFINE_OLEGUID(IID_ILockBytes,		0x0000000aL, 0, 0);
+typedef struct ILockBytes ILockBytes,*LPLOCKBYTES;
+
+DEFINE_OLEGUID(IID_IPersist,		0x0000010cL, 0, 0);
+typedef struct IPersist IPersist,*LPPERSIST;
+
+DEFINE_OLEGUID(IID_IPersistFile,	0x0000010bL, 0, 0);
+typedef struct IPersistFile IPersistFile,*LPPERSISTFILE;
+
+DEFINE_OLEGUID(IID_IPersistStorage,	0x0000010aL, 0, 0);
+typedef struct IPersistStorage IPersistStorage,*LPPERSISTSTORAGE;
+
+DEFINE_OLEGUID(IID_IPersistStream,	0x00000109L, 0, 0);
+typedef struct IPersistStream IPersistStream,*LPPERSISTSTREAM;
+
+DEFINE_GUID   (IID_IProgressNotify,	0xa9d758a0L, 0x4617, 0x11cf, 0x95, 0xfc, 0x00, 0xaa, 0x00, 0x68, 0x0d, 0xb4);
+typedef struct IProgressNotify IProgressNotify,*LPPROGRESSNOTIFY;
+
+DEFINE_OLEGUID(IID_IRootStorage,	0x00000012L, 0, 0);
+typedef struct IRootStorage IRootStorage,*LPROOTSTORAGE;
+
+DEFINE_GUID   (IID_ISequentialStream,	0x0c733a30L, 0x2a1c, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d);
+typedef struct ISequentialStream ISequentialStream,*LPSEQUENTIALSTREAM;
+
+DEFINE_OLEGUID(IID_IStorage,		0x0000000bL, 0, 0);
+typedef struct IStorage16 IStorage16,*LPSTORAGE16;
+typedef struct IStorage32 IStorage32,*LPSTORAGE32;
+DECL_WINELIB_TYPE(IStorage)
+DECL_WINELIB_TYPE(LPSTORAGE)
+
+DEFINE_OLEGUID(IID_IStream,		0x0000000cL, 0, 0);
+typedef struct IStream16 IStream16,*LPSTREAM16;
+typedef struct IStream32 IStream32,*LPSTREAM32;
+DECL_WINELIB_TYPE(IStream)
+DECL_WINELIB_TYPE(LPSTREAM)
+
+
+/*****************************************************************************
+ * STGM enumeration
+ *
+ * See IStorage and IStream
+ */
+#define STGM_DIRECT		0x00000000
+#define STGM_TRANSACTED		0x00010000
+#define STGM_SIMPLE		0x08000000
+#define STGM_READ		0x00000000
+#define STGM_WRITE		0x00000001
+#define STGM_READWRITE		0x00000002
+#define STGM_SHARE_DENY_NONE	0x00000040
+#define STGM_SHARE_DENY_READ	0x00000030
+#define STGM_SHARE_DENY_WRITE	0x00000020
+#define STGM_SHARE_EXCLUSIVE	0x00000010
+#define STGM_PRIORITY		0x00040000
+#define STGM_DELETEONRELEASE	0x04000000
+#define STGM_CREATE		0x00001000
+#define STGM_CONVERT		0x00020000
+#define STGM_FAILIFTHERE	0x00000000
+#define STGM_NOSCRATCH		0x00100000
+#define STGM_NOSNAPSHOT		0x00200000
+
+
+/*****************************************************************************
+ * STATSTG structure
+ */
+struct STATSTG {
+    LPOLESTR16	pwcsName;
+    DWORD	type;
+    ULARGE_INTEGER cbSize;
+    FILETIME	mtime;
+    FILETIME	ctime;
+    FILETIME	atime;
+    DWORD	grfMode;
+    DWORD	grfLocksSupported;
+    CLSID	clsid;
+    DWORD	grfStateBits;
+    DWORD	reserved;
+};
+
+
+/*****************************************************************************
+ * IEnumSTATSTG interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IFillLockBytes interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * ILayoutStorage interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * ILockBytes interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IPersist interface
+ */
+#define ICOM_INTERFACE IPersist
+ICOM_BEGIN(IPersist,IUnknown)
+    ICOM_CMETHOD1(HRESULT,GetClassID, CLSID*,pClassID);
+ICOM_END(IPersist)
+#undef ICOM_INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+/*** IUnknown methods ***/
+#define IPersist_QueryInterface(p,a,b) ICOM_ICALL2(IUnknown,QueryInterface,p,a,b)
+#define IPersist_AddRef(p)             ICOM_ICALL (IUnknown,AddRef,p)
+#define IPersist_Release(p)            ICOM_ICALL (IUnknown,Release,p)
+/*** IPersist methods ***/
+#define IPersist_GetClassID(p,a) ICOM_CALL1(GetClassID,p,a)
+#endif
+
+
+/*****************************************************************************
+ * IPersistFile interface
+ */
+#define ICOM_INTERFACE IPersistFile
+ICOM_BEGIN(IPersistFile,IPersist)
+    ICOM_CMETHOD (HRESULT,IsDirty);
+    ICOM_METHOD2 (HRESULT,Load,          LPCOLESTR32,pszFileName, DWORD,dwMode);
+    ICOM_METHOD2 (HRESULT,Save,          LPCOLESTR32,pszFileName, BOOL32,fRemember);
+    ICOM_METHOD1 (HRESULT,SaveCompleted, LPCOLESTR32,pszFileName);
+    ICOM_CMETHOD1(HRESULT,GetCurFile,    LPOLESTR32*,ppszFileName);
+ICOM_END(IPersistFile)
+#undef ICOM_INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+/*** IUnknown methods ***/
+#define IPersistFile_QueryInterface(p,a,b) ICOM_ICALL2(IUnknown,QueryInterface,p,a,b)
+#define IPersistFile_AddRef(p)             ICOM_ICALL (IUnknown,AddRef,p)
+#define IPersistFile_Release(p)            ICOM_ICALL (IUnknown,Release,p)
+/*** IPersist methods ***/
+#define IPersistFile_GetClassID(p,a) ICOM_ICALL1(IPersist,GetClassID,p,a)
+/*** IPersistFile methods ***/
+#define IPersistFile_IsDirty(p)         ICOM_CALL(IsDirty,p)
+#define IPersistFile_Load(p,a,b)        ICOM_CALL(Load,p,a,b)
+#define IPersistFile_Save(p,a,b)        ICOM_CALL(Save,p,a,b)
+#define IPersistFile_SaveCompleted(p,a) ICOM_CALL(SaveCompleted,p,a)
+#define IPersistFile_GetCurFile(p,a)    ICOM_CALL(GetCurFile,p,a)
+#endif
+
+
+/*****************************************************************************
+ * IPersistStorage interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IPersistStream interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IProgressNotify interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * IRootStorage interface
+ */
+/* FIXME: not implemented */
+
+
+/*****************************************************************************
+ * ISequentialStream interface
+ */
+#define ICOM_INTERFACE ISequentialStream
+ICOM_BEGIN(ISequentialStream,IUnknown)
+    ICOM_METHOD3(HRESULT,Read,        void*,pv, ULONG,cb, ULONG*,pcbRead);
+    ICOM_METHOD3(HRESULT,Write,       const void*,pv, ULONG,cb, ULONG*,pcbWritten);
+ICOM_END(ISequentialStream)
+#undef ICOM_INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+/*** IUnknown methods ***/
+#define ISequentialStream_QueryInterface(p,a,b) ICOM_ICALL2(IUnknown,QueryInterface,p,a,b)
+#define ISequentialStream_AddRef(p)             ICOM_ICALL (IUnknown,AddRef,p)
+#define ISequentialStream_Release(p)            ICOM_ICALL (IUnknown,Release,p)
+/*** ISequentialStream methods ***/
+#define ISequentialStream_Read(p,a,b,c)  ICOM_CALL3(Read,p,a,b,c)
+#define ISequentialStream_Write(p,a,b,c) ICOM_CALL3(Write,p,a,b,c)
+#endif
+
+
+/*****************************************************************************
+ * IStorage interface
+ */
+#define ICOM_INTERFACE IStorage16
+ICOM_BEGIN(IStorage16,IUnknown)
+    ICOM_METHOD5(HRESULT,CreateStream,   LPCOLESTR16,pwcsName, DWORD,grfMode, DWORD,reserved1, DWORD,reserved2, IStream16**,ppstm)
+    ICOM_METHOD5(HRESULT,OpenStream,     LPCOLESTR16,pwcsName, void*,reserved1, DWORD,grfMode, DWORD,reserved2, IStream16**,ppstm)
+    ICOM_METHOD5(HRESULT,CreateStorage,  LPCOLESTR16,pwcsName, DWORD,grfMode, DWORD,dwStgFmt, DWORD,reserved2, IStorage16**,ppstg)
+    ICOM_METHOD6(HRESULT,OpenStorage,    LPCOLESTR16,pwcsName, IStorage16*,pstgPriority, DWORD,grfMode, SNB16,snb16Exclude, DWORD,reserved, IStorage16**,ppstg)
+    ICOM_METHOD4(HRESULT,CopyTo,         DWORD,ciidExclude, const IID*,rgiidExclude, SNB16,snb16Exclude, IStorage16*,pstgDest)
+    ICOM_METHOD4(HRESULT,MoveElementTo,  LPCOLESTR16,pwcsName, IStorage16*,pstgDest, LPCOLESTR16,pwcsNewName, DWORD,grfFlags)
+    ICOM_METHOD1(HRESULT,Commit,         DWORD,grfCommitFlags)
+    ICOM_METHOD (HRESULT,Revert)
+    ICOM_METHOD4(HRESULT,EnumElements,   DWORD,reserved1, void*,reserved2, DWORD,reserved3, IEnumSTATSTG**,ppenum)
+    ICOM_METHOD1(HRESULT,DestroyElement, LPCOLESTR16,pwcsName)
+    ICOM_METHOD2(HRESULT,RenameElement,  LPCOLESTR16,pwcsOldName, LPCOLESTR16,pwcsNewName)
+    ICOM_METHOD4(HRESULT,SetElementTimes,LPCOLESTR16,pwcsName, const FILETIME*,pctime, const FILETIME*,patime, const FILETIME*,pmtime)
+    ICOM_METHOD1(HRESULT,SetClass,       REFCLSID,clsid)
+    ICOM_METHOD2(HRESULT,SetStateBits,   DWORD,grfStateBits, DWORD,grfMask)
+    ICOM_METHOD2(HRESULT,Stat,           STATSTG*,pstatstg, DWORD,grfStatFlag)
+ICOM_END(IStorage16)
+#undef ICOM_INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+/*** IUnknown methods ***/
+#define IStorage16_QueryInterface(p,a,b) ICOM_ICALL2(IUnknown,QueryInterface,p,a,b)
+#define IStorage16_AddRef(p)             ICOM_ICALL (IUnknown,AddRef,p)
+#define IStorage16_Release(p)            ICOM_ICALL (IUnknown,Release,p)
+/*** IStorage16 methods ***/
+#define IStorage16_CreateStream(p,a,b,c,d,e)  ICOM_CALL5(CreateStream,p,a,b,c,d,e)
+#define IStorage16_OpenStream(p,a,b,c,d,e)    ICOM_CALL5(OpenStream,p,a,b,c,d,e)
+#define IStorage16_CreateStorage(p,a,b,c,d,e) ICOM_CALL5(CreateStorage,p,a,b,c,d,e)
+#define IStorage16_OpenStorage(p,a,b,c,d,e,f) ICOM_CALL6(OpenStorage,p,a,b,c,d,e,f)
+#define IStorage16_CopyTo(p,a,b,c,d)          ICOM_CALL4(CopyTo,p,a,b,c,d)
+#define IStorage16_MoveElementTo(p,a,b,c,d)   ICOM_CALL4(MoveElementTo,p,a,b,c,d)
+#define IStorage16_Commit(p,a)                ICOM_CALL1(Commit,p,a)
+#define IStorage16_Revert(p)                  ICOM_CALL (Revert,p)
+#define IStorage16_EnumElements(p,a,b,c,d)    ICOM_CALL4(EnumElements,p,a,b,c,d)
+#define IStorage16_DestroyElement(p,a)        ICOM_CALL1(DestroyElement,p,a)
+#define IStorage16_RenameElement(p,a,b)       ICOM_CALL2(RenameElement,p,a,b)
+#define IStorage16_SetElementTimes(p,a,b,c,d) ICOM_CALL4(SetElementTimes,p,a,b,c,d)
+#define IStorage16_SetClass(p,a)              ICOM_CALL1(SetClass,p,a)
+#define IStorage16_SetStateBits(p,a,b)        ICOM_CALL2(SetStateBits,p,a,b)
+#define IStorage16_Stat(p,a,b)                ICOM_CALL2(Stat,p,a,b)
+#endif
+
+
+#define ICOM_INTERFACE IStorage32
+ICOM_BEGIN(IStorage32,IUnknown)
+    ICOM_METHOD5(HRESULT,CreateStream,   LPCOLESTR32,pwcsName, DWORD,grfMode, DWORD,reserved1, DWORD,reserved2, IStream32**,ppstm);
+    ICOM_METHOD5(HRESULT,OpenStream,     LPCOLESTR32,pwcsName, void*,reserved1, DWORD,grfMode, DWORD,reserved2, IStream32**,ppstm);
+    ICOM_METHOD5(HRESULT,CreateStorage,  LPCOLESTR32,pwcsName, DWORD,grfMode, DWORD,dwStgFmt, DWORD,reserved2, IStorage32**,ppstg);
+    ICOM_METHOD6(HRESULT,OpenStorage,    LPCOLESTR32,pwcsName, IStorage32*,pstgPriority, DWORD,grfMode, SNB32,snb16Exclude, DWORD,reserved, IStorage32**,ppstg);
+    ICOM_METHOD4(HRESULT,CopyTo,         DWORD,ciidExclude, const IID*,rgiidExclude, SNB32,snb16Exclude, IStorage32*,pstgDest);
+    ICOM_METHOD4(HRESULT,MoveElementTo,  LPCOLESTR32,pwcsName, IStorage32*,pstgDest, LPCOLESTR32,pwcsNewName, DWORD,grfFlags);
+    ICOM_METHOD1(HRESULT,Commit,         DWORD,grfCommitFlags);
+    ICOM_METHOD (HRESULT,Revert);
+    ICOM_METHOD4(HRESULT,EnumElements,   DWORD,reserved1, void*,reserved2, DWORD,reserved3, IEnumSTATSTG**,ppenum);
+    ICOM_METHOD1(HRESULT,DestroyElement, LPCOLESTR32,pwcsName);
+    ICOM_METHOD2(HRESULT,RenameElement,  LPCOLESTR32,pwcsOldName, LPCOLESTR32,pwcsNewName);
+    ICOM_METHOD4(HRESULT,SetElementTimes,LPCOLESTR32,pwcsName, const FILETIME*,pctime, const FILETIME*,patime, const FILETIME*,pmtime);
+    ICOM_METHOD1(HRESULT,SetClass,       REFCLSID,clsid);
+    ICOM_METHOD2(HRESULT,SetStateBits,   DWORD,grfStateBits, DWORD,grfMask);
+    ICOM_METHOD2(HRESULT,Stat,           STATSTG*,pstatstg, DWORD,grfStatFlag);
+ICOM_END(IStorage32)
+#undef ICOM_INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+/*** IUnknown methods ***/
+#define IStorage32_QueryInterface(p,a,b) ICOM_ICALL2(IUnknown,QueryInterface,p,a,b)
+#define IStorage32_AddRef(p)             ICOM_ICALL (IUnknown,AddRef,p)
+#define IStorage32_Release(p)            ICOM_ICALL (IUnknown,Release,p)
+/*** IStorage32 methods ***/
+#define IStorage32_CreateStream(p,a,b,c,d,e)  ICOM_CALL5(CreateStream,p,a,b,c,d,e)
+#define IStorage32_OpenStream(p,a,b,c,d,e)    ICOM_CALL5(OpenStream,p,a,b,c,d,e)
+#define IStorage32_CreateStorage(p,a,b,c,d,e) ICOM_CALL5(CreateStorage,p,a,b,c,d,e)
+#define IStorage32_OpenStorage(p,a,b,c,d,e,f) ICOM_CALL6(OpenStorage,p,a,b,c,d,e,f)
+#define IStorage32_CopyTo(p,a,b,c,d)          ICOM_CALL4(CopyTo,p,a,b,c,d)
+#define IStorage32_MoveElementTo(p,a,b,c,d)   ICOM_CALL4(MoveElementTo,p,a,b,c,d)
+#define IStorage32_Commit(p,a)                ICOM_CALL1(Commit,p,a)
+#define IStorage32_Revert(p)                  ICOM_CALL (Revert,p)
+#define IStorage32_EnumElements(p,a,b,c,d)    ICOM_CALL4(EnumElements,p,a,b,c,d)
+#define IStorage32_DestroyElement(p,a)        ICOM_CALL1(DestroyElement,p,a)
+#define IStorage32_RenameElement(p,a,b)       ICOM_CALL2(RenameElement,p,a,b)
+#define IStorage32_SetElementTimes(p,a,b,c,d) ICOM_CALL4(SetElementTimes,p,a,b,c,d)
+#define IStorage32_SetClass(p,a)              ICOM_CALL1(SetClass,p,a)
+#define IStorage32_SetStateBits(p,a,b)        ICOM_CALL2(SetStateBits,p,a,b)
+#define IStorage32_Stat(p,a,b)                ICOM_CALL2(Stat,p,a,b)
+
+#ifndef __WINE__
+/* Duplicated for WINELIB */
+/*** IUnknown methods ***/
+#define IStorage_QueryInterface(p,a,b) ICOM_ICALL2(IUnknown,QueryInterface,p,a,b)
+#define IStorage_AddRef(p)             ICOM_ICALL (IUnknown,AddRef,p)
+#define IStorage_Release(p)            ICOM_ICALL (IUnknown,Release,p)
+/*** IStorage methods ***/
+#define IStorage_CreateStream(p,a,b,c,d,e)  ICOM_CALL5(CreateStream,p,a,b,c,d,e)
+#define IStorage_OpenStream(p,a,b,c,d,e)    ICOM_CALL5(OpenStream,p,a,b,c,d,e)
+#define IStorage_CreateStorage(p,a,b,c,d,e) ICOM_CALL5(CreateStorage,p,a,b,c,d,e)
+#define IStorage_OpenStorage(p,a,b,c,d,e,f) ICOM_CALL6(OpenStorage,p,a,b,c,d,e,f)
+#define IStorage_CopyTo(p,a,b,c,d)          ICOM_CALL4(CopyTo,p,a,b,c,d)
+#define IStorage_MoveElementTo(p,a,b,c,d)   ICOM_CALL4(MoveElementTo,p,a,b,c,d)
+#define IStorage_Commit(p,a)                ICOM_CALL1(Commit,p,a)
+#define IStorage_Revert(p)                  ICOM_CALL (Revert,p)
+#define IStorage_EnumElements(p,a,b,c,d)    ICOM_CALL4(EnumElements,p,a,b,c,d)
+#define IStorage_DestroyElement(p,a)        ICOM_CALL1(DestroyElement,p,a)
+#define IStorage_RenameElement(p,a,b)       ICOM_CALL2(RenameElement,p,a,b)
+#define IStorage_SetElementTimes(p,a,b,c,d) ICOM_CALL4(SetElementTimes,p,a,b,c,d)
+#define IStorage_SetClass(p,a)              ICOM_CALL1(SetClass,p,a)
+#define IStorage_SetStateBits(p,a,b)        ICOM_CALL2(SetStateBits,p,a,b)
+#define IStorage_Stat(p,a,b)                ICOM_CALL2(Stat,p,a,b)
+#endif
+#endif
+
+
+/*****************************************************************************
+ * IStream interface
+ */
+#define ICOM_INTERFACE IStream16
+ICOM_BEGIN(IStream16,ISequentialStream)
+    ICOM_METHOD3(HRESULT,Seek,        LARGE_INTEGER,dlibMove, DWORD,dwOrigin, ULARGE_INTEGER*,plibNewPosition); 
+    ICOM_METHOD1(HRESULT,SetSize,     ULARGE_INTEGER,libNewSize);
+    ICOM_METHOD4(HRESULT,CopyTo,      IStream16*,pstm, ULARGE_INTEGER,cb, ULARGE_INTEGER*,pcbRead, ULARGE_INTEGER*,pcbWritten);
+    ICOM_METHOD1(HRESULT,Commit,      DWORD,grfCommitFlags);
+    ICOM_METHOD (HRESULT,Revert);
+    ICOM_METHOD3(HRESULT,LockRegion,  ULARGE_INTEGER,libOffset, ULARGE_INTEGER,cb, DWORD,dwLockType);
+    ICOM_METHOD3(HRESULT,UnlockRegion,ULARGE_INTEGER,libOffset, ULARGE_INTEGER,cb, DWORD,dwLockType);
+    ICOM_METHOD2(HRESULT,Stat,        STATSTG*,pstatstg, DWORD,grfStatFlag);
+    ICOM_METHOD1(HRESULT,Clone,       IStream16**,ppstm);
+ICOM_END(IStream16)
+#undef ICOM_INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+/*** IUnknown methods ***/
+#define IStream16_QueryInterface(p,a,b) ICOM_ICALL2(IUnknown,QueryInterface,p,a,b)
+#define IStream16_AddRef(p)             ICOM_ICALL (IUnknown,AddRef,p)
+#define IStream16_Release(p)            ICOM_ICALL (IUnknown,Release,p)
+/*** ISequentialStream methods ***/
+#define IStream16_Read(p,a,b,c)  ICOM_ICALL3(ISequentialStream,Read,p,a,b,c)
+#define IStream16_Write(p,a,b,c) ICOM_ICALL3(ISequentialStream,Write,p,a,b,c)
+/*** IStream16 methods ***/
+#define IStream16_Seek(p)               ICOM_CALL3(Seek,p)
+#define IStream16_SetSize(p,a,b)        ICOM_CALL1(SetSize,p,a,b)
+#define IStream16_CopyTo(pa,b,c,d)      ICOM_CALL4(CopyTo,pa,b,c,d)
+#define IStream16_Commit(p,a)           ICOM_CALL1(Commit,p,a)
+#define IStream16_Revert(p)             ICOM_CALL (Revert,p)
+#define IStream16_LockRegion(pa,b,c)    ICOM_CALL3(LockRegion,pa,b,c)
+#define IStream16_UnlockRegion(p,a,b,c) ICOM_CALL3(UnlockRegion,p,a,b,c)
+#define IStream16_Stat(p,a,b)           ICOM_CALL2(Stat,p,a,b)
+#define IStream16_Clone(p,a)            ICOM_CALL1(Clone,p,a)
+#endif
+
+
+#define ICOM_INTERFACE IStream32
+ICOM_BEGIN(IStream32,ISequentialStream)
+    ICOM_METHOD3(HRESULT,Seek,        LARGE_INTEGER,dlibMove, DWORD,dwOrigin, ULARGE_INTEGER*,plibNewPosition); 
+    ICOM_METHOD1(HRESULT,SetSize,     ULARGE_INTEGER,libNewSize);
+    ICOM_METHOD4(HRESULT,CopyTo,      IStream32*,pstm, ULARGE_INTEGER,cb, ULARGE_INTEGER*,pcbRead, ULARGE_INTEGER*,pcbWritten);
+    ICOM_METHOD1(HRESULT,Commit,      DWORD,grfCommitFlags);
+    ICOM_METHOD (HRESULT,Revert);
+    ICOM_METHOD3(HRESULT,LockRegion,  ULARGE_INTEGER,libOffset, ULARGE_INTEGER,cb, DWORD,dwLockType);
+    ICOM_METHOD3(HRESULT,UnlockRegion,ULARGE_INTEGER,libOffset, ULARGE_INTEGER,cb, DWORD,dwLockType);
+    ICOM_METHOD2(HRESULT,Stat,        STATSTG*,pstatstg, DWORD,grfStatFlag);
+    ICOM_METHOD1(HRESULT,Clone,       IStream32**,ppstm);
+ICOM_END(IStream32)
+#undef ICOM_INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+/*** IUnknown methods ***/
+#define IStream32_QueryInterface(p,a,b) ICOM_ICALL2(IUnknown,QueryInterface,p,a,b)
+#define IStream32_AddRef(p)             ICOM_ICALL (IUnknown,AddRef,p)
+#define IStream32_Release(p)            ICOM_ICALL (IUnknown,Release,p)
+/*** ISequentialStream methods ***/
+#define IStream32_Read(p,a,b,c)  ICOM_ICALL3(ISequentialStream,Read,p,a,b,c)
+#define IStream32_Write(p,a,b,c) ICOM_ICALL3(ISequentialStream,Write,p,a,b,c)
+/*** IStream32 methods ***/
+#define IStream32_Seek(p)               ICOM_CALL3(Seek,p)
+#define IStream32_SetSize(p,a,b)        ICOM_CALL1(SetSize,p,a,b)
+#define IStream32_CopyTo(pa,b,c,d)      ICOM_CALL4(CopyTo,pa,b,c,d)
+#define IStream32_Commit(p,a)           ICOM_CALL1(Commit,p,a)
+#define IStream32_Revert(p)             ICOM_CALL (Revert,p)
+#define IStream32_LockRegion(pa,b,c)    ICOM_CALL3(LockRegion,pa,b,c)
+#define IStream32_UnlockRegion(p,a,b,c) ICOM_CALL3(UnlockRegion,p,a,b,c)
+#define IStream32_Stat(p,a,b)           ICOM_CALL2(Stat,p,a,b)
+#define IStream32_Clone(p,a)            ICOM_CALL1(Clone,p,a)
+
+#ifndef __WINE__
+/* Duplicated for WINELIB */
+/*** IUnknown methods ***/
+#define IStream_QueryInterface(p,a,b) ICOM_ICALL2(IUnknown,QueryInterface,p,a,b)
+#define IStream_AddRef(p)             ICOM_ICALL (IUnknown,AddRef,p)
+#define IStream_Release(p)            ICOM_ICALL (IUnknown,Release,p)
+/*** ISequentialStream methods ***/
+#define IStream_Read(p,a,b,c)  ICOM_ICALL3(ISequentialStream,Read,p,a,b,c)
+#define IStream_Write(p,a,b,c) ICOM_ICALL3(ISequentialStream,Write,p,a,b,c)
+/*** IStream methods ***/
+#define IStream_Seek(p)               ICOM_CALL3(Seek,p)
+#define IStream_SetSize(p,a,b)        ICOM_CALL1(SetSize,p,a,b)
+#define IStream_CopyTo(pa,b,c,d)      ICOM_CALL4(CopyTo,pa,b,c,d)
+#define IStream_Commit(p,a)           ICOM_CALL1(Commit,p,a)
+#define IStream_Revert(p)             ICOM_CALL (Revert,p)
+#define IStream_LockRegion(pa,b,c)    ICOM_CALL3(LockRegion,pa,b,c)
+#define IStream_UnlockRegion(p,a,b,c) ICOM_CALL3(UnlockRegion,p,a,b,c)
+#define IStream_Stat(p,a,b)           ICOM_CALL2(Stat,p,a,b)
+#define IStream_Clone(p,a)            ICOM_CALL1(Clone,p,a)
+#endif
+#endif
+
+
+/*****************************************************************************
+ * StgXXX API
+ */
+/* FIXME: many functions are missing */
+HRESULT WINAPI StgCreateDocFile16(LPCOLESTR16 pwcsName,DWORD grfMode,DWORD reserved,IStorage16 **ppstgOpen);
+HRESULT WINAPI StgCreateDocfile32(LPCOLESTR32 pwcsName,DWORD grfMode,DWORD reserved,IStorage32 **ppstgOpen);
+#define StgCreateDocfile WINELIB_NAME(StgCreateDocfile)
+
+HRESULT WINAPI StgIsStorageFile16(LPCOLESTR16 fn);
+HRESULT WINAPI StgIsStorageFile32(LPCOLESTR32 fn);
+#define StgIsStorageFile WINELIB_NAME(StgIsStorageFile)
+
+HRESULT WINAPI StgOpenStorage16(const OLECHAR16* pwcsName,IStorage16* pstgPriority,DWORD grfMode,SNB16 snbExclude,DWORD reserved,IStorage16**ppstgOpen);
+HRESULT WINAPI StgOpenStorage32(const OLECHAR32* pwcsName,IStorage32* pstgPriority,DWORD grfMode,SNB32 snbExclude,DWORD reserved,IStorage32**ppstgOpen);
+#define StgOpenStorage WINELIB_NAME(StgOpenStorage)
+
+
+
+#endif /* __WINE_WINE_OBJ_STORAGE_H */
diff --git a/include/winerror.h b/include/winerror.h
index da07d75..b7fdcbb 100644
--- a/include/winerror.h
+++ b/include/winerror.h
@@ -145,8 +145,9 @@
 
 /* HRESULT values for OLE, SHELL and other Interface stuff */
 /* the codes 4000-40ff are reserved for OLE */
-#define	NOERROR				0
-#define	S_OK				0
+#define NOERROR                                0L
+#define S_OK                                   ((HRESULT)0L)
+#define S_FALSE                                ((HRESULT)1L)
 
 #define DISP_E_BADVARTYPE   0x80020008L
 #define DISP_E_OVERFLOW     0x8002000AL
diff --git a/include/wtypes.h b/include/wtypes.h
new file mode 100644
index 0000000..8d21349
--- /dev/null
+++ b/include/wtypes.h
@@ -0,0 +1,68 @@
+/*
+ * Defines the basic types used by COM interfaces.
+ */
+
+#ifndef __WINE_WTYPES_H
+#define __WINE_WTYPES_H
+
+
+#include "wintypes.h"
+
+
+typedef WORD CLIPFORMAT32, *LPCLIPFORMAT32;
+DECL_WINELIB_TYPE(CLIPFORMAT)
+
+typedef CHAR		OLECHAR16;
+typedef WCHAR		OLECHAR32;
+DECL_WINELIB_TYPE(OLECHAR)
+
+typedef LPSTR		LPOLESTR16;
+typedef LPWSTR		LPOLESTR32;
+DECL_WINELIB_TYPE(LPOLESTR)
+
+typedef LPCSTR		LPCOLESTR16;
+typedef LPCWSTR		LPCOLESTR32;
+DECL_WINELIB_TYPE(LPCOLESTR)
+
+typedef OLECHAR16	*BSTR16;
+typedef OLECHAR32	*BSTR32;
+DECL_WINELIB_TYPE(BSTR)
+
+typedef BSTR16		*LPBSTR16;
+typedef BSTR32		*LPBSTR32;
+DECL_WINELIB_TYPE(LPBSTR)
+
+struct _GUID
+{
+    DWORD Data1;
+    WORD  Data2;
+    WORD  Data3;
+    BYTE  Data4[8];
+};
+
+typedef struct _GUID	GUID,*LPGUID,*REFGUID;
+typedef struct _GUID	CLSID,*LPCLSID,*REFCLSID;
+typedef struct _GUID	IID,*REFIID,*LPIID;
+
+#define DECLARE_HANDLE(a)  typedef HANDLE16 a##16; typedef HANDLE32 a##32
+DECLARE_HANDLE(HMETAFILEPICT);
+#undef DECLARE_HANDLE
+
+typedef enum tagCLSCTX
+{
+    CLSCTX_INPROC_SERVER     = 0x1,
+    CLSCTX_INPROC_HANDLER    = 0x2,
+    CLSCTX_LOCAL_SERVER      = 0x4,
+    CLSCTX_INPROC_SERVER16   = 0x8,
+    CLSCTX_REMOTE_SERVER     = 0x10,
+    CLSCTX_INPROC_HANDLER16  = 0x20,
+    CLSCTX_INPROC_SERVERX86  = 0x40,
+    CLSCTX_INPROC_HANDLERX86 = 0x80
+} CLSCTX;
+
+#define CLSCTX_INPROC           (CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER)
+#define CLSCTX_ALL              (CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER)
+#define CLSCTX_SERVER           (CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER)
+
+
+#endif /* __WINE_WTYPES_H */
diff --git a/include/x11drv.h b/include/x11drv.h
index 01dfb7a..1e89604 100644
--- a/include/x11drv.h
+++ b/include/x11drv.h
@@ -272,6 +272,8 @@
 extern UINT16 X11DRV_KEYBOARD_MapVirtualKey(UINT16 wCode, UINT16 wMapType);
 extern INT16 X11DRV_KEYBOARD_GetKeyNameText(LONG lParam, LPSTR lpBuffer, INT16 nSize);
 extern INT16 X11DRV_KEYBOARD_ToAscii(UINT16 virtKey, UINT16 scanCode, LPBYTE lpKeyState, LPVOID lpChar, UINT16 flags);
+extern void KEYBOARD_HandleEvent( WND *pWnd, XKeyEvent *event );
+extern void KEYBOARD_UpdateState ( void );
 
 /* X11 mouse driver */