Esempio n. 1
0
        public TypeOut DeviceIoControl <TypeIn, TypeOut>(UInt32 ioControlCode, TypeIn inStruct) where TypeIn : struct where TypeOut : struct
        {
            var inBuffer  = MarshalEx.StructToBytes <TypeIn>(inStruct);
            var outBuffer = MarshalEx.AllocateBytesForStruct <TypeOut>();

            DeviceIoControl(ioControlCode, inBuffer, outBuffer);

            return(MarshalEx.BytesToStruct <TypeOut>(outBuffer));
        }
Esempio n. 2
0
        public void DeviceIoControl <TypeIn>(UInt32 ioControlCode, TypeIn inStruct) where TypeIn : struct
        {
            var inBuffer = MarshalEx.StructToBytes <TypeIn>(inStruct);

            DeviceIoControl(ioControlCode, inBuffer, null);
        }