Qian Hong : atl: Don't conflict GWLP_USERDATA with user applications.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jan 15 15:55:41 CST 2015


Module: wine
Branch: master
Commit: 6756049be4b97de448f4bcbee8757db2cfda5c57
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6756049be4b97de448f4bcbee8757db2cfda5c57

Author: Qian Hong <qhong at codeweavers.com>
Date:   Thu Jan 15 17:28:50 2015 +0800

atl: Don't conflict GWLP_USERDATA with user applications.

---

 dlls/atl/atl_ax.c       | 12 +++++++-----
 dlls/atl100/tests/atl.c |  2 +-
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/dlls/atl/atl_ax.c b/dlls/atl/atl_ax.c
index d7cf074..d16cdfd 100644
--- a/dlls/atl/atl_ax.c
+++ b/dlls/atl/atl_ax.c
@@ -55,6 +55,8 @@ typedef struct IOCS {
     BOOL fActive, fInPlace, fWindowless;
 } IOCS;
 
+static const WCHAR wine_atl_iocsW[] = {'_','_','W','I','N','E','_','A','T','L','_','I','O','C','S','\0'};
+
 /**********************************************************************
  * AtlAxWin class window procedure
  */
@@ -150,7 +152,7 @@ static HRESULT IOCS_Detach( IOCS *This ) /* remove subclassing */
     if ( This->hWnd )
     {
         SetWindowLongPtrW( This->hWnd, GWLP_WNDPROC, (ULONG_PTR) This->OrigWndProc );
-        SetWindowLongPtrW( This->hWnd, GWLP_USERDATA, 0 );
+        RemovePropW( This->hWnd, wine_atl_iocsW);
         This->hWnd = NULL;
     }
     if ( This->control )
@@ -906,7 +908,7 @@ static LRESULT IOCS_OnWndProc( IOCS *This, HWND hWnd, UINT uMsg, WPARAM wParam,
 
 static LRESULT CALLBACK AtlHost_wndproc( HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam )
 {
-    IOCS *This = (IOCS*) GetWindowLongPtrW( hWnd, GWLP_USERDATA );
+    IOCS *This = (IOCS*) GetPropW( hWnd, wine_atl_iocsW );
     return IOCS_OnWndProc( This, hWnd, wMsg, wParam, lParam );
 }
 
@@ -915,7 +917,7 @@ static HRESULT IOCS_Attach( IOCS *This, HWND hWnd, IUnknown *pUnkControl ) /* su
     This->hWnd = hWnd;
     IUnknown_QueryInterface( pUnkControl, &IID_IOleObject, (void**)&This->control );
     IOleObject_SetClientSite( This->control, &This->IOleClientSite_iface );
-    SetWindowLongPtrW( hWnd, GWLP_USERDATA, (ULONG_PTR) This );
+    SetPropW( hWnd, wine_atl_iocsW, This );
     This->OrigWndProc = (WNDPROC)SetWindowLongPtrW( hWnd, GWLP_WNDPROC, (ULONG_PTR) AtlHost_wndproc );
 
     return S_OK;
@@ -1328,7 +1330,7 @@ HRESULT WINAPI AtlAxGetHost(HWND hWnd, IUnknown **host)
 
     *host = NULL;
 
-    This = (IOCS*) GetWindowLongPtrW( hWnd, GWLP_USERDATA );
+    This = (IOCS*) GetPropW( hWnd, wine_atl_iocsW );
     if ( !This )
     {
         WARN("No container attached to %p\n", hWnd );
@@ -1350,7 +1352,7 @@ HRESULT WINAPI AtlAxGetControl(HWND hWnd, IUnknown **pUnk)
 
     *pUnk = NULL;
 
-    This = (IOCS*) GetWindowLongPtrW( hWnd, GWLP_USERDATA );
+    This = (IOCS*) GetPropW( hWnd, wine_atl_iocsW );
     if ( !This || !This->control )
     {
         WARN("No control attached to %p\n", hWnd );
diff --git a/dlls/atl100/tests/atl.c b/dlls/atl100/tests/atl.c
index 6a8bbce..8cf0a32 100644
--- a/dlls/atl100/tests/atl.c
+++ b/dlls/atl100/tests/atl.c
@@ -845,7 +845,7 @@ static void test_AtlAxAttachControl(void)
     ok(hr == S_OK, "Expected AtlAxAttachControl to return S_OK, got 0x%08x\n", hr);
     ok(container != NULL, "Expected not NULL!\n");
     val = GetWindowLongW(hwnd, GWLP_USERDATA);
-    todo_wine ok(val == 0xdeadbeef, "Expected unchanged, returned %08x\n", val);
+    ok(val == 0xdeadbeef, "Expected unchanged, returned %08x\n", val);
     DestroyWindow(hwnd);
 
     IUnknown_Release(control);




More information about the wine-cvs mailing list