[Wine-patches] oleaut32: Implement OleCreatePropertyFrame and OleCreatePropertyFrameIndirect functions
Konstantin Kondratyuk
kondratyuk на etersoft.ru
Пн Мар 29 15:25:52 MSD 2010
--
Best regards,
Konstantin Kondratyuk.
----------- следующая часть -----------
From aab37613a13b28728ebc09e72fd3d4097fe68768 Mon Sep 17 00:00:00 2001
From: Konstantin Kondratyuk <kondratyuk на etersoft.ru>
Date: Sat, 13 Mar 2010 00:18:10 +0300
Subject: [PATCH] oleaut32: Implement OleCreatePropertyFrame and OleCreatePropertyFrameIndirect functions
---
dlls/oleaut32/Makefile.in | 2 +-
dlls/oleaut32/propsheet.c | 438 +++++++++++++++++++++++++++++++++++++++++++++
dlls/oleaut32/stubs.c | 56 ------
3 files changed, 439 insertions(+), 57 deletions(-)
create mode 100644 dlls/oleaut32/propsheet.c
delete mode 100644 dlls/oleaut32/stubs.c
diff --git a/dlls/oleaut32/Makefile.in b/dlls/oleaut32/Makefile.in
index e1d2f67..1aa7863 100644
--- a/dlls/oleaut32/Makefile.in
+++ b/dlls/oleaut32/Makefile.in
@@ -17,10 +17,10 @@ C_SRCS = \
oleaut.c \
olefont.c \
olepicture.c \
+ propsheet.c \
recinfo.c \
regsvr.c \
safearray.c \
- stubs.c \
tmarshal.c \
typelib.c \
typelib2.c \
diff --git a/dlls/oleaut32/propsheet.c b/dlls/oleaut32/propsheet.c
new file mode 100644
index 0000000..1e2dc92
--- /dev/null
+++ b/dlls/oleaut32/propsheet.c
@@ -0,0 +1,438 @@
+/*
+ * OlePro32 Property Sheets
+ *
+ * Copyright 2010 Konstantin Kondratyuk
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define WIN32_LEAN_AND_MEAN
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+
+#define COBJMACROS
+
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "winreg.h"
+#include "winnls.h"
+#include "prsht.h"
+
+#include "wine/debug.h"
+#include "ole2.h"
+#include "olectl.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(propsheet);
+
+typedef struct PropertyPageSiteUnion {
+ IPropertyPageSite* pagesite;
+ IPropertyPage* ipp;
+} PropertyPageSiteUnion;
+
+/************************************************************************
+ * Implementation of IPropertyPageSite
+ */
+typedef struct PropertyPageSiteImpl {
+ const IPropertyPageSiteVtbl *lpvtbl;
+ LONG ref;
+ HWND hwnd;
+} PropertyPageSiteImpl;
+
+static PropertyPageSiteImpl* PropertyPageSiteImpl_Construct(void);
+static void PropertyPageSiteImpl_Destroy(PropertyPageSiteImpl*);
+
+ /*** IUnknown methods ***/
+static HRESULT WINAPI PropertyPageSite_QueryInterface(
+ IPropertyPageSite* iface,
+ REFIID riid,
+ void **ppvObject)
+{
+ FIXME("is not implemented\n");
+ return E_NOTIMPL;
+}
+
+static ULONG WINAPI PropertyPageSite_AddRef(IPropertyPageSite* iface)
+{
+ PropertyPageSiteImpl *This = (PropertyPageSiteImpl *)iface;
+ ULONG refCount = InterlockedIncrement(&This->ref);
+
+ TRACE("REF = %d\n", refCount);
+
+ return refCount;
+}
+
+static ULONG WINAPI PropertyPageSite_Release(IPropertyPageSite* iface)
+{
+ PropertyPageSiteImpl *This = (PropertyPageSiteImpl *)iface;
+ ULONG refCount = InterlockedDecrement(&This->ref);
+
+ if(!refCount)
+ PropertyPageSiteImpl_Destroy(This);
+
+ TRACE("REF = %d\n", refCount);
+
+ return refCount;
+}
+
+ /*** IPropertyPageSite methods ***/
+static HRESULT WINAPI PropertyPageSite_OnStatusChange(
+ IPropertyPageSite* iface,
+ DWORD dwFlags)
+{
+ PropertyPageSiteImpl* This = (PropertyPageSiteImpl*) iface;
+
+ if(dwFlags & PROPPAGESTATUS_DIRTY)
+ {
+ TRACE("DIRTY\n");
+ SendMessageW(This->hwnd, PSM_CHANGED, 0, 0);
+ }
+ if(dwFlags & PROPPAGESTATUS_VALIDATE)
+ {
+ TRACE("VALIDATE\n");
+ }
+ return S_OK;
+}
+
+static HRESULT WINAPI PropertyPageSite_GetLocaleID(
+ IPropertyPageSite* iface,
+ LCID *pLocaleID)
+{
+ FIXME("is not implemented\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI PropertyPageSite_GetPageContainer(
+ IPropertyPageSite* iface,
+ IUnknown **ppUnk)
+{
+ FIXME("is not implemented\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI PropertyPageSite_TranslateAccelerator(
+ IPropertyPageSite* iface,
+ MSG *pMsg)
+{
+ FIXME("is not implemented\n");
+ return E_NOTIMPL;
+}
+
+static const IPropertyPageSiteVtbl PropertyPageSiteImpl_VTable = {
+ PropertyPageSite_QueryInterface,
+ PropertyPageSite_AddRef,
+ PropertyPageSite_Release,
+ PropertyPageSite_OnStatusChange,
+ PropertyPageSite_GetLocaleID,
+ PropertyPageSite_GetPageContainer,
+ PropertyPageSite_TranslateAccelerator
+};
+
+/************************************************************************
+ * PropertyPageSiteImpl_Construct
+ */
+static PropertyPageSiteImpl* PropertyPageSiteImpl_Construct()
+{
+ PropertyPageSiteImpl *Obj;
+
+ Obj = HeapAlloc(GetProcessHeap(), 0, sizeof(*Obj));
+ Obj->lpvtbl = &PropertyPageSiteImpl_VTable;
+ Obj->hwnd = NULL;
+ Obj->ref = 0;
+ return Obj;
+}
+
+/************************************************************************
+ * PropertyPageSiteImpl_Destroy
+ */
+static void PropertyPageSiteImpl_Destroy(PropertyPageSiteImpl *Obj)
+{
+ HeapFree(GetProcessHeap(), 0, Obj);
+ return;
+}
+
+static INT CALLBACK PropSheetCallback (HWND hWnd, UINT uMsg, LPARAM lParam)
+{
+ switch (uMsg)
+ {
+ default:
+ break;
+ }
+ return FALSE;
+}
+
+static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ RECT rect;
+ HRESULT hres;
+ LPPSHNOTIFY psn;
+ PropertyPageSiteImpl* This;
+ PropertyPageSiteUnion* ppsu;
+
+ ppsu = (PropertyPageSiteUnion*) GetWindowLongPtrW(hDlg, DWLP_USER);
+
+ switch (uMsg)
+ {
+ case WM_INITDIALOG:
+ TRACE("WM_INITDIALOG\n");
+ if(lParam)
+ {
+ ppsu = (PropertyPageSiteUnion*) ((PROPSHEETPAGEW*) lParam)->lParam;
+ hres = IPropertyPage_SetPageSite(ppsu->ipp, ppsu->pagesite);
+ if (FAILED(hres))
+ ERR("IPropertyPage_SetPageSite != S_OK\n");
+
+ This = (PropertyPageSiteImpl*) ppsu->pagesite;
+ This->hwnd = GetParent(hDlg);
+
+ GetClientRect(hDlg, &rect);
+ hres = IPropertyPage_Activate(ppsu->ipp, hDlg, &rect, TRUE);
+ if (FAILED(hres))
+ ERR("IPropertyPage_Activate != S_OK\n");
+ SetWindowLongPtrW(hDlg, DWLP_USER, (LONG) ppsu);
+
+ }
+ break;
+
+ case WM_NOTIFY:
+ psn = (PSHNOTIFY*) lParam;
+ switch(psn->hdr.code)
+ {
+ case PSN_SETACTIVE:
+ hres = IPropertyPage_Show(ppsu->ipp, SW_SHOW);
+ TRACE("PSN_SETACTIVE\n");
+ if (FAILED(hres))
+ ERR("IPropertyPage_Show != S_OK\n");
+ break;
+
+ case PSN_KILLACTIVE:
+ hres = IPropertyPage_Show(ppsu->ipp, SW_HIDE);
+ TRACE("PSN_KILLACTIVE\n");
+ if (FAILED(hres))
+ ERR("IPropertyPage_Show != S_OK\n");
+ break;
+
+ case PSN_APPLY:
+ hres = IPropertyPage_Apply(ppsu->ipp);
+ TRACE("PSN_APPLY\n");
+ if (FAILED(hres))
+ ERR("IPropertyPage_Apply != S_OK\n");
+ break;
+
+ case PSN_RESET:
+ FIXME("PSN_RESET is not implemented\n");
+ break;
+
+ case PSN_WIZBACK:
+ FIXME("PSN_WIZBACK is not implemented\n");
+ break;
+
+ case PSN_WIZNEXT:
+ FIXME("PSN_WIZNEXT is not implemented\n");
+ break;
+ }
+ break;
+
+ case WM_DESTROY:
+ hres = IPropertyPage_Deactivate(ppsu->ipp);
+ TRACE("WM_DESTROY\n");
+ if (FAILED(hres))
+ ERR("IPropertyPage_Deactivate != S_OK\n");
+ hres = IPropertyPage_SetPageSite(ppsu->ipp, NULL);
+ if (FAILED(hres))
+ ERR("IPropertyPage_SetPageSite != S_OK\n");
+ break;
+
+ default:
+ break;
+ }
+ return FALSE;
+}
+
+
+/***********************************************************************
+ * OleCreatePropertyFrame (OLEAUT32.417)
+ */
+HRESULT WINAPI OleCreatePropertyFrame(
+ HWND hwndOwner, UINT x, UINT y, LPCOLESTR lpszCaption,ULONG cObjects,
+ LPUNKNOWN* ppUnk, ULONG cPages, LPCLSID pPageClsID, LCID lcid,
+ DWORD dwReserved, LPVOID pvReserved )
+{
+ OCPFIPARAMS params;
+
+ if(dwReserved != 0 || pvReserved != NULL)
+ return E_INVALIDARG;
+
+ params.cbStructSize = sizeof(OCPFIPARAMS);
+ params.hWndOwner = hwndOwner;
+ params.x = x;
+ params.y = y;
+ params.lpszCaption = lpszCaption;
+ params.cObjects = cObjects;
+ params.lplpUnk = ppUnk;
+ params.cPages = cPages;
+ params.lpPages = pPageClsID;
+ params.lcid = lcid;
+ params.dispidInitialProperty = DISPID_UNKNOWN;
+
+ return OleCreatePropertyFrameIndirect(¶ms);
+}
+
+/***********************************************************************
+ * OleCreatePropertyFrameIndirect (OLEAUT32.416)
+ */
+HRESULT WINAPI OleCreatePropertyFrameIndirect( LPOCPFIPARAMS lpParams)
+{
+ PROPSHEETPAGEW* psp;
+ PROPSHEETHEADERW psh;
+ DLGTEMPLATE* dt;
+ int i;
+ IPropertyPage** pIProp;
+ IPropertyPage* ipp;
+ IPropertyPageSite* ipps;
+ HRESULT hres;
+ PROPPAGEINFO ppi;
+ PropertyPageSiteUnion* ppsu;
+
+ if(lpParams->dispidInitialProperty != DISPID_UNKNOWN)
+ FIXME("(%p), initial properties are not implemented\n", lpParams);
+
+ /* NOTE: Condition exist in MSDN, but Windows works with NULL captions */
+ #if 0
+ if (!lpParams->lpszCaption)
+ {
+ ERR("Caption is NULL\n");
+ return E_POINTER;
+ }
+ #endif
+
+ if (!lpParams->lplpUnk)
+ {
+ ERR("Object's array is NULL\n");
+ return E_POINTER;
+ }
+ if (!lpParams->lpPages)
+ {
+ ERR("Page's array is NULL\n");
+ return E_POINTER;
+ }
+
+ psp = GlobalAlloc(GMEM_ZEROINIT, lpParams->cPages * sizeof(PROPSHEETPAGEW));
+ if(!psp)
+ {
+ ERR("Cannot allocate memory\n");
+ return E_OUTOFMEMORY;
+ }
+ pIProp = GlobalAlloc(GMEM_ZEROINIT, lpParams->cPages * sizeof(IPropertyPage*));
+ if(!pIProp)
+ {
+ ERR("Cannot allocate memory\n");
+ return E_OUTOFMEMORY;
+ }
+
+ ppsu = GlobalAlloc(GMEM_ZEROINIT, lpParams->cPages * sizeof(PropertyPageSiteUnion));
+ if(!ppsu)
+ {
+ ERR("Cannot create DLGTEMPLATE\n");
+ return E_OUTOFMEMORY;
+ }
+
+ dt = GlobalAlloc(GMEM_ZEROINIT, sizeof(DLGTEMPLATE) + 1024);
+ if(!dt)
+ {
+ ERR("Cannot create DLGTEMPLATE\n");
+ return E_OUTOFMEMORY;
+ }
+
+ dt->style = WS_CHILD;
+ dt->dwExtendedStyle = 0;
+ dt->cdit = 0;
+ dt->x = 0;
+ dt->y = 0;
+ dt->cx = 212;
+ dt->cy = 114;
+
+ ipps = (IPropertyPageSite*) PropertyPageSiteImpl_Construct();
+
+ for(i = 0; i < lpParams->cPages; i++)
+ {
+ ipp = pIProp[i];
+ hres = CoCreateInstance(lpParams->lpPages + i, NULL, CLSCTX_INPROC_SERVER,
+ &IID_IPropertyPage, (void **) &ipp);
+ if (FAILED(hres))
+ return E_FAIL;
+
+ TRACE("Page %i (%p): %s\n", i, ipp, debugstr_guid(lpParams->lpPages + i));
+
+ hres = IPropertyPage_SetObjects(ipp, lpParams->cObjects, lpParams->lplpUnk);
+ if (FAILED(hres))
+ {
+ ERR("IPropertyPage_SetObjects error\n");
+ return E_FAIL;
+ }
+
+ /* Get info about property page */
+ hres = IPropertyPage_GetPageInfo(ipp, &ppi);
+ if (FAILED(hres))
+ {
+ ERR("IPropertyPage_GetPageInfo error\n");
+ return E_FAIL;
+ }
+ if ((MulDiv(ppi.size.cx, 4, LOWORD(GetDialogBaseUnits()))) > dt->cx)
+ dt->cx = MulDiv(ppi.size.cx, 4, LOWORD(GetDialogBaseUnits()));
+ if ((MulDiv(ppi.size.cy, 4, LOWORD(GetDialogBaseUnits()))) > dt->cy)
+ dt->cy = MulDiv(ppi.size.cy, 4, LOWORD(GetDialogBaseUnits()));
+
+ /* Fill property page */
+ psp[i].dwSize = sizeof (PROPSHEETPAGEW);
+ psp[i].dwFlags = PSP_DLGINDIRECT;
+ psp[i].hInstance = NULL;
+ psp[i].u.pResource = dt;
+ psp[i].u2.pszIcon = NULL;
+ psp[i].pfnDlgProc = DlgProc;
+ psp[i].pszTitle = ppi.pszTitle;
+ if(psp[i].pszTitle)
+ psp[i].dwFlags |= PSP_USETITLE;
+ ppsu[i].ipp = ipp;
+ ppsu[i].pagesite = ipps;
+ psp[i].lParam = (LPARAM) &(ppsu[i]);
+
+ pIProp[i] = ipp;
+ }
+
+ /* Fill property sheet header */
+ psh.dwSize = sizeof (PROPSHEETHEADERW);
+ psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USECALLBACK;
+ psh.hwndParent = lpParams->hWndOwner;
+ psh.hInstance = 0;
+ psh.u.pszIcon = NULL;
+ psh.pszCaption = lpParams->lpszCaption;
+ psh.nPages = lpParams->cPages;
+ psh.u3.ppsp = psp;
+ psh.pfnCallback = PropSheetCallback;
+ psh.u2.nStartPage = 0;
+
+ PropertySheetW (&psh);
+
+ GlobalFree(psp);
+ GlobalFree(ppsu);
+ GlobalFree(pIProp);
+ GlobalFree(dt);
+
+ return S_OK;
+}
diff --git a/dlls/oleaut32/stubs.c b/dlls/oleaut32/stubs.c
deleted file mode 100644
index d87e76e..0000000
--- a/dlls/oleaut32/stubs.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * OlePro32 Stubs
- *
- * Copyright 1999 Corel Corporation
- *
- * Sean Langley
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-#include "wine/debug.h"
-#include "ole2.h"
-#include "olectl.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(ole);
-
-/***********************************************************************
- * OleCreatePropertyFrameIndirect (OLEAUT32.416)
- */
-HRESULT WINAPI OleCreatePropertyFrameIndirect( LPOCPFIPARAMS lpParams)
-{
- FIXME("(%p), not implemented (olepro32.dll)\n",lpParams);
- return S_OK;
-}
-
-/***********************************************************************
- * OleCreatePropertyFrame (OLEAUT32.417)
- */
-HRESULT WINAPI OleCreatePropertyFrame(
- HWND hwndOwner, UINT x, UINT y, LPCOLESTR lpszCaption,ULONG cObjects,
- LPUNKNOWN* ppUnk, ULONG cPages, LPCLSID pPageClsID, LCID lcid,
- DWORD dwReserved, LPVOID pvReserved )
-{
- FIXME("(%p,%d,%d,%s,%d,%p,%d,%p,%x,%d,%p), not implemented (olepro32.dll)\n",
- hwndOwner,x,y,debugstr_w(lpszCaption),cObjects,ppUnk,cPages,
- pPageClsID, (int)lcid,dwReserved,pvReserved);
- return S_OK;
-}
--
1.6.5.8
Подробная информация о списке рассылки Wine-patches