Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Drive Volume using TFilestream

Status
Not open for further replies.

topcat01

Programmer
Jul 10, 2003
83
GB
I remember a few years back on a Delphi Tips website (can't remember which) - some example code that allowed you to open a disk volume using filestream - the volume would be treated a file.

Does anybody on the list have that code or name of the website? It was literally three/four lines of code. A long shot I know!

Thanks

 
I have remembered the code mentioned above:

Code:
var
  TS : TFilestream;
begin
  TS := TFileStream.Create('\\.\PHYSICALDRIVE0', fmOpenRead or fmShareDenyNone);
  Memo2.Lines.Add('Size: '+inttostr(TS.Size));
  TS.Free;


The only problem with this code is that the size returns 4GB (i'm running on an 80GB) - TS.Size should return int64, can anynody explain this?

I am running on D6 Pro.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top