Esempio n. 1
0
        public unsafe void ReadSector(Int64 sector, ulong count, IntPtr buffer)
        {
            uint n = 0;

            Win32API.OVERLAPPED ov = new Win32API.OVERLAPPED();
            UInt64 q = (UInt64)sector * bootb.BytesPerSector;

            ov.OffsetHigh = (uint)(q & 0xffffffff00000000);
            ov.Offset     = (uint)(q & 0x00000000ffffffff);
            Win32API.ReadFile(hVolume, buffer, (uint)count * bootb.BytesPerSector, ref n, ref ov);

            //System.Threading.NativeOverlapped ov = new System.Threading.NativeOverlapped();
            //ov.OffsetHigh = (int)(q & 0x0000ffff);
            //ov.OffsetLow = (int)(q & 0xffff0000);
            //IntPtr pov = Marshal.AllocHGlobal(Marshal.SizeOf(ov));
            //Win32API.ZeroMemory(pov, Marshal.SizeOf(ov));
            //Marshal.StructureToPtr(Marshal.SizeOf(ov), pov, true);
            //Win32API.ReadFile(hVolume, buffer, (uint)count * bootb.BytesPerSector, ref n, pov);


            //System.Threading.NativeOverlapped ov = new System.Threading.NativeOverlapped();
            //UInt64 q = (UInt64)sector * bootb.BytesPerSector;
            //ov.OffsetHigh = (int)(q & 0xffffffff00000000);
            //ov.OffsetLow = (int)(q & 0x00000000ffffffff);
            //Win32API.ReadFile(hVolume, buffer, (uint)count * bootb.BytesPerSector, IntPtr.Zero, &ov);
        }
Esempio n. 2
0
        public unsafe void ReadSector(Int64 sector, ulong count, IntPtr buffer)
        {
            uint n = 0;

            Win32API.OVERLAPPED ov = new Win32API.OVERLAPPED();
            UInt64 q = (UInt64)sector * bootb.BytesPerSector;
            ov.OffsetHigh = (uint)(q & 0xffffffff00000000);
            ov.Offset = (uint)(q & 0x00000000ffffffff);
            Win32API.ReadFile(hVolume, buffer, (uint)count * bootb.BytesPerSector, ref n, ref ov);

            //System.Threading.NativeOverlapped ov = new System.Threading.NativeOverlapped();
            //ov.OffsetHigh = (int)(q & 0x0000ffff);
            //ov.OffsetLow = (int)(q & 0xffff0000);
            //IntPtr pov = Marshal.AllocHGlobal(Marshal.SizeOf(ov));
            //Win32API.ZeroMemory(pov, Marshal.SizeOf(ov));
            //Marshal.StructureToPtr(Marshal.SizeOf(ov), pov, true);
            //Win32API.ReadFile(hVolume, buffer, (uint)count * bootb.BytesPerSector, ref n, pov);

            //System.Threading.NativeOverlapped ov = new System.Threading.NativeOverlapped();
            //UInt64 q = (UInt64)sector * bootb.BytesPerSector;
            //ov.OffsetHigh = (int)(q & 0xffffffff00000000);
            //ov.OffsetLow = (int)(q & 0x00000000ffffffff);
            //Win32API.ReadFile(hVolume, buffer, (uint)count * bootb.BytesPerSector, IntPtr.Zero, &ov);
        }