/// <summary> /// <see cref="http://msdn.microsoft.com/en-us/library/windows/desktop/aa365194(v=vs.85).aspx" /> /// </summary> public VOLUME_DISK_EXTENTS VolumeGetVolumeDiskExtents() { // Fetch in increments of 32 bytes, as one extent (the most common case) is one extent pr. volume. byte[] data = DeviceIoControlHelper.InvokeIoControlUnknownSize(Handle, IOControlCode.VolumeGetVolumeDiskExtents, 32); // Build the VOLUME_DISK_EXTENTS structure VOLUME_DISK_EXTENTS res = new VOLUME_DISK_EXTENTS(); res.NumberOfDiskExtents = BitConverter.ToUInt32(data, 0); res.Extents = new DISK_EXTENT[res.NumberOfDiskExtents]; using (UnmanagedMemory dataPtr = new UnmanagedMemory(data)) { // TODO: This code needs to be tested for volumes with more than one extent. for (int i = 0; i < res.NumberOfDiskExtents; i++) { IntPtr currentDataPtr = new IntPtr(dataPtr.Handle.ToInt64() + 8 + i * MarshalHelper.SizeOf<DISK_EXTENT>()); DISK_EXTENT extent = currentDataPtr.ToStructure<DISK_EXTENT>(); res.Extents[i] = extent; } } return res; }
public ComFunctionInfo(ComTypeInfo parent, IntPtr pFuncDesc) : base(parent) { _pFuncDesc = pFuncDesc; _funcDesc = pFuncDesc.ToStructure < System.Runtime.InteropServices.ComTypes.FUNCDESC>(); _comTypeInfo.GetITypeInfo().GetDocumentation(_funcDesc.memid, out _name, out _description, out _helpContext, out _helpFile); if (_description == null) _description = String.Empty; if (_helpFile == null) _helpFile = String.Empty; LoadParameters(); }
/// <summary><see cref="http://msdn.microsoft.com/en-us/library/windows/desktop/aa365171(v=vs.85).aspx"/></summary> public DISK_GEOMETRY_EX DiskGetDriveGeometryEx() { byte[] data = DeviceIoControlHelper.InvokeIoControlUnknownSize(Handle, IOControlCode.DiskGetDriveGeometryEx, 256); DISK_GEOMETRY_EX res; using (UnmanagedMemory mem = new UnmanagedMemory(data)) { res.Geometry = mem.Handle.ToStructure<DISK_GEOMETRY>(); res.DiskSize = BitConverter.ToInt64(data, (int)MarshalHelper.SizeOf<DISK_GEOMETRY>()); IntPtr tmpPtr = new IntPtr(mem.Handle.ToInt64() + MarshalHelper.SizeOf<DISK_GEOMETRY>() + sizeof(long)); res.PartitionInformation = tmpPtr.ToStructure<DISK_PARTITION_INFO>(); tmpPtr = new IntPtr(tmpPtr.ToInt64() + res.PartitionInformation.SizeOfPartitionInfo); res.DiskInt13Info = tmpPtr.ToStructure<DISK_EX_INT13_INFO>(); } return res; }
public ComTypeInfo(ComTypeLibrary comTypeLibrary, ITypeInfo typeInfo, IntPtr pTypeAttr) { _comTypeLibrary = comTypeLibrary; _typeInfo = typeInfo; _pTypeAttr = pTypeAttr; _typeAttr = _pTypeAttr.ToStructure<System.Runtime.InteropServices.ComTypes.TYPEATTR>(); _typeInfo.GetDocumentation(-1, out _name, out _description, out _helpContext, out _helpFile); }