Resend - Split Ole Win16/32

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I didnt want this one to get lost in the vacation =)

Thanks
Steven

Changelog: Separate Win16 and Win32 support in Ole32


--- /dev/null	Tue May 20 08:59:31 2003
+++ ole2_16.c	Sun May 18 18:30:34 2003
@@ -0,0 +1,233 @@
+
+/*
+ *	OLE2 library - 16 bit Interfaces
+ *
+ *	Copyright 1995	Martin von Loewis
+ *      Copyright 1999  Francis Beaudet
+ *      Copyright 1999  Noel Borthwick
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "config.h"
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+#include "commctrl.h"
+#include "ole2.h"
+#include "ole2ver.h"
+#include "windef.h"
+#include "winbase.h"
+#include "winerror.h"
+#include "winuser.h"
+#include "winreg.h"
+#include "wownt32.h"
+
+#include "wine/winbase16.h"
+#include "wine/wingdi16.h"
+#include "wine/winuser16.h"
+#include "ole32_main.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(ole);
+WINE_DECLARE_DEBUG_CHANNEL(accel);
+
+#define HICON_16(h32)		(LOWORD(h32))
+#define HICON_32(h16)		((HICON)(ULONG_PTR)(h16))
+#define HINSTANCE_32(h16)	((HINSTANCE)(ULONG_PTR)(h16))
+
+/******************************************************************************
+ * These are static/global variables and internal data structures that the
+ * OLE module uses to maintain it's state.
+ */
+typedef struct tagDropTargetNode
+{
+  HWND          hwndTarget;
+  IDropTarget*    dropTarget;
+  struct tagDropTargetNode* prevDropTarget;
+  struct tagDropTargetNode* nextDropTarget;
+} DropTargetNode;
+
+typedef struct tagTrackerWindowInfo
+{
+  IDataObject* dataObject;
+  IDropSource* dropSource;
+  DWORD        dwOKEffect;
+  DWORD*       pdwEffect;
+  BOOL       trackingDone;
+  HRESULT      returnValue;
+
+  BOOL       escPressed;
+  HWND       curTargetHWND;	/* window the mouse is hovering over */
+  HWND       curDragTargetHWND; /* might be a ancestor of curTargetHWND */
+  IDropTarget* curDragTarget;
+} TrackerWindowInfo;
+
+typedef struct tagOleMenuDescriptor  /* OleMenuDescriptor */
+{
+  HWND               hwndFrame;         /* The containers frame window */
+  HWND               hwndActiveObject;  /* The active objects window */
+  OLEMENUGROUPWIDTHS mgw;               /* OLE menu group widths for the shared menu */
+  HMENU              hmenuCombined;     /* The combined menu */
+  BOOL               bIsServerItem;     /* True if the currently open popup belongs to the server
*/
+} OleMenuDescriptor;
+
+typedef struct tagOleMenuHookItem   /* OleMenu hook item in per thread hook list */
+{
+  DWORD tid;                /* Thread Id  */
+  HANDLE hHeap;             /* Heap this is allocated from */
+  HHOOK GetMsg_hHook;       /* message hook for WH_GETMESSAGE */
+  HHOOK CallWndProc_hHook;  /* message hook for WH_CALLWNDPROC */
+  struct tagOleMenuHookItem *next;
+} OleMenuHookItem;
+
+/*
+ * Name of our registered window class.
+ */
+static const char OLEDD_DRAGTRACKERCLASS[] = "WineDragDropTracker32";
+
+/******************************************************************************
+ * These are the prototypes of the utility methods used to manage a shared menu
+ */
+BOOL OLEMenu_InstallHooks( DWORD tid );
+BOOL OLEMenu_UnInstallHooks( DWORD tid );
+OleMenuHookItem * OLEMenu_IsHookInstalled( DWORD tid );
+static BOOL OLEMenu_FindMainMenuIndex( HMENU hMainMenu, HMENU hPopupMenu, UINT *pnPos );
+BOOL OLEMenu_SetIsServerMenu( HMENU hmenu, OleMenuDescriptor *pOleMenuDescriptor );
+LRESULT CALLBACK OLEMenu_CallWndProc(INT code, WPARAM wParam, LPARAM lParam);
+LRESULT CALLBACK OLEMenu_GetMsgProc(INT code, WPARAM wParam, LPARAM lParam);
+
+/******************************************************************************
+ * These are the prototypes of the OLE Clipboard initialization methods (in clipboard.c)
+ */
+void OLEClipbrd_UnInitialize();
+void OLEClipbrd_Initialize();
+
+/***********************************************************************
+ *           RegisterDragDrop (OLE2.35)
+ */
+HRESULT WINAPI RegisterDragDrop16(
+	HWND16 hwnd,
+	LPDROPTARGET pDropTarget
+) {
+	FIXME("(0x%04x,%p),stub!\n",hwnd,pDropTarget);
+	return S_OK;
+}
+
+/***********************************************************************
+ *           RevokeDragDrop (OLE2.36)
+ */
+HRESULT WINAPI RevokeDragDrop16(
+	HWND16 hwnd
+) {
+	FIXME("(0x%04x),stub!\n",hwnd);
+	return S_OK;
+}
+
+/**************************************************************************
+ * Internal methods to manage the shared OLE menu in response to the
+ * OLE***MenuDescriptor API
+ */
+
+/***********************************************************************
+ *           OLEMenu_FindMainMenuIndex
+ *
+ * Used by OLEMenu API to find the top level group a menu item belongs to.
+ * On success pnPos contains the index of the item in the top level menu group
+ *
+ * RETURNS: TRUE if the ID was found, FALSE on failure
+ */
+static BOOL OLEMenu_FindMainMenuIndex( HMENU hMainMenu, HMENU hPopupMenu, UINT *pnPos )
+{
+  UINT i, nItems;
+
+  nItems = GetMenuItemCount( hMainMenu );
+
+  for (i = 0; i < nItems; i++)
+  {
+    HMENU hsubmenu;
+
+    /*  Is the current item a submenu? */
+    if ( (hsubmenu = GetSubMenu(hMainMenu, i)) )
+    {
+      /* If the handle is the same we're done */
+      if ( hsubmenu == hPopupMenu )
+      {
+        if (pnPos)
+          *pnPos = i;
+        return TRUE;
+      }
+      /* Recursively search without updating pnPos */
+      else if ( OLEMenu_FindMainMenuIndex( hsubmenu, hPopupMenu, NULL ) )
+      {
+        if (pnPos)
+          *pnPos = i;
+        return TRUE;
+      }
+    }
+  }
+
+  return FALSE;
+}
+
+/******************************************************************************
+ * OleMetaFilePictFromIconAndLabel (OLE2.56)
+ *
+ * Returns a global memory handle to a metafile which contains the icon and
+ * label given.
+ * I guess the result of that should look somehow like desktop icons.
+ * If no hIcon is given, we load the icon via lpszSourceFile and iIconIndex.
+ * This code might be wrong at some places.
+ */
+HGLOBAL16 WINAPI OleMetaFilePictFromIconAndLabel16(
+	HICON16 hIcon,
+	LPCOLESTR16 lpszLabel,
+	LPCOLESTR16 lpszSourceFile,
+	UINT16 iIconIndex
+) {
+    METAFILEPICT16 *mf;
+    HGLOBAL16 hmf;
+    HDC hdc;
+
+    FIXME("(%04x, '%s', '%s', %d): incorrect metrics, please try to correct them !\n\n\n", hIcon,
lpszLabel, lpszSourceFile, iIconIndex);
+
+    if (!hIcon) {
+        if (lpszSourceFile) {
+	    HINSTANCE16 hInstance = LoadLibrary16(lpszSourceFile);
+
+	    /* load the icon at index from lpszSourceFile */
+	    hIcon = HICON_16(LoadIconA(HINSTANCE_32(hInstance), (LPCSTR)(DWORD)iIconIndex));
+	    FreeLibrary16(hInstance);
+	} else
+	    return 0;
+    }
+
+    hdc = CreateMetaFileA(NULL);
+    DrawIcon(hdc, 0, 0, HICON_32(hIcon)); /* FIXME */
+    TextOutA(hdc, 0, 0, lpszLabel, 1); /* FIXME */
+    hmf = GlobalAlloc16(0, sizeof(METAFILEPICT16));
+    mf = (METAFILEPICT16 *)GlobalLock16(hmf);
+    mf->mm = MM_ANISOTROPIC;
+    mf->xExt = 20; /* FIXME: bogus */
+    mf->yExt = 20; /* dito */
+    mf->hMF = CloseMetaFile16(HDC_16(hdc));
+    return hmf;
+}

