Added section test
authorCasper Hornstrup <chorns@users.sourceforge.net>
Mon, 13 May 2002 20:16:26 +0000 (20:16 +0000)
committerCasper Hornstrup <chorns@users.sourceforge.net>
Mon, 13 May 2002 20:16:26 +0000 (20:16 +0000)
svn path=/trunk/; revision=2947

reactos/Makefile
reactos/apps/tests/sectest/Makefile [new file with mode: 0644]
reactos/apps/tests/sectest/sectest.c [new file with mode: 0644]
reactos/install.bat

index 63a3895..ff89c7e 100644 (file)
@@ -69,7 +69,7 @@ SYS_APPS = services shell winlogon
 #readfile
 APPS = args hello test cat bench apc shm lpc thread event file gditest \
        pteb consume dump_shared_data vmtest regtest alive mstest nptest \
-       objdir atomtest winhello partinfo mutex stats pice isotest
+       objdir atomtest winhello partinfo mutex stats pice isotest sectest
 
 
 #
diff --git a/reactos/apps/tests/sectest/Makefile b/reactos/apps/tests/sectest/Makefile
new file mode 100644 (file)
index 0000000..b33de25
--- /dev/null
@@ -0,0 +1,19 @@
+# $Id: Makefile,v 1.1 2002/05/13 20:15:33 chorns Exp $\r
+\r
+PATH_TO_TOP = ../..\r
+\r
+TARGET_NORC = yes\r
+\r
+TARGET_TYPE = program\r
+\r
+TARGET_APPTYPE = console\r
+\r
+TARGET_NAME = sectest\r
+\r
+TARGET_OBJECTS = $(TARGET_NAME).o\r
+\r
+include $(PATH_TO_TOP)/rules.mak\r
+\r
+include $(TOOLS_PATH)/helper.mk\r
+\r
+# EOF\r
diff --git a/reactos/apps/tests/sectest/sectest.c b/reactos/apps/tests/sectest/sectest.c
new file mode 100644 (file)
index 0000000..02cdeef
--- /dev/null
@@ -0,0 +1,72 @@
+/* $Id: sectest.c,v 1.1 2002/05/13 20:15:33 chorns Exp $ */\r
+#define UNICODE\r
+#define _UNICODE\r
+#include <windows.h>\r
+\r
+int main(int argc, char* argv[])\r
+{\r
+  HANDLE hFile;\r
+       HANDLE Section;\r
+       PVOID BaseAddress;\r
+\r
+       printf("Section Test\n");\r
+\r
+   hFile = CreateFile(_T("sectest.txt"),\r
+                    GENERIC_READ | GENERIC_WRITE, \r
+                    0, \r
+                    NULL, \r
+                    CREATE_ALWAYS, \r
+                    0, \r
+                    0);\r
+  if (hFile == INVALID_HANDLE_VALUE)\r
+    {\r
+                 printf("Failed to create file (err=%d)", GetLastError());\r
+                 return 1;\r
+    }\r
+\r
+       Section = CreateFileMapping(\r
+               hFile,\r
+               NULL,\r
+               PAGE_READWRITE, \r
+               0,\r
+               4096,\r
+               NULL);\r
+       if (Section == NULL)\r
+    {\r
+                 printf("Failed to create section (err=%d)", GetLastError());\r
+                 return 1;\r
+         }\r
+       \r
+       printf("Mapping view of section\n");\r
+       BaseAddress = MapViewOfFile(Section,\r
+               FILE_MAP_ALL_ACCESS,\r
+               0,\r
+               0,\r
+               4096);\r
+       printf("BaseAddress %x\n", (UINT) BaseAddress);\r
+       if (BaseAddress == NULL)\r
+    {\r
+           printf("Failed to map section (%d)\n", GetLastError());\r
+      return 1;\r
+    }\r
+       \r
+       printf("Clearing section\n");\r
+  FillMemory(BaseAddress, 4096, ' ');\r
+       printf("Copying test data to section\n");\r
+       strcpy(BaseAddress, "test data");\r
+\r
+  if (!UnmapViewOfFile(BaseAddress))\r
+    {  \r
+           printf("Failed to unmap view of file (%d)\n", GetLastError());\r
+      return 1;\r
+    }\r
+\r
+  if (!CloseHandle(hFile))\r
+    {  \r
+           printf("Failed to close file (%d)\n", GetLastError());\r
+      return 1;\r
+    }\r
+\r
+       return 0;\r
+}\r
+\r
index 7b135a1..abf46e0 100644 (file)
@@ -92,6 +92,7 @@ copy apps\partinfo\partinfo.exe %ROS_INSTALL%\bin
 copy apps\objdir\objdir.exe %ROS_INSTALL%\bin
 copy apps\mutex\mutex.exe %ROS_INSTALL%\bin
 copy apps\winhello\winhello.exe %ROS_INSTALL%\bin
+copy apps\sectest\sectest.exe %ROS_INSTALL%\bin
 copy apps\pice\module\pice.sys %ROS_INSTALL%\system32\drivers
 copy apps\pice\module\pice.sym %ROS_INSTALL%\symbols
 copy apps\pice\pice.cfg %ROS_INSTALL%\symbols