Commit 6756049b authored by Qian Hong's avatar Qian Hong Committed by Alexandre Julliard

atl: Don't conflict GWLP_USERDATA with user applications.

parent e1999c2a
...@@ -55,6 +55,8 @@ typedef struct IOCS { ...@@ -55,6 +55,8 @@ typedef struct IOCS {
BOOL fActive, fInPlace, fWindowless; BOOL fActive, fInPlace, fWindowless;
} IOCS; } IOCS;
static const WCHAR wine_atl_iocsW[] = {'_','_','W','I','N','E','_','A','T','L','_','I','O','C','S','\0'};
/********************************************************************** /**********************************************************************
* AtlAxWin class window procedure * AtlAxWin class window procedure
*/ */
...@@ -150,7 +152,7 @@ static HRESULT IOCS_Detach( IOCS *This ) /* remove subclassing */ ...@@ -150,7 +152,7 @@ static HRESULT IOCS_Detach( IOCS *This ) /* remove subclassing */
if ( This->hWnd ) if ( This->hWnd )
{ {
SetWindowLongPtrW( This->hWnd, GWLP_WNDPROC, (ULONG_PTR) This->OrigWndProc ); SetWindowLongPtrW( This->hWnd, GWLP_WNDPROC, (ULONG_PTR) This->OrigWndProc );
SetWindowLongPtrW( This->hWnd, GWLP_USERDATA, 0 ); RemovePropW( This->hWnd, wine_atl_iocsW);
This->hWnd = NULL; This->hWnd = NULL;
} }
if ( This->control ) if ( This->control )
...@@ -906,7 +908,7 @@ static LRESULT IOCS_OnWndProc( IOCS *This, HWND hWnd, UINT uMsg, WPARAM wParam, ...@@ -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 ) 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 ); return IOCS_OnWndProc( This, hWnd, wMsg, wParam, lParam );
} }
...@@ -915,7 +917,7 @@ static HRESULT IOCS_Attach( IOCS *This, HWND hWnd, IUnknown *pUnkControl ) /* su ...@@ -915,7 +917,7 @@ static HRESULT IOCS_Attach( IOCS *This, HWND hWnd, IUnknown *pUnkControl ) /* su
This->hWnd = hWnd; This->hWnd = hWnd;
IUnknown_QueryInterface( pUnkControl, &IID_IOleObject, (void**)&This->control ); IUnknown_QueryInterface( pUnkControl, &IID_IOleObject, (void**)&This->control );
IOleObject_SetClientSite( This->control, &This->IOleClientSite_iface ); 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 ); This->OrigWndProc = (WNDPROC)SetWindowLongPtrW( hWnd, GWLP_WNDPROC, (ULONG_PTR) AtlHost_wndproc );
return S_OK; return S_OK;
...@@ -1328,7 +1330,7 @@ HRESULT WINAPI AtlAxGetHost(HWND hWnd, IUnknown **host) ...@@ -1328,7 +1330,7 @@ HRESULT WINAPI AtlAxGetHost(HWND hWnd, IUnknown **host)
*host = NULL; *host = NULL;
This = (IOCS*) GetWindowLongPtrW( hWnd, GWLP_USERDATA ); This = (IOCS*) GetPropW( hWnd, wine_atl_iocsW );
if ( !This ) if ( !This )
{ {
WARN("No container attached to %p\n", hWnd ); WARN("No container attached to %p\n", hWnd );
...@@ -1350,7 +1352,7 @@ HRESULT WINAPI AtlAxGetControl(HWND hWnd, IUnknown **pUnk) ...@@ -1350,7 +1352,7 @@ HRESULT WINAPI AtlAxGetControl(HWND hWnd, IUnknown **pUnk)
*pUnk = NULL; *pUnk = NULL;
This = (IOCS*) GetWindowLongPtrW( hWnd, GWLP_USERDATA ); This = (IOCS*) GetPropW( hWnd, wine_atl_iocsW );
if ( !This || !This->control ) if ( !This || !This->control )
{ {
WARN("No control attached to %p\n", hWnd ); WARN("No control attached to %p\n", hWnd );
......
...@@ -845,7 +845,7 @@ static void test_AtlAxAttachControl(void) ...@@ -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(hr == S_OK, "Expected AtlAxAttachControl to return S_OK, got 0x%08x\n", hr);
ok(container != NULL, "Expected not NULL!\n"); ok(container != NULL, "Expected not NULL!\n");
val = GetWindowLongW(hwnd, GWLP_USERDATA); 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); DestroyWindow(hwnd);
IUnknown_Release(control); IUnknown_Release(control);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment