79527ea231df0d2cea6ee2e2ba6358b0f2141591
[reactos.git] / rostests / tests / shm / shmsrv.c
1 /* $Id$
2 *
3 * FILE : reactos/apps/shm/shmsrv.c
4 * AUTHOR: David Welch
5 */
6 #include <ddk/ntddk.h>
7 #include <windows.h>
8 #include <stdarg.h>
9 #include <string.h>
10 #include <stdio.h>
11
12 int main(int argc, char* argv[])
13 {
14 HANDLE Section;
15 PVOID BaseAddress;
16
17 printf("Shm test server\n");
18
19 Section = CreateFileMappingW (
20 (HANDLE) 0xFFFFFFFF,
21 NULL,
22 PAGE_READWRITE,
23 0,
24 8192,
25 L"TestSection"
26 );
27 if (Section == NULL)
28 {
29 printf("Failed to create section (err=%d)", GetLastError());
30 return 1;
31 }
32
33 printf("Mapping view of section\n");
34 BaseAddress = MapViewOfFile(Section,
35 FILE_MAP_ALL_ACCESS,
36 0,
37 0,
38 8192);
39 printf("BaseAddress %x\n", (UINT) BaseAddress);
40 if (BaseAddress == NULL)
41 {
42 printf("Failed to map section\n");
43 }
44
45 printf("Copying to section\n");
46 printf("Copying %s\n", GetCommandLineA());
47 strcpy(BaseAddress, GetCommandLineA());
48
49 Sleep(INFINITE);
50
51 return 0;
52 }
53