ReactOS  0.4.15-dev-5097-g328cc41
structs.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS kernel-mode tests
3  * LICENSE: LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+)
4  * PURPOSE: Kernel-Mode Test Suite Struct alignment tests
5  * COPYRIGHT: Copyright 2018 Mark Jansen (mark.jansen@reactos.org)
6  */
7 
8 #include <kmt_test.h>
9 
10 // When searching for the correct offset,
11 // this will generate a compile-time error including the offset:
12 // char (*__kaboom1)[FIELD_OFFSET(IO_STACK_LOCATION, Parameters.Create.EaLength)] = 1;
13 // Taken from https://stackoverflow.com/a/35261673
14 
15 #if !defined(_AMD64_)
16 
17 C_ASSERT(sizeof(IO_STACK_LOCATION) == 36);
18 
23 
29 
34 
36 C_ASSERT(FIELD_OFFSET(IO_STACK_LOCATION, Parameters.SetFile.FileInformationClass) == 8);
42 
43 #else
44 
45 C_ASSERT(sizeof(IO_STACK_LOCATION) == 72);
46 
51 
57 
62 
64 C_ASSERT(FIELD_OFFSET(IO_STACK_LOCATION, Parameters.SetFile.FileInformationClass) == 16);
70 
71 #endif
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:863
C_ASSERT(sizeof(IO_STACK_LOCATION)==36)
struct _IO_STACK_LOCATION::@3760::@3789 ReadWriteConfig
_In_ UCHAR _In_ UCHAR MinorFunction
Definition: wdfdevice.h:1697
_In_ WDF_WMI_PROVIDER_CONTROL Control
Definition: wdfwmi.h:166
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
struct _IO_STACK_LOCATION::@3760::@3770 SetFile
_In_ UCHAR MajorFunction
Definition: wdfdevice.h:1697
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
struct _IO_STACK_LOCATION::@3760::@3761 Create