Index: ole2.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/ole2.c,v
retrieving revision 1.42
diff -u -r1.42 ole2.c
--- ole2.c	28 Jan 2003 01:06:20 -0000	1.42
+++ ole2.c	20 May 2003 12:58:43 -0000
@@ -1,6 +1,6 @@
 
 /*
- *	OLE2 library
+ *	OLE2 library - 32 bit Interfaces
  *
  *	Copyright 1995	Martin von Loewis
  *      Copyright 1999  Francis Beaudet
@@ -319,17 +319,6 @@
 }
 
 /***********************************************************************
- *           RegisterDragDrop (OLE2.35)
- */
-HRESULT WINAPI RegisterDragDrop16(
-	HWND16 hwnd,
-	LPDROPTARGET pDropTarget
-) {
-	FIXME("(0x%04x,%p),stub!\n",hwnd,pDropTarget);
-	return S_OK;
-}
-
-/***********************************************************************
  *           RegisterDragDrop (OLE32.139)
  */
 HRESULT WINAPI RegisterDragDrop(
@@ -373,16 +362,6 @@
 }
 
 /***********************************************************************
- *           RevokeDragDrop (OLE2.36)
- */
-HRESULT WINAPI RevokeDragDrop16(
-	HWND16 hwnd
-) {
-	FIXME("(0x%04x),stub!\n",hwnd);
-	return S_OK;
-}
-
-/***********************************************************************
  *           RevokeDragDrop (OLE32.141)
  */
 HRESULT WINAPI RevokeDragDrop(
@@ -2212,50 +2191,6 @@
 	break;
     }
   }
