saeed-kh
چهارشنبه 09 آذر 1390, 00:51 صبح
سلام و نخسته.
میخوام 1024 بایت اول درایو رو بخونم.این کد قبلا رو ویندوز7 x64 م جواب میداد اما اینجا تو ویندوز7 x86 جدیدم تو خط آخر Exception میده!!!
int nread = 0;
uint handle;
byte[] buff = new byte[1024];
string driveRoot = string.Concat("\\\\.\\", driveLetter);
uint hRoot =CreateFile(driveRoot,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
IntPtr.Zero,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
IntPtr.Zero);
if (hRoot != -1)
handle = ReadFile(hRoot, buff, 1024, nread, new System.Threading.NativeOverlapped());
AccessViolationException was unhadled.
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
میخوام 1024 بایت اول درایو رو بخونم.این کد قبلا رو ویندوز7 x64 م جواب میداد اما اینجا تو ویندوز7 x86 جدیدم تو خط آخر Exception میده!!!
int nread = 0;
uint handle;
byte[] buff = new byte[1024];
string driveRoot = string.Concat("\\\\.\\", driveLetter);
uint hRoot =CreateFile(driveRoot,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
IntPtr.Zero,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
IntPtr.Zero);
if (hRoot != -1)
handle = ReadFile(hRoot, buff, 1024, nread, new System.Threading.NativeOverlapped());
AccessViolationException was unhadled.
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.