[ros-diffs] [fireball] 23569: Dmitry Philippov: Add more tests for delayed file operations

fireball at svn.reactos.org fireball at svn.reactos.org
Sun Aug 13 21:12:53 CEST 2006


Author: fireball
Date: Sun Aug 13 23:12:53 2006
New Revision: 23569

URL: http://svn.reactos.org/svn/reactos?rev=23569&view=rev
Log:
Dmitry Philippov: Add more tests for delayed file operations

Modified:
    trunk/reactos/base/applications/testsets/smss/movefile/movefile.cpp

Modified: trunk/reactos/base/applications/testsets/smss/movefile/movefile.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/testsets/smss/movefile/movefile.cpp?rev=23569&r1=23568&r2=23569&view=diff
==============================================================================
--- trunk/reactos/base/applications/testsets/smss/movefile/movefile.cpp (original)
+++ trunk/reactos/base/applications/testsets/smss/movefile/movefile.cpp Sun Aug 13 23:12:53 2006
@@ -83,10 +83,12 @@
 	char sBuf[255];
 	DWORD dwSize;
 	HANDLE hFile = NULL;
-
+	BOOL fReturnValue;
+
+	char *szxReplacedFile = "c:\\testFileIsReplaced";
+	char *szxMovedFileWithRepl = "c:\\testFileShouldBeMovedW";
 	char *szxMovedFile = "c:\\testFileShouldBeMoved";
 	char *szxNewMovedFile = "c:\\testFileIsMoved";
-
 	char *szxDeletedFile = "c:\\testFileShouldBeDeleted";
 
 	memset(sBuf, 0xaa, sizeof(sBuf));
@@ -123,15 +125,44 @@
 	WriteFile(hFile, sBuf, sizeof(sBuf), &dwSize, NULL);
 	CloseHandle(hFile);
 
-
-	BOOL fReturnValue;
+	hFile = CreateFile(
+		szxReplacedFile,
+		FILE_ALL_ACCESS,
+		0,
+		NULL,
+		CREATE_ALWAYS,
+		FILE_ATTRIBUTE_NORMAL,
+		NULL);
+	if(NULL == hFile) {
+		printf("Can't create the %s file, err=%ld \n", szxReplacedFile, GetLastError());
+		return 1;
+	}
+	WriteFile(hFile, sBuf, sizeof(sBuf), &dwSize, NULL);
+	CloseHandle(hFile);
+
+	
+	hFile = CreateFile(
+		szxMovedFileWithRepl,
+		FILE_ALL_ACCESS,
+		0,
+		NULL,
+		CREATE_ALWAYS,
+		FILE_ATTRIBUTE_NORMAL,
+		NULL);
+	if(NULL == hFile) {
+		printf("Can't create the %s file, err=%ld \n", szxMovedFileWithRepl, GetLastError());
+		return 1;
+	}
+	WriteFile(hFile, sBuf, sizeof(sBuf), &dwSize, NULL);
+	CloseHandle(hFile);
+
 
 	fReturnValue = MoveFileEx(
 		szxDeletedFile,
 		NULL,
 		MOVEFILE_DELAY_UNTIL_REBOOT);
 	if( !fReturnValue ) {
-		printf("Can't move the %s file, err=%ld \n", szxMovedFile, GetLastError());
+		printf("Can't move the %s file, err=%ld \n", szxDeletedFile, GetLastError());
 		return 1;
 	}
 
@@ -148,6 +179,17 @@
 
 	ShowRegValue();
 
+	fReturnValue = MoveFileEx(
+		szxMovedFileWithRepl,
+		szxReplacedFile,
+		MOVEFILE_DELAY_UNTIL_REBOOT|MOVEFILE_REPLACE_EXISTING);
+	if( !fReturnValue ) {
+		printf("Can't move the %s file, err=%ld \n", szxMovedFileWithRepl, GetLastError());
+		return 1;
+	}
+
+	ShowRegValue();
+
 	return 0;
 }
 




More information about the Ros-diffs mailing list