🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #6266

Re: How to read Bootsector, FAT, and so on

#6266
From: Eudy Silva
Date: Tue, 31 May 2005 16:09
33 lines
2306 bytes
My understanding is that if you call CreateFile with \\.\U:
you'll get a handle to the partition U: (a logical drive),
like you're doing, and youl'll be limited to sectors inside
of that partition.

If you want to access the physyical drive (that means the
whole drive - Master Boot Record, etc) you have to call
CreateFile with \\.\PHYSICALDRIVEx, as stated in Builder's
WinSDK Online help:

------------------------------------------------------------------
The lpFileName string should be \\.\x: to open a floppy drive x or
a partition x on a hard disk. For example:
String	Meaning
\\.\A:	Obtains a handle to drive A on the user's computer.
\\.\C:	Obtains a handle to drive C on the user's computer.

The lpFileName string should be of the form \\.\PHYSICALDRIVEx to
open the hard disk x. Hard disk numbers start at zero. For example:

String	Meaning
\\.\PHYSICALDRIVE2  Obtains a handle to the third physical drive
                     on the user's computer.
------------------------------------------------------------------

I believe you must find a way of discovering which physical drive
your pen drive (or similar) is. Sorry, that's AFAIK, for now.
Search also for "Direct Drive Access Under Win32"  in Builder's
WinSDK Online help.

Regards

Eudy
Technical Details
Message-ID: <429c8bb1$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <429c0001$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ee3f5b64d08a5e0b
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 31 May 2005 13:09:01 -0300
From: Eudy Silva <eudy@server.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: How to read Bootsector, FAT, and so on
References: <429c0001$1@newsgroups.borland.com>
In-Reply-To: <429c0001$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 200.152.8.113
Message-ID: <429c8bb1$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1117555633 200.152.8.113 (31 May 2005 09:07:13 -0700)
Lines: 33
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail