IOCTL_DISK_GET_DRIVE_GEOMETRY equ	 00070000h



why make IOCTL_DISK_GET_DRIVE_GEOMETRY equ 00070000h?What does the hex number 00070000h mean?

I google it and there are something like this above in VB
'//file system 
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As Long, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function ReadFile Lib "kernel32" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, ByVal lpOverlapped As Long) As Long '//declare has changed
Private Declare Function WriteFile Lib "kernel32" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long, ByVal lpOverlapped As Long) As Long '//declare has changed
Private Declare Function SetFilePointer Lib "kernel32" (ByVal hFile As Long, ByVal lDistanceToMove As Long, lpDistanceToMoveHigh As Long, ByVal dwMoveMethod As Long) As Long

Private Const GENERIC_READ = &H80000000
Private Const GENERIC_WRITE = &H40000000

Private Const FILE_SHARE_READ = &H1
Private Const FILE_SHARE_WRITE = &H2
Private Const OPEN_EXISTING = 3

Private Const INVALID_HANDLE_VALUE = -1

'//file seek
Private Const FILE_BEGIN = 0
Private Const FILE_CURRENT = 1
Private Const FILE_END = 2

Private Const ERROR_SUCCESS = 0&

'//device io control
Private Declare Function DeviceIoControl Lib "kernel32" (ByVal hDevice As Long, ByVal dwIoControlCode As Long, lpInBuffer As Any, ByVal nInBufferSize As Long, lpOutBuffer As Any, ByVal nOutBufferSize As Long, lpBytesReturned As Long, ByVal lpOverlapped As Long) As Long

Private Const IOCTL_DISK_GET_DRIVE_GEOMETRY As Long = &H70000 '458752
Private Const IOCTL_STORAGE_GET_MEDIA_TYPES_EX As Long = &H2D0C04
Private Const IOCTL_DISK_FORMAT_TRACKS As Long = &H7C018
Private Const FSCTL_LOCK_VOLUME As Long = &H90018
Private Const FSCTL_UNLOCK_VOLUME As Long = &H9001C
Private Const FSCTL_DISMOUNT_VOLUME As Long = &H90020
Private Const FSCTL_GET_VOLUME_BITMAP = &H9006F

'//type
Private Type LARGE_INTEGER
lowpart As Long
highpart As Long
End Type

Private Enum MEDIA_TYPE
Unknown
F5_1Pt2_512
F3_1Pt44_512
F3_2Pt88_512
F3_20Pt8_512
F3_720_512
F5_360_512
F5_320_512
F5_320_1024
F5_180_512
F5_160_512
RemovableMedia
FixedMedia
End Enum

Private Type DISK_GEOMETRY
Cylinders As LARGE_INTEGER
MediaType As MEDIA_TYPE
TracksPerCylinder As Long
SectorsPerTrack As Long
BytesPerSector As Long
End Type

'//private vars
Private hDisk As Long 'disk handle
Private lpGeometry As DISK_GEOMETRY 'disk info
Private lBufferSize As Long 'the buffer size of read/write


Who can tell me what do the numbers mean? Where can find the informtion(tutorial or website) about this?
thx :)
Posted on 2005-12-13 23:51:17 by Eric4ever
why make IOCTL_DISK_GET_DRIVE_GEOMETRY equ 00070000h?What does the hex number 00070000h mean?


700000h means  IOCTL_DISK_GET_DRIVE_GEOMETRY to the device driver for PhysicalDrive0, and thats where it ends. 700000h could be a handle to a GDI object or a constant for a call to WinSock or whatever... It doesn't generally concern you (the Windows programmer) what they mean, unless you're interested in reverse engineering the functions you are calling (and you probably are not). We assign labels to constants to make our lives MUCH simpler, rather than trying to remember that  700000h means IOCTL_DISK_GET_DRIVE_GEOMETRY in a call to DeviceIoControl directed at the object PhysicalDrive0.
Posted on 2005-12-15 21:17:59 by The Dude of Dudes
IOCTL is a 32-bit value that is separated into some fileds like:

bits 31-16 - Device type
bits 15-14 - Access (0 for any access, 1 for read access, 2 for write access)
bits 13-2 - Function (the very what the specified device has to do)
bits 1-0 - I\O method (0 for buffered,1 and 2 for direct I\O,3 for none)

With best regards :D
Posted on 2005-12-16 07:41:21 by k3Eahn