mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
Added section test
svn path=/trunk/; revision=2947
This commit is contained in:
parent
c804ca06be
commit
7922a9018d
4 changed files with 93 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
||||
#
|
||||
|
|
19
reactos/apps/tests/sectest/Makefile
Normal file
19
reactos/apps/tests/sectest/Makefile
Normal file
|
@ -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
|
72
reactos/apps/tests/sectest/sectest.c
Normal file
72
reactos/apps/tests/sectest/sectest.c
Normal file
|
@ -0,0 +1,72 @@
|
|||
/* $Id: sectest.c,v 1.1 2002/05/13 20:15:33 chorns Exp $ */
|
||||
#define UNICODE
|
||||
#define _UNICODE
|
||||
#include <windows.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue