Home
Tutorials
Code Snippets
Code Samples
Downloads
Links

The Blog
Our Projects
About
Contact

::Add RageStorm to Favorites!::

The Blog | Our Projects | Guest Book | About | Contact

 
Code Snippet - Raw Sectors Access
Author:Arkon
Category:Win32API
File Size:584 Bytes
Uploaded at:27-Nov-02 08:32:05 pm
Description:
  Reading/Writing raw sectors under WinNt.
  
#include <windows.h>
#include <winioctl.h>

int main()
{
 HANDLE hDevice; 
 char buffer[512];
 memset(buffer, 'c', 512);
 DWORD bytesread ;

 hDevice = CreateFile("\\\\.\\a:", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL);
 if (!hDevice) {
   MessageBox (0, "open", "Failed !", 0);
   return NULL;
 }
    
   
 SetFilePointer(hDevice, 0, NULL, FILE_BEGIN);
   
 if (!ReadFile(hDevice, buffer, 512, &bytesread, NULL)) {
   MessageBox (0, "read!", "Failed !", 0);
   return NULL;
 }
 CloseHandle(hDevice); 

}
User Contributed Comments(None)
NOTE:
Comments that will hurt anyone in any way will be deleted.
Don't ask for features, advertise or curse.
If you want to leave a message to the author use the contacts,
if you have any question in relation to your comments please use the forum.
Comments which violate any of these requests will be deleted without further
notice. Use the comment system decently.

Post your comment:
Name:
email:
Comment:
::Top 5 Tutorials::
Embedded Python[117060]
2D Rotated Rectangles Collision Detection[88987]
Keyboard Hook[77325]
UDP[65879]
HTTP Proxy[41217]

::Top 5 Samples::
2D ColDet Rotated Rectangles[11561]
PS2 Mouse Driver[6959]
Wave Format Player[5792]
Reading FAT12[5620]
CodeGuru[5360]


All rights reserved to RageStorm © 2009