Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


How to access to Physical Drive

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Buggy
Advanced Cheater
Reputation: 0

Joined: 04 Jan 2008
Posts: 72
Location: Republic of Korea (South Korea)

PostPosted: Wed Apr 16, 2008 6:40 am    Post subject: How to access to Physical Drive Reply with quote

In Windows NT, it supports the symbolic link called \\.\PhysicalDriveN.

The source under this text is C source that accesses to Physical Drive easily.
This code get first Physical Drive's 0th sector in 4 bytes and prints it in hexademical.

Code:
#include <stdio.h>
#include <windows.h>

int main(int argc, char **argv)
{
   HANDLE hDevice = NULL;
   UCHAR MBRFirstBytes[4] = {0};
   DWORD Dummy = 0;
   hDevice   = CreateFile("\\\\.\\PhysicalDrive0",
                     GENERIC_READ | GENERIC_WRITE,
                     FILE_SHARE_READ | FILE_SHARE_WRITE,
                     NULL,
                     OPEN_EXISTING,
                     0,
                     NULL);
   if(hDevice != INVALID_HANDLE_VALUE)
   {
      printf("First 4-bytes of MBR (PhysicalDrive0, in hex): \n");
      ReadFile(hDevice, MBRFirstBytes, 4, &Dummy, NULL);
      printf("%02X %02X %02X %02X\n", MBRFirstBytes[0], MBRFirstBytes[1], MBRFirstBytes[2], MBRFirstBytes[3]);
      CloseHandle(hDevice);
   }
   return 0;
}</windows.h></stdio.h>

_________________

[img]
<a><img></a>[/img]
iroo sooo hooooot
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Wed Apr 16, 2008 10:44 am    Post subject: Reply with quote

Code:
}</windows.h></stdio.h>


Lol not sure why you have that in there, but C/C++ isn't like HTML Razz

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Wed Apr 16, 2008 12:11 pm    Post subject: Reply with quote

Wiccaan wrote:
Code:
}</windows.h></stdio.h>


Lol not sure why you have that in there, but C/C++ isn't like HTML Razz


Haha, that's what I was wondering. I even googles it to make sure it wasn't something i'd missed.
Back to top
View user's profile Send private message MSN Messenger
--Pillboi--
Grandmaster Cheater Supreme
Reputation: 0

Joined: 06 Mar 2007
Posts: 1383
Location: I don't understand the question. Is this a 1 to 10 thing?

PostPosted: Wed Apr 16, 2008 12:18 pm    Post subject: Reply with quote

I've seen that before somewhere, can't remember where though. Maybe another one of his programs? Laughing
Also, give credits: http://vbdream.tistory.com/category/Win32%20API

_________________

Enter darkness, leave the light, Here be nightmare, here be fright...
Earth and Water, Fire and Air. Prepare to meet a creature rare.
Enter now if you dare, Enter now the dragon's lair.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites