PATCH: DragQueryFileA & DragQueryFileW (shell32)

Sander van Leeuwen sandervl at xs4all.nl
Fri Jun 7 04:06:08 CDT 2002


Changelog:
- Handle ascii & unicode drag and drop structures in DragQueryFileA & DragQueryFileW

Author:
Sander van Leeuwen (sandervl at xs4all.nl)

--- shellole.c	Fri Jun  7 08:13:40 2002
+++ shellole.cn	Fri Jun  7 10:48:52 2002
@@ -590,6 +590,24 @@
 
 	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 */
@@ -628,6 +646,24 @@
 	if(!lpDropFileStruct) goto end;
 
 	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)





More information about the wine-patches mailing list