Sylloge
A C# helper library
code/WinAPI/Structs.cs
Go to the documentation of this file.
00001 using System;
00002 using System.Collections.Generic;
00003 using System.Linq;
00004 using System.Runtime.InteropServices;
00005 using System.Text;
00006 
00007 namespace Sylloge
00008 {
00009     public static partial class WinAPI
00010     {
00011         #region Structures and Classes for API calls
00012 
00013         [StructLayout(LayoutKind.Sequential)]
00014         public struct Rectangle
00015         {
00016             public int Left;
00017             public int Top;
00018             public int Right;
00019             public int Bottom;
00020         }
00021 
00022         [StructLayout(LayoutKind.Sequential)]
00023         public struct Size
00024         {
00025             public Int32 cx;
00026             public Int32 cy;
00027 
00028             public Size(Int32 x, Int32 y)
00029             {
00030                 cx = x;
00031                 cy = y;
00032             }
00033         }
00034 
00035         [StructLayout(LayoutKind.Sequential, Pack = 1)]
00036         public struct BlendFunction
00037         {
00038             public byte BlendOp;
00039             public byte BlendFlags;
00040             public byte SourceConstantAlpha;
00041             public byte AlphaFormat;
00042         }
00043 
00044         [StructLayout(LayoutKind.Sequential)]
00045         public struct Point
00046         {
00047             public Int32 x;
00048             public Int32 y;
00049 
00050             public Point(Int32 x, Int32 y)
00051             {
00052                 this.x = x;
00053                 this.y = y;
00054             }
00055         }
00056 
00057         public struct MouseInput
00058         {
00059             public int dx;
00060             public int dy;
00061             public uint mouseData;
00062             public uint dwFlags;
00063             public uint time;
00064             public IntPtr dwExtraInfo;
00065         }
00066 
00067         public struct KeybdInput
00068         {
00069             public ushort wVk;
00070             public ushort wScan;
00071             public uint dwFlags;
00072             public uint time;
00073             public IntPtr dwExtraInfo;
00074         }
00075 
00076         public struct HardwareInput
00077         {
00078             public int uMsg;
00079             public short wParamL;
00080             public short wParamH;
00081         }
00082 
00083         [StructLayout(LayoutKind.Explicit)]
00084         public struct MouseKeybdHardwareInput
00085         {
00086             [FieldOffset(0)]
00087             public MouseInput mouse;
00088 
00089             [FieldOffset(0)]
00090             public KeybdInput keyboard;
00091 
00092             [FieldOffset(0)]
00093             public HardwareInput hardware;
00094         }
00095 
00096         public struct LowLevelInput
00097         {
00098             public int type;
00099             public MouseKeybdHardwareInput value;
00100         }
00101 
00102         [StructLayout(LayoutKind.Sequential)]
00103         public struct DeviceBroadcastHandle
00104         {
00105             public int dbch_size;
00106             public int dbch_devicetype;
00107             public int dbch_reserved;
00108             public IntPtr dbch_handle;
00109             public IntPtr dbch_hdevnotify;
00110             public Guid dbch_eventguid;
00111             public long dbch_nameoffset;
00112             public byte dbch_data;
00113             public byte dbch_data1;
00114         }
00115 
00116         [StructLayout(LayoutKind.Sequential)]
00117         public class DeviceInterface
00118         {
00119             public int dbcc_size;
00120             public int dbcc_devicetype;
00121             public int dbcc_reserved;
00122         }
00123 
00124         [StructLayout(LayoutKind.Sequential)]
00125         public struct SP_DEVINFO_DATA
00126         {
00127             public int cbSize;
00128             public Guid classGuid;
00129             public int devInst;
00130             public IntPtr reserved;
00131         }
00132 
00133         [StructLayout(LayoutKind.Sequential)]
00134         public struct SP_DEVICE_INTERFACE_DATA
00135         {
00136             public int cbSize;
00137             public Guid interfaceClassGuid;
00138             public int flags;
00139             public IntPtr reserved;
00140         }
00141 
00142         [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
00143         public struct SP_DEVICE_INTERFACE_DETAIL_DATA
00144         {
00145             public int cbSize;
00146             [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
00147             public string devicePath;
00148         }
00149 
00150         [StructLayout(LayoutKind.Sequential)]
00151         public class DeviceInstallParameters
00152         {
00153             public int cbSize;
00154             public int Flags;
00155             public int FlagsEx;
00156             public IntPtr hwndParent;
00157             public IntPtr InstallMsgHandler;
00158             public IntPtr InstallMsgHandlerContext;
00159             public IntPtr FileQueue;
00160             public IntPtr ClassInstallReserved;
00161             public int Reserved;
00162             [MarshalAs(UnmanagedType.LPTStr)]
00163             public string DriverPath;
00164         }
00165 
00166         [StructLayout(LayoutKind.Sequential)]
00167         public struct ClassInstallHeader
00168         {
00169             public int cbSize;
00170             public int InstallFunction;
00171         }
00172 
00173         [StructLayout(LayoutKind.Sequential)]
00174         public class DevicePropertyChangeParameters
00175         {
00176             public ClassInstallHeader ClassInstallHeader = new ClassInstallHeader();
00177             public int StateChange;
00178             public int Scope;
00179             public int HwProfile;
00180         }
00181 
00182         [StructLayout(LayoutKind.Sequential)]
00183         public struct DiskGeometry
00184         {
00185             public long Cylinders;
00186             public MediaType MediaType;
00187             public int TracksPerCylinder;
00188             public int SectorsPerTrack;
00189             public int BytesPerSector;
00190 
00191             public long DiskSize
00192             {
00193                 get
00194                 {
00195                     return Cylinders * (long)TracksPerCylinder * (long)SectorsPerTrack * (long)BytesPerSector;
00196                 }
00197             }
00198         }
00199 
00200         [StructLayout(LayoutKind.Sequential)]
00201         public struct PartitionInformation
00202         {
00203             public long StartingOffset;
00204             public long PartitionLength;
00205             public int HiddenSectors;
00206             public int PartitionNumber;
00207             public byte PartitionType;
00208             [MarshalAs(UnmanagedType.I1)]
00209             public bool BootIndicator;
00210             [MarshalAs(UnmanagedType.I1)]
00211             public bool RecognizedPartition;
00212             [MarshalAs(UnmanagedType.I1)]
00213             public bool RewritePartition;
00214         }
00215 
00216         public struct IconInfo
00217         {
00218             public bool fIcon;
00219             public int xHotspot;
00220             public int yHotspot;
00221             public IntPtr hbmMask;
00222             public IntPtr hbmColor;
00223         }
00224 
00225         #endregion
00226     }
00227 }
 All Classes Namespaces Files Functions Variables Enumerations Properties Events