From ddf16e017c57446c718c9628afda8e4ddd6d27a8 Mon Sep 17 00:00:00 2001 From: Sander van Leeuwen Date: Mon, 10 Jun 2002 02:29:09 +0000 Subject: [PATCH] Handle ascii & unicode drag and drop structures in DragQueryFileA & DragQueryFileW. --- dlls/shell32/shellole.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c index 2704ca4564..eec9f0671d 100644 --- a/dlls/shell32/shellole.c +++ b/dlls/shell32/shellole.c @@ -590,6 +590,24 @@ UINT WINAPI DragQueryFileA( lpDrop = (LPSTR) lpDropFileStruct + lpDropFileStruct->pFiles; + if(lpDropFileStruct->fWide == TRUE) { + LPWSTR lpszFileW = NULL; + + if(lpszFile) { + lpszFileW = (LPWSTR) HeapAlloc(GetProcessHeap(), 0, lLength*sizeof(WCHAR)); + if(lpszFileW == NULL) { + goto end; + } + } + i = DragQueryFileW(hDrop, lFile, lpszFileW, lLength); + + if(lpszFileW) { + WideCharToMultiByte(CP_ACP, 0, lpszFileW, -1, lpszFile, lLength, 0, NULL); + HeapFree(GetProcessHeap(), 0, lpszFileW); + } + goto end; + } + while (i++ < lFile) { while (*lpDrop++); /* skip filename */ @@ -629,6 +647,24 @@ UINT WINAPI DragQueryFileW( lpwDrop = (LPWSTR) ((LPSTR)lpDropFileStruct + lpDropFileStruct->pFiles); + if(lpDropFileStruct->fWide == FALSE) { + LPSTR lpszFileA = NULL; + + if(lpszwFile) { + lpszFileA = (LPSTR) HeapAlloc(GetProcessHeap(), 0, lLength); + if(lpszFileA == NULL) { + goto end; + } + } + i = DragQueryFileA(hDrop, lFile, lpszFileA, lLength); + + if(lpszFileA) { + MultiByteToWideChar(CP_ACP, 0, lpszFileA, -1, lpszwFile, lLength); + HeapFree(GetProcessHeap(), 0, lpszFileA); + } + goto end; + } + i = 0; while (i++ < lFile) { -- 2.32.0.93.g670b81a890