MSVCRT: memcpy versus memmove

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Thu Mar 18 15:45:04 CST 2004


Changelog:
	dlls/msvcrt/msvcrt.spec
	Relay msvcrt_memcpy to memmove, CString::Insert seems to relie
	on that behaviour. Add a test case

Running webupdate from Xilinx ISE 6.1 via ise got a strange destination
directory via the CreateProcess Command line
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/msvcrt/msvcrt.spec
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/msvcrt.spec,v
retrieving revision 1.86
diff -u -r1.86 msvcrt.spec
--- wine/dlls/msvcrt/msvcrt.spec	16 Mar 2004 19:17:11 -0000	1.86
+++ wine/dlls/msvcrt/msvcrt.spec	18 Mar 2004 21:43:39 -0000
@@ -666,7 +666,7 @@
 @ cdecl mbtowc(wstr str long) MSVCRT_mbtowc
 @ cdecl memchr(ptr long long)
 @ cdecl memcmp(ptr ptr long)
-@ cdecl memcpy(ptr ptr long)
+@ cdecl memcpy(ptr ptr long) memmove
 @ cdecl memmove(ptr ptr long)
 @ cdecl memset(ptr long long)
 @ cdecl mktime(ptr) MSVCRT_mktime
Index: wine/dlls/msvcrt/tests/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/tests/Makefile.in,v
retrieving revision 1.4
diff -u -r1.4 Makefile.in
--- wine/dlls/msvcrt/tests/Makefile.in	20 Nov 2003 23:41:13 -0000	1.4
+++ wine/dlls/msvcrt/tests/Makefile.in	18 Mar 2004 21:43:39 -0000
@@ -10,7 +10,8 @@
 	cpp.c \
 	file.c \
 	heap.c \
-	scanf.c 
+	scanf.c \
+	string.c 
 
 @MAKE_TEST_RULES@
 
--- /dev/null	2003-09-23 19:59:22.000000000 +0200
+++ wine/dlls/msvcrt/tests/string.c	2004-03-18 22:34:51.000000000 +0100
@@ -0,0 +1,31 @@
+#include "wine/test.h"
+#include "winbase.h"
+#include <string.h>
+#include <stdlib.h>
+
+static void* (*pmemcpy)(void *, const void *, size_t n);
+static int* (*pmemcmp)(void *, const void *, size_t n);
+
+#define SETNOFAIL(x,y) x = (void*)GetProcAddress(hMsvcrt,y)
+#define SET(x,y) SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y)
+
+
+START_TEST(string)
+{
+    HMODULE hMsvcrt = LoadLibraryA("msvcrt.dll");
+    ok(hMsvcrt != 0, "LoadLibraryA failed\n");
+    SET(pmemcpy,"memcpy");
+    SET(pmemcmp,"memcmp");
+    void *mem;
+    char xilstring[]="c:/xilinx";
+    int nLen=strlen(xilstring);
+    
+/* MSVCRT memcpy behaves like memmove for overlapping moves, 
+   MFC42 CString::Insert seems to relie on that behaviour*/
+    mem = malloc(100);
+    ok(mem != NULL, "memory not allocated for size 0\n");
+    strcpy((char*)mem,xilstring);
+    pmemcpy((char*)mem+5, mem,nLen+1);
+    ok(pmemcmp((char*)mem+5,xilstring, nLen) == 0, 
+       "Got result %s\n",(char*)mem+5);
+}



More information about the wine-patches mailing list