From 60e175294bb13bb0410923efc8da5c142fa3288f Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 25 Sep 2000 23:56:41 +0000 Subject: [PATCH] Use documented DROPFILES structure instead of internal DROPFILESTRUCT. --- dlls/shell32/clipboard.c | 13 +++--- dlls/shell32/shell.c | 9 +++- dlls/shell32/shellole.c | 30 ++++++------- windows/x11drv/event.c | 93 +++++++++++++--------------------------- 4 files changed, 56 insertions(+), 89 deletions(-) diff --git a/dlls/shell32/clipboard.c b/dlls/shell32/clipboard.c index 8d3d6934133..912c80b2040 100644 --- a/dlls/shell32/clipboard.c +++ b/dlls/shell32/clipboard.c @@ -26,7 +26,6 @@ #include "pidl.h" #include "wine/undocshell.h" #include "shell32_main.h" -#include "shell.h" /* DROPFILESTRUCT */ DEFAULT_DEBUG_CHANNEL(shell) @@ -96,13 +95,13 @@ HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) char szRootPath[MAX_PATH]; char szFileName[MAX_PATH]; HGLOBAL hGlobal; - LPDROPFILESTRUCT pDropFiles; + DROPFILES *pDropFiles; int offset; TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl); /* get the size needed */ - size = sizeof(DROPFILESTRUCT); + size = sizeof(DROPFILES); SHGetPathFromIDListA(pidlRoot, szRootPath); PathAddBackslashA(szRootPath); @@ -120,11 +119,11 @@ HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size); if(!hGlobal) return hGlobal; - pDropFiles = (LPDROPFILESTRUCT)GlobalLock(hGlobal); - pDropFiles->lSize = sizeof(DROPFILESTRUCT); - pDropFiles->fWideChar = FALSE; + pDropFiles = (DROPFILES *)GlobalLock(hGlobal); + pDropFiles->pFiles = sizeof(DROPFILES); + pDropFiles->fWide = FALSE; - offset = pDropFiles->lSize; + offset = pDropFiles->pFiles; strcpy(szFileName, szRootPath); for (i=0; i #include -#include "wine/obj_base.h" -#include "wine/obj_shelllink.h" -#include "wine/obj_shellfolder.h" -#include "wine/obj_shellbrowser.h" -#include "wine/obj_contextmenu.h" -#include "wine/obj_shellextinit.h" -#include "wine/obj_extracticon.h" - +#include "shlobj.h" #include "shlguid.h" #include "winreg.h" +#include "wine/unicode.h" #include "winerror.h" #include "debugtools.h" @@ -543,15 +537,15 @@ void WINAPI DragFinish(HDROP h) */ BOOL WINAPI DragQueryPoint(HDROP hDrop, POINT *p) { - LPDROPFILESTRUCT lpDropFileStruct; + DROPFILES *lpDropFileStruct; BOOL bRet; TRACE("\n"); - lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop); - - memcpy(p,&lpDropFileStruct->ptMousePos,sizeof(POINT)); - bRet = lpDropFileStruct->fInNonClientArea; + lpDropFileStruct = (DROPFILES *) GlobalLock(hDrop); + + *p = lpDropFileStruct->pt; + bRet = lpDropFileStruct->fNC; GlobalUnlock(hDrop); return bRet; @@ -568,13 +562,13 @@ UINT WINAPI DragQueryFileA( { LPSTR lpDrop; UINT i = 0; - LPDROPFILESTRUCT lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop); + DROPFILES *lpDropFileStruct = (DROPFILES *) GlobalLock(hDrop); TRACE("(%08x, %x, %p, %u)\n", hDrop,lFile,lpszFile,lLength); if(!lpDropFileStruct) goto end; - lpDrop = (LPSTR) lpDropFileStruct + lpDropFileStruct->lSize; + lpDrop = (LPSTR) lpDropFileStruct + lpDropFileStruct->pFiles; while (i++ < lFile) { @@ -607,13 +601,13 @@ UINT WINAPI DragQueryFileW( { LPWSTR lpwDrop; UINT i = 0; - LPDROPFILESTRUCT lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop); + DROPFILES *lpDropFileStruct = (DROPFILES *) GlobalLock(hDrop); TRACE("(%08x, %x, %p, %u)\n", hDrop,lFile,lpszwFile,lLength); if(!lpDropFileStruct) goto end; - lpwDrop = (LPWSTR) lpDropFileStruct + lpDropFileStruct->lSize; + lpwDrop = (LPWSTR) lpDropFileStruct + lpDropFileStruct->pFiles; i = 0; while (i++ < lFile) @@ -626,7 +620,7 @@ UINT WINAPI DragQueryFileW( } } - i = lstrlenW(lpwDrop); + i = strlenW(lpwDrop); i++; if ( !lpszwFile) goto end; /* needed buffer size */ diff --git a/windows/x11drv/event.c b/windows/x11drv/event.c index fb059fbbabc..6b68235d28d 100644 --- a/windows/x11drv/event.c +++ b/windows/x11drv/event.c @@ -23,6 +23,7 @@ #include #include #include "wine/winuser16.h" +#include "shlobj.h" /* DROPFILES */ #include "clipboard.h" #include "dce.h" @@ -35,7 +36,6 @@ #include "mouse.h" #include "options.h" #include "queue.h" -#include "shell.h" #include "win.h" #include "winpos.h" #include "services.h" @@ -1587,24 +1587,25 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event ) } if( aux_long && aux_long < 65535 ) { - HDROP16 hDrop; - LPDROPFILESTRUCT16 lpDrop; + HDROP hDrop; + DROPFILES *lpDrop; - aux_long += sizeof(DROPFILESTRUCT16) + 1; - hDrop = (HDROP16)GlobalAlloc16( GMEM_SHARE, aux_long ); - lpDrop = (LPDROPFILESTRUCT16) GlobalLock16( hDrop ); + aux_long += sizeof(DROPFILES) + 1; + hDrop = GlobalAlloc( GMEM_SHARE, aux_long ); + lpDrop = (DROPFILES*)GlobalLock( hDrop ); if( lpDrop ) { - lpDrop->wSize = sizeof(DROPFILESTRUCT16); - lpDrop->ptMousePos.x = (INT16)x; - lpDrop->ptMousePos.y = (INT16)y; - lpDrop->fInNonClientArea = (BOOL16) + lpDrop->pFiles = sizeof(DROPFILES); + lpDrop->pt.x = x; + lpDrop->pt.y = y; + lpDrop->fNC = ( x < (pDropWnd->rectClient.left - pDropWnd->rectWindow.left) || y < (pDropWnd->rectClient.top - pDropWnd->rectWindow.top) || x > (pDropWnd->rectClient.right - pDropWnd->rectWindow.left) || y > (pDropWnd->rectClient.bottom - pDropWnd->rectWindow.top) ); - p_drop = ((char*)lpDrop) + sizeof(DROPFILESTRUCT16); + lpDrop->fWide = FALSE; + p_drop = (char *)(lpDrop + 1); p = p_data; while(*p) { @@ -1616,8 +1617,7 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event ) p += strlen(p) + 1; } *p_drop = '\0'; - PostMessage16( hWnd, WM_DROPFILES, - (WPARAM16)hDrop, 0L ); + PostMessageA( hWnd, WM_DROPFILES, hDrop, 0L ); } } } @@ -1645,19 +1645,16 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event ) unsigned char *p_data = NULL; /* property data */ char *p_drop = NULL; char *p, *next; - int x, y, drop32 = FALSE ; + int x, y; + DROPFILES *lpDrop; + HDROP hDrop; union { Atom atom_aux; int i; Window w_aux; } u; /* unused */ - union { - HDROP16 h16; - HDROP h32; - } hDrop; pWnd = WIN_FindWndPtr(hWnd); - drop32 = pWnd->flags & WIN_ISWIN32; if (!(pWnd->dwExStyle & WS_EX_ACCEPTFILES)) { @@ -1699,43 +1696,23 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event ) pDropWnd = WIN_FindWndPtr( hWnd ); - if (drop32) { - LPDROPFILESTRUCT lpDrop; - drop_len += sizeof(DROPFILESTRUCT) + 1; - hDrop.h32 = (HDROP)GlobalAlloc( GMEM_SHARE, drop_len ); - lpDrop = (LPDROPFILESTRUCT) GlobalLock( hDrop.h32 ); - - if( lpDrop ) { - lpDrop->lSize = sizeof(DROPFILESTRUCT); - lpDrop->ptMousePos.x = (INT)x; - lpDrop->ptMousePos.y = (INT)y; - lpDrop->fInNonClientArea = (BOOL) + drop_len += sizeof(DROPFILES) + 1; + hDrop = (HDROP)GlobalAlloc( GMEM_SHARE, drop_len ); + lpDrop = (DROPFILES *) GlobalLock( hDrop ); + + if( lpDrop ) { + lpDrop->pFiles = sizeof(DROPFILES); + lpDrop->pt.x = (INT)x; + lpDrop->pt.y = (INT)y; + lpDrop->fNC = ( x < (pDropWnd->rectClient.left - pDropWnd->rectWindow.left) || y < (pDropWnd->rectClient.top - pDropWnd->rectWindow.top) || x > (pDropWnd->rectClient.right - pDropWnd->rectWindow.left) || y > (pDropWnd->rectClient.bottom - pDropWnd->rectWindow.top) ); - lpDrop->fWideChar = FALSE; - p_drop = ((char*)lpDrop) + sizeof(DROPFILESTRUCT); - } - } else { - LPDROPFILESTRUCT16 lpDrop; - drop_len += sizeof(DROPFILESTRUCT16) + 1; - hDrop.h16 = (HDROP16)GlobalAlloc16( GMEM_SHARE, drop_len ); - lpDrop = (LPDROPFILESTRUCT16) GlobalLock16( hDrop.h16 ); - - if( lpDrop ) { - lpDrop->wSize = sizeof(DROPFILESTRUCT16); - lpDrop->ptMousePos.x = (INT16)x; - lpDrop->ptMousePos.y = (INT16)y; - lpDrop->fInNonClientArea = (BOOL16) - ( x < (pDropWnd->rectClient.left - pDropWnd->rectWindow.left) || - y < (pDropWnd->rectClient.top - pDropWnd->rectWindow.top) || - x > (pDropWnd->rectClient.right - pDropWnd->rectWindow.left) || - y > (pDropWnd->rectClient.bottom - pDropWnd->rectWindow.top) ); - p_drop = ((char*)lpDrop) + sizeof(DROPFILESTRUCT16); - } + lpDrop->fWide = FALSE; + p_drop = (char*)(lpDrop + 1); } - + /* create message content */ if (p_drop) { p = p_data; @@ -1763,18 +1740,8 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event ) *p_drop = '\0'; } - if (drop32) { - /* can not use PostMessage32A because it is currently based on - * PostMessage16 and WPARAM32 would be truncated to WPARAM16 - */ - GlobalUnlock(hDrop.h32); - SendMessageA( hWnd, WM_DROPFILES, - (WPARAM)hDrop.h32, 0L ); - } else { - GlobalUnlock16(hDrop.h16); - PostMessage16( hWnd, WM_DROPFILES, - (WPARAM16)hDrop.h16, 0L ); - } + GlobalUnlock(hDrop); + PostMessageA( hWnd, WM_DROPFILES, hDrop, 0L ); } WIN_ReleaseWndPtr(pDropWnd); }