Commit 60e17529 authored by Alexandre Julliard's avatar Alexandre Julliard

Use documented DROPFILES structure instead of internal DROPFILESTRUCT.

parent d8fab2e6
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "pidl.h" #include "pidl.h"
#include "wine/undocshell.h" #include "wine/undocshell.h"
#include "shell32_main.h" #include "shell32_main.h"
#include "shell.h" /* DROPFILESTRUCT */
DEFAULT_DEBUG_CHANNEL(shell) DEFAULT_DEBUG_CHANNEL(shell)
...@@ -96,13 +95,13 @@ HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) ...@@ -96,13 +95,13 @@ HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl)
char szRootPath[MAX_PATH]; char szRootPath[MAX_PATH];
char szFileName[MAX_PATH]; char szFileName[MAX_PATH];
HGLOBAL hGlobal; HGLOBAL hGlobal;
LPDROPFILESTRUCT pDropFiles; DROPFILES *pDropFiles;
int offset; int offset;
TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl); TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl);
/* get the size needed */ /* get the size needed */
size = sizeof(DROPFILESTRUCT); size = sizeof(DROPFILES);
SHGetPathFromIDListA(pidlRoot, szRootPath); SHGetPathFromIDListA(pidlRoot, szRootPath);
PathAddBackslashA(szRootPath); PathAddBackslashA(szRootPath);
...@@ -120,11 +119,11 @@ HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) ...@@ -120,11 +119,11 @@ HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl)
hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size); hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size);
if(!hGlobal) return hGlobal; if(!hGlobal) return hGlobal;
pDropFiles = (LPDROPFILESTRUCT)GlobalLock(hGlobal); pDropFiles = (DROPFILES *)GlobalLock(hGlobal);
pDropFiles->lSize = sizeof(DROPFILESTRUCT); pDropFiles->pFiles = sizeof(DROPFILES);
pDropFiles->fWideChar = FALSE; pDropFiles->fWide = FALSE;
offset = pDropFiles->lSize; offset = pDropFiles->pFiles;
strcpy(szFileName, szRootPath); strcpy(szFileName, szRootPath);
for (i=0; i<cidl;i++) for (i=0; i<cidl;i++)
......
...@@ -55,6 +55,13 @@ typedef struct ...@@ -55,6 +55,13 @@ typedef struct
#include "poppack.h" #include "poppack.h"
typedef struct { /* structure for dropped files */
WORD wSize;
POINT16 ptMousePos;
BOOL16 fInNonClientArea;
/* memory block with filenames follows */
} DROPFILESTRUCT16, *LPDROPFILESTRUCT16;
static const char* lpstrMsgWndCreated = "OTHERWINDOWCREATED"; static const char* lpstrMsgWndCreated = "OTHERWINDOWCREATED";
static const char* lpstrMsgWndDestroyed = "OTHERWINDOWDESTROYED"; static const char* lpstrMsgWndDestroyed = "OTHERWINDOWDESTROYED";
static const char* lpstrMsgShellActivate = "ACTIVATESHELLWINDOW"; static const char* lpstrMsgShellActivate = "ACTIVATESHELLWINDOW";
...@@ -1022,7 +1029,7 @@ LPSTR SHELL_FindString(LPSTR lpEnv, LPCSTR entry) ...@@ -1022,7 +1029,7 @@ LPSTR SHELL_FindString(LPSTR lpEnv, LPCSTR entry)
l = strlen(entry); l = strlen(entry);
for( ; *lpEnv ; lpEnv+=strlen(lpEnv)+1 ) for( ; *lpEnv ; lpEnv+=strlen(lpEnv)+1 )
{ if( lstrncmpiA(lpEnv, entry, l) ) { if( strncasecmp(lpEnv, entry, l) )
continue; continue;
if( !*(lpEnv+l) ) if( !*(lpEnv+l) )
return (lpEnv + l); /* empty entry */ return (lpEnv + l); /* empty entry */
......
...@@ -9,16 +9,10 @@ ...@@ -9,16 +9,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "wine/obj_base.h" #include "shlobj.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 "shlguid.h" #include "shlguid.h"
#include "winreg.h" #include "winreg.h"
#include "wine/unicode.h"
#include "winerror.h" #include "winerror.h"
#include "debugtools.h" #include "debugtools.h"
...@@ -543,15 +537,15 @@ void WINAPI DragFinish(HDROP h) ...@@ -543,15 +537,15 @@ void WINAPI DragFinish(HDROP h)
*/ */
BOOL WINAPI DragQueryPoint(HDROP hDrop, POINT *p) BOOL WINAPI DragQueryPoint(HDROP hDrop, POINT *p)
{ {
LPDROPFILESTRUCT lpDropFileStruct; DROPFILES *lpDropFileStruct;
BOOL bRet; BOOL bRet;
TRACE("\n"); TRACE("\n");
lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop); lpDropFileStruct = (DROPFILES *) GlobalLock(hDrop);
memcpy(p,&lpDropFileStruct->ptMousePos,sizeof(POINT)); *p = lpDropFileStruct->pt;
bRet = lpDropFileStruct->fInNonClientArea; bRet = lpDropFileStruct->fNC;
GlobalUnlock(hDrop); GlobalUnlock(hDrop);
return bRet; return bRet;
...@@ -568,13 +562,13 @@ UINT WINAPI DragQueryFileA( ...@@ -568,13 +562,13 @@ UINT WINAPI DragQueryFileA(
{ {
LPSTR lpDrop; LPSTR lpDrop;
UINT i = 0; UINT i = 0;
LPDROPFILESTRUCT lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop); DROPFILES *lpDropFileStruct = (DROPFILES *) GlobalLock(hDrop);
TRACE("(%08x, %x, %p, %u)\n", hDrop,lFile,lpszFile,lLength); TRACE("(%08x, %x, %p, %u)\n", hDrop,lFile,lpszFile,lLength);
if(!lpDropFileStruct) goto end; if(!lpDropFileStruct) goto end;
lpDrop = (LPSTR) lpDropFileStruct + lpDropFileStruct->lSize; lpDrop = (LPSTR) lpDropFileStruct + lpDropFileStruct->pFiles;
while (i++ < lFile) while (i++ < lFile)
{ {
...@@ -607,13 +601,13 @@ UINT WINAPI DragQueryFileW( ...@@ -607,13 +601,13 @@ UINT WINAPI DragQueryFileW(
{ {
LPWSTR lpwDrop; LPWSTR lpwDrop;
UINT i = 0; UINT i = 0;
LPDROPFILESTRUCT lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop); DROPFILES *lpDropFileStruct = (DROPFILES *) GlobalLock(hDrop);
TRACE("(%08x, %x, %p, %u)\n", hDrop,lFile,lpszwFile,lLength); TRACE("(%08x, %x, %p, %u)\n", hDrop,lFile,lpszwFile,lLength);
if(!lpDropFileStruct) goto end; if(!lpDropFileStruct) goto end;
lpwDrop = (LPWSTR) lpDropFileStruct + lpDropFileStruct->lSize; lpwDrop = (LPWSTR) lpDropFileStruct + lpDropFileStruct->pFiles;
i = 0; i = 0;
while (i++ < lFile) while (i++ < lFile)
...@@ -626,7 +620,7 @@ UINT WINAPI DragQueryFileW( ...@@ -626,7 +620,7 @@ UINT WINAPI DragQueryFileW(
} }
} }
i = lstrlenW(lpwDrop); i = strlenW(lpwDrop);
i++; i++;
if ( !lpszwFile) goto end; /* needed buffer size */ if ( !lpszwFile) goto end; /* needed buffer size */
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include "wine/winuser16.h" #include "wine/winuser16.h"
#include "shlobj.h" /* DROPFILES */
#include "clipboard.h" #include "clipboard.h"
#include "dce.h" #include "dce.h"
...@@ -35,7 +36,6 @@ ...@@ -35,7 +36,6 @@
#include "mouse.h" #include "mouse.h"
#include "options.h" #include "options.h"
#include "queue.h" #include "queue.h"
#include "shell.h"
#include "win.h" #include "win.h"
#include "winpos.h" #include "winpos.h"
#include "services.h" #include "services.h"
...@@ -1587,24 +1587,25 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event ) ...@@ -1587,24 +1587,25 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event )
} }
if( aux_long && aux_long < 65535 ) if( aux_long && aux_long < 65535 )
{ {
HDROP16 hDrop; HDROP hDrop;
LPDROPFILESTRUCT16 lpDrop; DROPFILES *lpDrop;
aux_long += sizeof(DROPFILESTRUCT16) + 1; aux_long += sizeof(DROPFILES) + 1;
hDrop = (HDROP16)GlobalAlloc16( GMEM_SHARE, aux_long ); hDrop = GlobalAlloc( GMEM_SHARE, aux_long );
lpDrop = (LPDROPFILESTRUCT16) GlobalLock16( hDrop ); lpDrop = (DROPFILES*)GlobalLock( hDrop );
if( lpDrop ) if( lpDrop )
{ {
lpDrop->wSize = sizeof(DROPFILESTRUCT16); lpDrop->pFiles = sizeof(DROPFILES);
lpDrop->ptMousePos.x = (INT16)x; lpDrop->pt.x = x;
lpDrop->ptMousePos.y = (INT16)y; lpDrop->pt.y = y;
lpDrop->fInNonClientArea = (BOOL16) lpDrop->fNC =
( x < (pDropWnd->rectClient.left - pDropWnd->rectWindow.left) || ( x < (pDropWnd->rectClient.left - pDropWnd->rectWindow.left) ||
y < (pDropWnd->rectClient.top - pDropWnd->rectWindow.top) || y < (pDropWnd->rectClient.top - pDropWnd->rectWindow.top) ||
x > (pDropWnd->rectClient.right - pDropWnd->rectWindow.left) || x > (pDropWnd->rectClient.right - pDropWnd->rectWindow.left) ||
y > (pDropWnd->rectClient.bottom - pDropWnd->rectWindow.top) ); y > (pDropWnd->rectClient.bottom - pDropWnd->rectWindow.top) );
p_drop = ((char*)lpDrop) + sizeof(DROPFILESTRUCT16); lpDrop->fWide = FALSE;
p_drop = (char *)(lpDrop + 1);
p = p_data; p = p_data;
while(*p) while(*p)
{ {
...@@ -1616,8 +1617,7 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event ) ...@@ -1616,8 +1617,7 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event )
p += strlen(p) + 1; p += strlen(p) + 1;
} }
*p_drop = '\0'; *p_drop = '\0';
PostMessage16( hWnd, WM_DROPFILES, PostMessageA( hWnd, WM_DROPFILES, hDrop, 0L );
(WPARAM16)hDrop, 0L );
} }
} }
} }
...@@ -1645,19 +1645,16 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event ) ...@@ -1645,19 +1645,16 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event )
unsigned char *p_data = NULL; /* property data */ unsigned char *p_data = NULL; /* property data */
char *p_drop = NULL; char *p_drop = NULL;
char *p, *next; char *p, *next;
int x, y, drop32 = FALSE ; int x, y;
DROPFILES *lpDrop;
HDROP hDrop;
union { union {
Atom atom_aux; Atom atom_aux;
int i; int i;
Window w_aux; Window w_aux;
} u; /* unused */ } u; /* unused */
union {
HDROP16 h16;
HDROP h32;
} hDrop;
pWnd = WIN_FindWndPtr(hWnd); pWnd = WIN_FindWndPtr(hWnd);
drop32 = pWnd->flags & WIN_ISWIN32;
if (!(pWnd->dwExStyle & WS_EX_ACCEPTFILES)) if (!(pWnd->dwExStyle & WS_EX_ACCEPTFILES))
{ {
...@@ -1699,41 +1696,21 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event ) ...@@ -1699,41 +1696,21 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event )
pDropWnd = WIN_FindWndPtr( hWnd ); pDropWnd = WIN_FindWndPtr( hWnd );
if (drop32) { drop_len += sizeof(DROPFILES) + 1;
LPDROPFILESTRUCT lpDrop; hDrop = (HDROP)GlobalAlloc( GMEM_SHARE, drop_len );
drop_len += sizeof(DROPFILESTRUCT) + 1; lpDrop = (DROPFILES *) GlobalLock( hDrop );
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)
( 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 ) { if( lpDrop ) {
lpDrop->wSize = sizeof(DROPFILESTRUCT16); lpDrop->pFiles = sizeof(DROPFILES);
lpDrop->ptMousePos.x = (INT16)x; lpDrop->pt.x = (INT)x;
lpDrop->ptMousePos.y = (INT16)y; lpDrop->pt.y = (INT)y;
lpDrop->fInNonClientArea = (BOOL16) lpDrop->fNC =
( x < (pDropWnd->rectClient.left - pDropWnd->rectWindow.left) || ( x < (pDropWnd->rectClient.left - pDropWnd->rectWindow.left) ||
y < (pDropWnd->rectClient.top - pDropWnd->rectWindow.top) || y < (pDropWnd->rectClient.top - pDropWnd->rectWindow.top) ||
x > (pDropWnd->rectClient.right - pDropWnd->rectWindow.left) || x > (pDropWnd->rectClient.right - pDropWnd->rectWindow.left) ||
y > (pDropWnd->rectClient.bottom - pDropWnd->rectWindow.top) ); y > (pDropWnd->rectClient.bottom - pDropWnd->rectWindow.top) );
p_drop = ((char*)lpDrop) + sizeof(DROPFILESTRUCT16); lpDrop->fWide = FALSE;
} p_drop = (char*)(lpDrop + 1);
} }
/* create message content */ /* create message content */
...@@ -1763,18 +1740,8 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event ) ...@@ -1763,18 +1740,8 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event )
*p_drop = '\0'; *p_drop = '\0';
} }
if (drop32) { GlobalUnlock(hDrop);
/* can not use PostMessage32A because it is currently based on PostMessageA( hWnd, WM_DROPFILES, hDrop, 0L );
* 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 );
}
} }
WIN_ReleaseWndPtr(pDropWnd); WIN_ReleaseWndPtr(pDropWnd);
} }
......
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