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