Damjan Jovanovic : shell32: DragQueryFile doesn't count the null terminator .

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jul 6 12:59:05 CDT 2007


Module: wine
Branch: master
Commit: 1d5575b905007f6236b56b92ba484a4fa890e4d7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1d5575b905007f6236b56b92ba484a4fa890e4d7

Author: Damjan Jovanovic <damjan.jov at gmail.com>
Date:   Fri Jul  6 07:27:56 2007 +0200

shell32: DragQueryFile doesn't count the null terminator.

---

 dlls/shell32/shell.c    |    4 +---
 dlls/shell32/shellole.c |    9 ++-------
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/dlls/shell32/shell.c b/dlls/shell32/shell.c
index cb95078..7ffc33b 100644
--- a/dlls/shell32/shell.c
+++ b/dlls/shell32/shell.c
@@ -121,10 +121,8 @@ UINT16 WINAPI DragQueryFile16(
 	}
 
 	i = strlen(lpDrop);
-	i++;
 	if (!lpszFile ) goto end;   /* needed buffer size */
-	i = (wLength > i) ? i : wLength;
-	lstrcpynA (lpszFile,  lpDrop,  i);
+	lstrcpynA (lpszFile, lpDrop, wLength);
 end:
 	GlobalUnlock16(hDrop);
 	return i;
diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c
index e5d8368..f4853b5 100644
--- a/dlls/shell32/shellole.c
+++ b/dlls/shell32/shellole.c
@@ -621,10 +621,8 @@ UINT WINAPI DragQueryFileA(
 	}
 
 	i = strlen(lpDrop);
-	i++;
 	if (!lpszFile ) goto end;   /* needed buffer size */
-	i = (lLength > i) ? i : lLength;
-	lstrcpynA (lpszFile,  lpDrop,  i);
+	lstrcpynA (lpszFile, lpDrop, lLength);
 end:
 	GlobalUnlock(hDrop);
 	return i;
@@ -679,11 +677,8 @@ UINT WINAPI DragQueryFileW(
 	}
 
 	i = strlenW(lpwDrop);
-	i++;
 	if ( !lpszwFile) goto end;   /* needed buffer size */
-
-	i = (lLength > i) ? i : lLength;
-	lstrcpynW (lpszwFile, lpwDrop, i);
+	lstrcpynW (lpszwFile, lpwDrop, lLength);
 end:
 	GlobalUnlock(hDrop);
 	return i;




More information about the wine-cvs mailing list