109{
112
114 {
116 {
121
123
126 {
130
136
138 {
140 {
144 }
145 else
146 {
150 {
153 }
154 }
156 {
160 {
162
165 {
167 }
169 {
171 }
174
177
178 SehStatus = STATUS_SUCCESS;
179 _SEH2_TRY
180 {
181 CurrentUser = MmMapLockedPagesSpecifyCache(CurrentMdl, UserMode, CacheType, QueryBuffer->Buffer, FALSE, NormalPagePriority);
182 }
183 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
184 {
185 SehStatus = _SEH2_GetExceptionCode();
186 }
187 _SEH2_END;
188 if (QueryBuffer->Status != -1)
189 {
190 ok_eq_hex(SehStatus, QueryBuffer->Status);
191 if (NT_SUCCESS(QueryBuffer->Status))
192 {
194 }
195 else
196 {
198 }
199 }
200 QueryBuffer->Status = SehStatus;
201 }
202 else
203 {
204 ExFreePoolWithTag(CurrentBuffer, 'MLPC');
205 }
206 }
207 }
208
209 QueryBuffer->Buffer = CurrentUser;
210 *OutLength = sizeof(QUERY_BUFFER);
211 }
212
213 break;
214 }
215 case IOCTL_READ_BUFFER:
216 {
218 ok_eq_size(InLength, sizeof(READ_BUFFER));
219 ok_eq_size(*OutLength, 0);
220 ok(CurrentMdl != NULL, "MDL is not
in use!\
n");
221
222 if (!skip(Buffer && InLength >= sizeof(READ_BUFFER), "Cannot
read from buffer!\
n"))
223 {
224 PREAD_BUFFER ReadBuffer;
225
226 ReadBuffer = Buffer;
227 if (!skip(ReadBuffer && ReadBuffer->Buffer == CurrentUser, "Cannot
find matching
MDL\
n"))
228 {
229 if (ReadBuffer->Buffer != NULL)
230 {
231 USHORT i;
232 PULONG KBuffer = MmGetSystemAddressForMdlSafe(CurrentMdl, NormalPagePriority);
234 ok(ReadBuffer->Length % sizeof(ULONG) == 0, "Invalid size: %
d\
n", ReadBuffer->Length);
235
237 {
238 for (i = 0; i < ReadBuffer->Length / sizeof(ULONG); ++i)
239 {
240 ok_eq_ulong(KBuffer[i], ReadBuffer->Pattern);
241 }
242 }
243 }
244 }
245
246 TestCleanEverything();
247 }
248
249 break;
250 }
251 case IOCTL_CLEAN:
252 {
253 TestCleanEverything();
254 break;
255 }
256 default:
258 DeviceObject, ControlCode, Buffer, InLength, *OutLength);
259 break;
260 }
261
262 return Status;
263}
#define IOCTL_QUERY_BUFFER
static unsigned char bytes[4]
#define ok_eq_pointer(value, expected)
#define ok_eq_size(value, expected)
void get(int argc, const char *argv[])
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
#define ExAllocatePoolWithTag(hernya, size, tag)
#define KeGetCurrentIrql()
#define ExGetPreviousMode
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
PVOID NTAPI MmMapLockedPagesSpecifyCache(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN MEMORY_CACHING_TYPE CacheType, IN PVOID BaseAddress, IN ULONG BugCheckOnFailure, IN ULONG Priority)
PVOID NTAPI MmAllocateNonCachedMemory(IN SIZE_T NumberOfBytes)
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define RtlZeroMemory(Destination, Length)
_In_ PDEVICE_OBJECT DeviceObject
_IRQL_requires_same_ typedef _In_ ULONG ControlCode
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_opt_ PHYSICAL_ADDRESS _In_ MEMORY_CACHING_TYPE CacheType
enum _MEMORY_CACHING_TYPE MEMORY_CACHING_TYPE