#include <stdio.h>
#include <windows.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
◆ main()
Definition at line 11 of file map_dup_inherit.c.
11 {
13 void *file_map;
15
17
19 #ifdef WIN64
21 #else
23 #endif
24 } else {
34 return 100;
35 }
36 }
37
38 if( !file_map ) {
39 fprintf(
stderr,
"%lu: Could not create anonymous file map.\n",
41 return 1;
42 }
43
46 0,
47 0,
48 0x1000 );
49
50 if( !file_view ) {
55 return 2;
56 }
57
59 fprintf(
stderr,
"%lu: VirtualAlloc failed to realize the page.\n",
63 return 3;
64 }
65
68
69 if(
x[0] != 0x12345678 ) {
70 fprintf(
stderr,
"%lu: Can't write to the memory (%08x != 0x12345678)\n",
72 return 4;
73 }
74
79
80 memset( &si, 0,
sizeof( si ) );
82
85
92
93 return 5;
94 }
95
97 fprintf(
stderr,
"%lu: Failed to wait for child process to terminate.\n",
101 return 6;
102 }
103
106
107 }
108
109 return 0;
110}
#define INVALID_HANDLE_VALUE
BOOL WINAPI SetHandleInformation(IN HANDLE hObject, IN DWORD dwMask, IN DWORD dwFlags)
GLint GLint GLint GLint GLint x
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
_Check_return_ _ACRTIMP __int64 __cdecl _atoi64(_In_z_ char const *_String)
#define sprintf(buf, format,...)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
#define CreateFileMapping
#define HANDLE_FLAG_INHERIT
DWORD WINAPI GetCurrentProcessId(void)