37{
40
43
46
48
54
55
56
57
58
59
61
62
63 NewBuffer->BitMapInfoLength = GraphicsInfo->Info.dwBitMapInfoLength;
64
66 if (NewBuffer->BitMapInfo ==
NULL)
67 {
70 }
71
72
73 if (GraphicsInfo->Info.lpBitMapInfo->bmiHeader.biHeight > 0)
74 GraphicsInfo->Info.lpBitMapInfo->bmiHeader.biHeight = -GraphicsInfo->Info.lpBitMapInfo->bmiHeader.biHeight;
75
76
77 if (GraphicsInfo->Info.lpBitMapInfo->bmiHeader.biCompression !=
BI_RGB)
78 {
79 DPRINT1(
"biCompression == %d != BI_RGB, fix that!\n",
80 GraphicsInfo->Info.lpBitMapInfo->bmiHeader.biCompression);
81 GraphicsInfo->Info.lpBitMapInfo->bmiHeader.biCompression =
BI_RGB;
82 }
83
85 GraphicsInfo->Info.lpBitMapInfo,
86 GraphicsInfo->Info.dwBitMapInfoLength);
87
88 NewBuffer->BitMapUsage = GraphicsInfo->Info.dwUsage;
89
90
91 if ( GraphicsInfo->Info.lpBitMapInfo->bmiHeader.biWidth <= 0xFFFF &&
92 -GraphicsInfo->Info.lpBitMapInfo->bmiHeader.biHeight <= 0xFFFF )
93 {
94
97
100 }
101 else
102 {
106 goto Quit;
107 }
108
109
110
111
112
115 {
119 goto Quit;
120 }
121
122
123
124
125
127 NewBuffer->Mutex,
129 &NewBuffer->ClientMutex,
132 {
137 goto Quit;
138 }
139
140
141
142
143 SectionSize.
QuadPart = NewBuffer->BitMapInfo->bmiHeader.biSizeImage;
147 &SectionSize,
152 {
153 DPRINT1(
"Error: Impossible to create a shared section, Status = 0x%08lx\n",
Status);
159 goto Quit;
160 }
161
162
163
164
166 NewBuffer->BitMap =
NULL;
169 (
PVOID*)&NewBuffer->BitMap,
170 0,
171 0,
175 0,
178 {
179 DPRINT1(
"Error: Impossible to map the shared section, Status = 0x%08lx\n",
Status);
186 goto Quit;
187 }
188
189
190
191
192
194 NewBuffer->ClientBitMap =
NULL;
197 (
PVOID*)&NewBuffer->ClientBitMap,
198 0,
199 0,
203 0,
206 {
207 DPRINT1(
"Error: Impossible to map the shared section, Status = 0x%08lx\n",
Status);
215 goto Quit;
216 }
217
219
225
227
230
231Quit:
233}
NTSTATUS NTAPI NtCreateSection(OUT PHANDLE SectionHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN PLARGE_INTEGER MaximumSize OPTIONAL, IN ULONG SectionPageProtection OPTIONAL, IN ULONG AllocationAttributes, IN HANDLE FileHandle OPTIONAL)
NTSTATUS NTAPI NtMapViewOfSection(IN HANDLE SectionHandle, IN HANDLE ProcessHandle, IN OUT PVOID *BaseAddress, IN ULONG_PTR ZeroBits, IN SIZE_T CommitSize, IN OUT PLARGE_INTEGER SectionOffset OPTIONAL, IN OUT PSIZE_T ViewSize, IN SECTION_INHERIT InheritDisposition, IN ULONG AllocationType, IN ULONG Protect)
#define NT_SUCCESS(StatCode)
NTSTATUS NTAPI NtCreateMutant(OUT PHANDLE MutantHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN BOOLEAN InitialOwner)
#define MUTANT_ALL_ACCESS
_In_ HANDLE ProcessHandle
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
#define SECTION_ALL_ACCESS
CONSOLE_CURSOR_INFO CursorInfo
COORD OldScreenBufferSize
#define RtlCopyMemory(Destination, Source, Length)
NTSTATUS CONSOLE_SCREEN_BUFFER_Initialize(OUT PCONSOLE_SCREEN_BUFFER *Buffer, IN PCONSOLE Console, IN CONSOLE_IO_OBJECT_TYPE Type, IN SIZE_T Size)
struct _CONSOLE_SCREEN_BUFFER * PCONSOLE_SCREEN_BUFFER
#define DUPLICATE_SAME_ACCESS