Access harddisk
-
Hi! Is there anyway to access the harddisk in byte mode? I mean I want to get the bytes and modify them or delete them for real... I found some examples for the assembly language... well is it possible with c++ without mfc? Thank you very much for your answers in advance! Well... I am a beginner ...
-
Hi! Is there anyway to access the harddisk in byte mode? I mean I want to get the bytes and modify them or delete them for real... I found some examples for the assembly language... well is it possible with c++ without mfc? Thank you very much for your answers in advance! Well... I am a beginner ...
You can mix your assembly codes into your C++ codes like
ULONG ulReturn = 0x00000000;
__asm
{
mov eax, ulReturn
................mov ulReturn, eax
}
Don't you like C++ for this. :) Sonork 100.41263:Anthony_Yio
-
You can mix your assembly codes into your C++ codes like
ULONG ulReturn = 0x00000000;
__asm
{
mov eax, ulReturn
................mov ulReturn, eax
}
Don't you like C++ for this. :) Sonork 100.41263:Anthony_Yio
-
Hi! Is there anyway to access the harddisk in byte mode? I mean I want to get the bytes and modify them or delete them for real... I found some examples for the assembly language... well is it possible with c++ without mfc? Thank you very much for your answers in advance! Well... I am a beginner ...
Accessing the disk directly is not possible on NT-based machines. Goggle for HAL to see why/how it keeps non ring-0 applications from accessing the hardware. You can create a driver to do this, however, but that is not a trivial task.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
-
Accessing the disk directly is not possible on NT-based machines. Goggle for HAL to see why/how it keeps non ring-0 applications from accessing the hardware. You can create a driver to do this, however, but that is not a trivial task.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
"directly" is ambigious, i think. Under NT, it is much easier to access a hard disk than it is in Win 9x. All you need to do is call the CreateFile() function with a "filename" of \\.\PHYSICALDRIVE0 for the first physical hdd and so on, or for logical drives: \\.\C: You can read (not write), data using the ReadFile() function. Writing would need a device driver. Under 9x, you cannot use this method. You have to revrt to using the INT13 or INT13 Extended functions for the purpose. And that means writing a 16-bit VxD in VC++ 2.x or Borland C++. Bikram Singh
-
"directly" is ambigious, i think. Under NT, it is much easier to access a hard disk than it is in Win 9x. All you need to do is call the CreateFile() function with a "filename" of \\.\PHYSICALDRIVE0 for the first physical hdd and so on, or for logical drives: \\.\C: You can read (not write), data using the ReadFile() function. Writing would need a device driver. Under 9x, you cannot use this method. You have to revrt to using the INT13 or INT13 Extended functions for the purpose. And that means writing a 16-bit VxD in VC++ 2.x or Borland C++. Bikram Singh
hDriver = CreateFile("\\\\.\\physicaldrive0", ...)
uses a generic symbolic link to get access to the driver that represents the first physical drive. bikram singh wrote: You can read ... data using the ReadFile() function. Certainly you can.ReadFile(hDriver, &data, 512, &dwRead, NULL)
will work just fine for reading the MBR of the first physical drive. Access toPhysicalDrivexx
devices is restricted to administrator-level accounts. To bypass HAL (e.g., virus scanner) would require a device driver.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
-
hDriver = CreateFile("\\\\.\\physicaldrive0", ...)
uses a generic symbolic link to get access to the driver that represents the first physical drive. bikram singh wrote: You can read ... data using the ReadFile() function. Certainly you can.ReadFile(hDriver, &data, 512, &dwRead, NULL)
will work just fine for reading the MBR of the first physical drive. Access toPhysicalDrivexx
devices is restricted to administrator-level accounts. To bypass HAL (e.g., virus scanner) would require a device driver.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
DavidCrow wrote: Certainly you can. ReadFile(hDriver, &data, 512, &dwRead, NULL) will work just fine for reading the MBR of the first physical drive. It works for for any sector on the hard disk. Except the ones the hdd controller has marked as "bad" in it's cmos memory. DavidCrow wrote: Access to PhysicalDrivexx devices is restricted to administrator-level accounts. To bypass HAL (e.g., virus scanner) would require a device driver. Thats true. Win some, lose some! ps. have you worked on a FSFD? When I made mine, I was just so totally confused! The IFS DDK I dont have access to, so it was a really jittery experience! Bikram Singh
-
DavidCrow wrote: Certainly you can. ReadFile(hDriver, &data, 512, &dwRead, NULL) will work just fine for reading the MBR of the first physical drive. It works for for any sector on the hard disk. Except the ones the hdd controller has marked as "bad" in it's cmos memory. DavidCrow wrote: Access to PhysicalDrivexx devices is restricted to administrator-level accounts. To bypass HAL (e.g., virus scanner) would require a device driver. Thats true. Win some, lose some! ps. have you worked on a FSFD? When I made mine, I was just so totally confused! The IFS DDK I dont have access to, so it was a really jittery experience! Bikram Singh
bikram singh wrote: It works for for any sector on the hard disk. Except the ones the hdd controller has marked as "bad" in it's cmos memory. My bad. I read your earlier post as "You can not read..." which is why I was providing an example that showed otherwise. I'll need to not be so quick with my trigger finger! :-O
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen