johnnyex
asked on
get size of pendrive physical
I need routine/function delphi which will check disk size physical.
I not mean volume size but physical.
There is Volume size dependable on formatting options.
And there is physical disk size not matter if drive 8gb will be formatted to 2gb.
I need to get know real drive size in bytes.
Similar info present program called USB image tool.
Disksize() function is not able to get this information sice it checks for volume logical size only.
Please advice
I not mean volume size but physical.
There is Volume size dependable on formatting options.
And there is physical disk size not matter if drive 8gb will be formatted to 2gb.
I need to get know real drive size in bytes.
Similar info present program called USB image tool.
Disksize() function is not able to get this information sice it checks for volume logical size only.
Please advice
ASKER
thanks Ferruccio68 but Sth is wrong in this function or USB image tool app is buggy...
http://www.alexpage.de/usb-image-tool/
just compare any usb drive section DEVICE with your code provided, always slightly different :(
http://www.alexpage.de/usb-image-tool/
just compare any usb drive section DEVICE with your code provided, always slightly different :(
ASKER
just download and check yourself: http://www.alexpage.de/usb-image-tool/download/
if you think this tool is buggy then and you think your function is ok then would be good to know this fact as well
I feel sth wrong is is provided code rather
if you think this tool is buggy then and you think your function is ok then would be good to know this fact as well
I feel sth wrong is is provided code rather
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
cannot compile second: [dcc32 Error] Unit1.pas(30): E2029 Expression expected but 'PACKED' found
so what result give first code if second is "raw size availiable for windows" ?
so what result give first code if second is "raw size availiable for windows" ?
ASKER
ok compiled but getting:
Drive Geometry cannot be retrieved!
can you provide full working code and explain difference between first method you posted and second ?
Drive Geometry cannot be retrieved!
can you provide full working code and explain difference between first method you posted and second ?
ASKER
Sorry buddy, my fault while modyfing code, compiled and worked perfect.
Still I'm just curious about difference between fisrt time provided code and second " raw size available to windows"
THANKS
Still I'm just curious about difference between fisrt time provided code and second " raw size available to windows"
THANKS
Ferruccio68 gives you code to get physical "geometry" of usb device. Multiplying geometry components you will get theoretical maximum size, but few bytes usb needs for itself.
Go through:
https://en.wikipedia.org/w iki/Univer sal_Serial _Bus
...and especially part Screwed-up formatting on:
http://wiki.laptop.org/go/ How_to_Dam age_a_FLAS H_Storage_ Device
Go through:
https://en.wikipedia.org/w
...and especially part Screwed-up formatting on:
http://wiki.laptop.org/go/
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363972%28v=vs.85%29.aspx
It get the disk structure giving the drive letters and returns the value calculated by
Cylinders * TracksPerCylinder * SectorsPerTrack * BytesPerSector
Of course it's the physical value, not just the volume size
Drop a TButton and a TDriveComboBox on a new form, then paste this code (assign the Tbutton Onclick)
Open in new window