|
-
May 5th, 2010, 09:51 AM
#1
How to direct access physical drive on Vista
Hi, all, I got that CreateFile with a file name \\.\PhysicalDriveX can open a handle for direct accessing to appropriate disk, but as it is said in MSDN, it doesn't work for Vista. When I try to do it on Vista, it always returns 'Access deny'. So could anybody knows there is someway to do the job on Vista?
Thank you in advance.
Stone
-
May 6th, 2010, 08:51 AM
#2
Re: How to direct access physical drive on Vista
Still waiting for response, could anybody give me a hand?
Thanks
Stone
-
May 6th, 2010, 09:44 AM
#3
Re: How to direct access physical drive on Vista
Never touched Vista; but for me, under Win7, it requires that the app run as administrator.
-
May 6th, 2010, 10:39 AM
#4
Re: How to direct access physical drive on Vista
Never touched Vista; but for me, under Win7, it requires that the app run as administrator.
Yes, on Windows Vista and higher, your process needs to be running as Administrator (Elevated user). With elevation your process gains higher integrity, and thus can perform administrative tasks.
-
May 6th, 2010, 10:58 AM
#5
Re: How to direct access physical drive on Vista
I am also running as administrator too, but I can only read from a dist, when writing to another disk, it also returns 'Access is denied'. I found that it requires a flag named SL_FORCE_DIRECT_WRITE to the write request, but in that case, it requires something running in Ring0, it will make the stuff more complicated.
Stone
-
May 6th, 2010, 11:03 AM
#6
Re: How to direct access physical drive on Vista
Well, first thing first - don't attempt to do it on hard disk/drive which is important for you. It will make everything unreadable.
CPU have 4 rings, ring 0 through ring 3. The Kernel runs on ring 0, the user applications run on ring 3. As of now (at least in Windows), the other two rings are not used.
Only Kernel mode programs (i.e. Device Drivers), are allowed to execute something at level 0, not user programs.
Long way to go. But just understand that the applications are User-Mode programs, which cannot execute Kernel mode instructions.
Read about Device Drivers/Kernel-mode to understand more (if you can!!)
-
May 6th, 2010, 05:59 PM
#7
Re: How to direct access physical drive on Vista
I should hope your program can't write directly to a drive so easily! Reading isn't that big of a deal, but bypassing the filesystem and writing data would be highly destructive! Why on earth do you need to do this?
This is the type of thing that will require a driver to accomplish and should be done carefully, otherwise you'll nuke your operating system.
CPU have 4 rings, ring 0 through ring 3.
Most operating systems only make use of 0 and 3 because x86 is one of the few architectures that has more than 2 ring levels. It's done for comparability.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|