-}
-
-/******************************************************************************
- * OleMetaFilePictFromIconAndLabel (OLE2.56)
- *
- * Returns a global memory handle to a metafile which contains the icon and
- * label given.
- * I guess the result of that should look somehow like desktop icons.
- * If no hIcon is given, we load the icon via lpszSourceFile and iIconIndex.
- * This code might be wrong at some places.
- */
-HGLOBAL16 WINAPI OleMetaFilePictFromIconAndLabel16(
-	HICON16 hIcon,
-	LPCOLESTR16 lpszLabel,
-	LPCOLESTR16 lpszSourceFile,
-	UINT16 iIconIndex
-) {
-    METAFILEPICT16 *mf;
-    HGLOBAL16 hmf;
-    HDC hdc;
-
-    FIXME("(%04x, '%s', '%s', %d): incorrect metrics, please try to correct them !\n\n\n", hIcon,
lpszLabel, lpszSourceFile, iIconIndex);
-
-    if (!hIcon) {
-        if (lpszSourceFile) {
-	    HINSTANCE16 hInstance = LoadLibrary16(lpszSourceFile);
-
-	    /* load the icon at index from lpszSourceFile */
-	    hIcon = HICON_16(LoadIconA(HINSTANCE_32(hInstance), (LPCSTR)(DWORD)iIconIndex));
-	    FreeLibrary16(hInstance);
-	} else
-	    return 0;
-    }
-
-    hdc = CreateMetaFileA(NULL);
-    DrawIcon(hdc, 0, 0, HICON_32(hIcon)); /* FIXME */
-    TextOutA(hdc, 0, 0, lpszLabel, 1); /* FIXME */
-    hmf = GlobalAlloc16(0, sizeof(METAFILEPICT16));
-    mf = (METAFILEPICT16 *)GlobalLock16(hmf);
-    mf->mm = MM_ANISOTROPIC;
-    mf->xExt = 20; /* FIXME: bogus */
-    mf->yExt = 20; /* dito */
-    mf->hMF = CloseMetaFile16(HDC_16(hdc));
-    return hmf;
 }
 
 /******************************************************************************

Index: ole16.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/ole16.c,v
retrieving revision 1.4
diff -u -r1.4 ole16.c
--- ole16.c	12 Apr 2003 00:09:14 -0000	1.4
+++ ole16.c	20 May 2003 12:59:07 -0000
@@ -384,37 +384,6 @@
   return ret;
 }
 
-/******************************************************************************
- *		CLSIDFromProgID	[COMPOBJ.61]
- * Converts a program id into the respective GUID. (By using a registry lookup)
- * RETURNS
- *	riid associated with the progid
- */
-HRESULT WINAPI CLSIDFromProgID16(
-	LPCOLESTR16 progid,	/* [in] program id as found in registry */
-	LPCLSID riid		/* [out] associated CLSID */
-) {
-	char	*buf,buf2[80];
-	DWORD	buf2len;
-	HRESULT	err;
-	HKEY	xhkey;
-
-	buf = HeapAlloc(GetProcessHeap(),0,strlen(progid)+8);
-	sprintf(buf,"%s\\CLSID",progid);
-	if ((err=RegOpenKeyA(HKEY_CLASSES_ROOT,buf,&xhkey))) {
-		HeapFree(GetProcessHeap(),0,buf);
-                return CO_E_CLASSSTRING;
-	}
-	HeapFree(GetProcessHeap(),0,buf);
-	buf2len = sizeof(buf2);
-	if ((err=RegQueryValueA(xhkey,NULL,buf2,&buf2len))) {
-		RegCloseKey(xhkey);
-                return CO_E_CLASSSTRING;
-	}
-	RegCloseKey(xhkey);
-	return __CLSIDFromStringA(buf2,riid);
-}
-
 /***********************************************************************
  *           LookupETask (COMPOBJ.94)
  */

Index: storage32.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/storage32.c,v
retrieving revision 1.39
diff -u -r1.39 storage32.c
--- storage32.c	13 May 2003 00:41:58 -0000	1.39
+++ storage32.c	9 Jun 2003 01:06:20 -0000
@@ -6823,6 +6823,36 @@
     return r;
 }
 
+/******************************************************************************
+ *		CLSIDFromProgID	[COMPOBJ.61]
+ * Converts a program id into the respective GUID. (By using a registry lookup)
+ * RETURNS
+ *	riid associated with the progid
+ */
+HRESULT WINAPI CLSIDFromProgID16(
+	LPCOLESTR16 progid,	/* [in] program id as found in registry */
+	LPCLSID riid		/* [out] associated CLSID */
+) {
+	char	*buf,buf2[80];
+	DWORD	buf2len;
+	HRESULT	err;
+	HKEY	xhkey;
+
+	buf = HeapAlloc(GetProcessHeap(),0,strlen(progid)+8);
+	sprintf(buf,"%s\\CLSID",progid);
+	if ((err=RegOpenKeyA(HKEY_CLASSES_ROOT,buf,&xhkey))) {
+		HeapFree(GetProcessHeap(),0,buf);
+                return CO_E_CLASSSTRING;
+	}
+	HeapFree(GetProcessHeap(),0,buf);
+	buf2len = sizeof(buf2);
+	if ((err=RegQueryValueA(xhkey,NULL,buf2,&buf2len))) {
+		RegCloseKey(xhkey);
+                return CO_E_CLASSSTRING;
+	}
+	RegCloseKey(xhkey);
+	return __CLSIDFromStringA(buf2,riid);
+}
 
 /*************************************************************************
  * OLECONVERT_CreateCompObjStream [Internal]


Index: Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/ole32/Makefile.in,v
retrieving revision 1.30
diff -u -r1.30 Makefile.in
--- Makefile.in	15 May 2003 22:55:37 -0000	1.30
+++ Makefile.in	21 May 2003 00:27:03 -0000
@@ -31,7 +31,6 @@
 	marshal.c \
 	memlockbytes.c \
 	moniker.c \
-	ole16.c \
 	ole2.c \
 	ole2stubs.c \
 	ole2impl.c \
@@ -42,12 +41,14 @@
 	rpc.c \
 	stg_bigblockfile.c \
 	stg_stream.c \
-	storage.c \
 	storage32.c
 
 C_SRCS16 = \
 	memlockbytes16.c \
-	ole2nls.c
+	ole16.c \
+	ole2_16.c \
+	ole2nls.c \
+	storage.c
 
 RC_SRCS = ole32res.rc version.rc
 


__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux