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

Use documented DROPFILES structure instead of internal DROPFILESTRUCT.

parent d8fab2e6
......@@ -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<cidl;i++)
......
......@@ -55,6 +55,13 @@ typedef struct
#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* lpstrMsgWndDestroyed = "OTHERWINDOWDESTROYED";
static const char* lpstrMsgShellActivate = "ACTIVATESHELLWINDOW";
......@@ -1022,7 +1029,7 @@ LPSTR SHELL_FindString(LPSTR lpEnv, LPCSTR entry)
l = strlen(entry);
for( ; *lpEnv ; lpEnv+=strlen(lpEnv)+1 )
{ if( lstrncmpiA(lpEnv, entry, l) )
{ if( strncasecmp(lpEnv, entry, l) )
continue;
if( !*(lpEnv+l) )
return (lpEnv + l); /* empty entry */
......
......@@ -9,16 +9,10 @@
#include <stdlib.h>
#include <string.h>
#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 */
......
......@@ -23,6 +23,7 @@
#include <assert.h>
#include <string.h>
#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);
}
......
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