diff --git a/reactos/Makefile b/reactos/Makefile index 63a38957e2d..ff89c7e4cf9 100644 --- a/reactos/Makefile +++ b/reactos/Makefile @@ -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 index 00000000000..b33de25e73e --- /dev/null +++ b/reactos/apps/tests/sectest/Makefile @@ -0,0 +1,19 @@ +# $Id: Makefile,v 1.1 2002/05/13 20:15:33 chorns Exp $ + +PATH_TO_TOP = ../.. + +TARGET_NORC = yes + +TARGET_TYPE = program + +TARGET_APPTYPE = console + +TARGET_NAME = sectest + +TARGET_OBJECTS = $(TARGET_NAME).o + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk + +# EOF diff --git a/reactos/apps/tests/sectest/sectest.c b/reactos/apps/tests/sectest/sectest.c new file mode 100644 index 00000000000..02cdeef1055 --- /dev/null +++ b/reactos/apps/tests/sectest/sectest.c @@ -0,0 +1,72 @@ +/* $Id: sectest.c,v 1.1 2002/05/13 20:15:33 chorns Exp $ */ +#define UNICODE +#define _UNICODE +#include + +int main(int argc, char* argv[]) +{ + HANDLE hFile; + HANDLE Section; + PVOID BaseAddress; + + printf("Section Test\n"); + + hFile = CreateFile(_T("sectest.txt"), + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + CREATE_ALWAYS, + 0, + 0); + if (hFile == INVALID_HANDLE_VALUE) + { + printf("Failed to create file (err=%d)", GetLastError()); + return 1; + } + + Section = CreateFileMapping( + hFile, + NULL, + PAGE_READWRITE, + 0, + 4096, + NULL); + if (Section == NULL) + { + printf("Failed to create section (err=%d)", GetLastError()); + return 1; + } + + printf("Mapping view of section\n"); + BaseAddress = MapViewOfFile(Section, + FILE_MAP_ALL_ACCESS, + 0, + 0, + 4096); + printf("BaseAddress %x\n", (UINT) BaseAddress); + if (BaseAddress == NULL) + { + printf("Failed to map section (%d)\n", GetLastError()); + return 1; + } + + printf("Clearing section\n"); + FillMemory(BaseAddress, 4096, ' '); + printf("Copying test data to section\n"); + strcpy(BaseAddress, "test data"); + + if (!UnmapViewOfFile(BaseAddress)) + { + printf("Failed to unmap view of file (%d)\n", GetLastError()); + return 1; + } + + if (!CloseHandle(hFile)) + { + printf("Failed to close file (%d)\n", GetLastError()); + return 1; + } + + return 0; +} + diff --git a/reactos/install.bat b/reactos/install.bat index 7b135a18452..abf46e0c8cc 100644 --- a/reactos/install.bat +++ b/reactos/install.bat @@ -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