archive-com.com » COM » E » EFG2.COM

Total: 878

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".

  • sample code i ll really appreciate it Here are some sample functions that show how to make IOCTL codes from a Win32 application Actually using these functions to format tracks etc is left as an exercise for the reader You need to have detailed knowledge of all of the low level details of how disks work before you can successfully use these functions There is plenty of information available in books and downloadable from the Internet to get you started type TDiocRegisters record EBX EDX ECX EAX EDI ESI Flags DWORD end TVWin32CtlCode ccNone ccVWin32IntIoctl ccVWin32Int26 ccVWin32Int25 ccVWin32Int13 TBiosParamBlock packed record BytesPerSector Word SectorsPerCluster Byte ReservedSectors Word NumFats Byte NumRootEntries Word NumSectors Word MediaID Byte SectorsPerFat Word SectorsPerTrack Word NumHeads Word HiddenSectors Word Dummy1 Word TotalSectors LongInt Dummy2 array 0 5 of Byte end TDeviceParamBlock packed record Special Byte DeviceType Byte DeviceAttr Word NumCylinders Word MediaType Byte BiosParamBlock TBiosParamBlock end TFormatParamBlock packed record Reserved Byte Head Word Cylinder Word end function VWin32 CtlCode TVWin32CtlCode var Regs TDiocRegisters Boolean var hDevice THandle Count DWORD begin hDevice CreateFile VWIN32 0 0 nil 0 FILE FLAG DELETE ON CLOSE 0 Result DeviceIoControl hDevice Ord CtlCode Regs SizeOf Regs Regs SizeOf Regs Count nil

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/0128c.txt (2016-02-14)
    Open archived version from archive



  • functions reg EAX DWord IOCTL reg EDI DWord reg ESI DWord reg Flg DWord carry flag end lock unlock param PPARAMBLOCK PARAMBLOCK PARAMBLOCK packed record bOperation Byte bNumLocks Byte end var Form1 TForm1 Reg DIOC REGISTERS Prm PARAMBLOCK LockTable array 1 26 of boolean implementation R DFM procedure TForm1 ComboBox1DrawItem Control TWinControl Index Integer Rect TRect State TOwnerDrawState var BitMap TBitMap BMPWidth SmallInt OldColor TColor begin with Control as TComboBox Canvas do begin FillRect Rect BMPWidth 16 BitMap TBitMap Items Objects Index if Bitmap 1 then ComboBox1 ItemIndex 1 else begin MessageDlg This Computer does not 13 have any removable media mtError mbOk 0 Application Terminate end end function GetHandle var hDevice THandle Boolean begin ZeroMemory prm sizeof prm ZeroMemory reg sizeof reg hDevice CreateFile PChar vwin32 0 0 nil 0 FILE FLAG DELETE ON CLOSE 0 if hDevice INVALID HANDLE VALUE then Result False else Result True end function LockLogicalVolume hVWin32 THandle bDriveNum bLockLevel Byte wPermissions Word Boolean var cb DWord bDeviceCat Byte Pass SmallInt begin device type bDeviceCat 48 for Pass 1 to 2 do begin reg reg EAX 440D reg reg EBX MAKEWORD bDriveNum bLockLevel reg reg ECX MAKEWORD 4A bDeviceCat reg reg EDX wPermissions Result DeviceIoControl hVWin32 VWIN32 DIOC DOS IOCTL reg sizeof reg reg sizeof reg cb nil if Result then Break other device else bDeviceCat 08 end end function UnLockLogicalVolume hVWin32 THandle bDriveNum Byte Boolean var cb DWord bDeviceCat Byte Pass SmallInt begin device type bDeviceCat 48 for Pass 1 to 2 do begin reg reg EAX 440D reg reg EBX bDriveNum reg reg ECX MAKEWORD 6A bDeviceCat Result DeviceIoControl hVWin32 VWIN32 DIOC DOS IOCTL reg sizeof reg reg sizeof reg cb nil if Result then Break other device else bDeviceCat 08 end end procedure Eject nDrive Integer var hDevice THandle fResult Boolean cb

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/2001/0625c.txt (2016-02-14)
    Open archived version from archive


  • String DType Integer DriveString String begin Loop from A Z to determine available drives for i 65 to 90 do begin Format a string to represent the root directory C chr i Call the GetDriveType function which returns an integer value representing one of the types shown in the case statement below DType GetDriveType PChar C Based on the drive type returned format a string to add to the listbox displaying the various drive types case DType of 0 DriveString C The drive type cannot be determined 1 DriveString C The root directory does not exist DRIVE REMOVABLE DriveString C The drive can be removed from the drive DRIVE FIXED DriveString C The disk cannot be removed from the drive DRIVE REMOTE DriveString C The drive is a remote network drive DRIVE CDROM DriveString C The drive is a CD ROM drive DRIVE RAMDISK DriveString C The drive is a RAM disk end Only add drive types that can be determined if not DType 0 or DType 1 then lbDrives Items AddObject DriveString Pointer i end end procedure TMainForm lbDrivesClick Sender TObject var RootPath String Holds the drive root path SectorsPerCluster DWord Sectors per cluster BytesPerSector DWord Bytes per sector NumFreeClusters DWord Number of free clusters TotalClusters DWord Total clusters DriveByte Byte Drive byte value FreeSpace Int64 Free space on drive TotalSpace Int64 Total drive space DriveNum Integer Drive number 1 A 2 B etc begin with lbDrives do begin Convert the ascii value for the drive letter to a valid drive number 1 A 2 B etc by subtracting 64 from the ascii value DriveByte Integer Items Objects ItemIndex 64 First create the root path string RootPath chr Integer Items Objects ItemIndex Call GetDiskFreeSpace to obtain the drive information if GetDiskFreeSpace PChar RootPath SectorsPerCluster BytesPerSector NumFreeClusters TotalClusters then begin

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/2000/0208.txt (2016-02-14)
    Open archived version from archive


  • entering code in the OnChange Event of the DriveComboBox control with no result I used to trap this same error in Visual Basic by using the DriveComboBox s OnChange event handler Please help me with this frustrating error Any help appreciated Nelson Nieves From Peter Below 100113 1101 compuserve com Subject Re DriveComboBox and Error 21 Newsgroups borland public delphi vcl components using Date 1998 02 07 Nelson since the

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1998/0206.txt (2016-02-14)
    Open archived version from archive


  • 140 114 28 May 2001 19 40 48 0700 Path dnews Xref dnews borland public delphi vcl components using 78401 kai the following event handler responds to the drive box change event and handles the IO21 error gracefully procedure TForm1 MydrivecomboboxChange Sender TObject begin try Mydirectorylistbox drive Mydrivecombobox drive except on EInOutError do messagedlg 13 the selected drive or device is not ready 13 mtwarning mbok 0 end end good

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/2001/0528b.txt (2016-02-14)
    Open archived version from archive


  • For Zip drives the type will be dtRemovable and TDriveInfo DiskSize will return a number around 98078 but only if there is a zip disk in the drive otherwise the DiskSize value will be zero Regards Todd Eischeid type TDriveType dtUnknown dtDoesNotExist dtRemovable dtFixed dtNetwork dtCDROM dtRAMDisk type TDriveInfo record DriveLetter string DriveType TDriveType TypeDescrip string DriveSize single size in Kilobytes DriveFreeSpace single free space in Kilobytes end type TDriveInfoArray array of TDriveInfo pass a single character string as the DriveLetter param function DriveType DriveLetter string TDriveType var x DrvType Integer DrvLetter DrvString String begin result dtUnknown DriveLetter DriveLetter get the drive type DrvType GetDriveType pChar DriveLetter set our drive type string accordingly case DrvType of 0 result dtUnknown 1 result dtDoesNotExist DRIVE REMOVABLE result dtRemovable DRIVE FIXED result dtFixed DRIVE REMOTE result dtNetwork DRIVE CDROM result dtCDROM DRIVE RAMDISK result dtRAMDisk end end returns a listing of all drives and types on the system procedure GetAllDriveTypes var DriveInfoArray TDriveInfoArray var x integer begin DriveInfoArray nil SetLength DriveInfoArray 0 25 possible drives a z for x Ord A to Ord Z do begin if not DriveType Chr x dtDoesNotExist then begin SetLength DriveInfoArray Length DriveInfoArray 1 DriveInfoArray Length DriveInfoArray 1 DriveLetter Chr x DriveInfoArray Length DriveInfoArray 1 DriveType DriveType Chr x DriveInfoArray Length DriveInfoArray 1 TypeDescrip DriveTypeToString DriveInfoArray Length DriveInfoArray 1 DriveType DriveInfoArray Length DriveInfoArray 1 DriveSize DiskSize x 64 1024 size in KB DriveInfoArray Length DriveInfoArray 1 DriveFreeSpace DiskFree x 64 1024 size in KB end end end function DriveTypeToString DriveType TDriveType string begin case DriveType of dtUnknown result Unknown Drive Type dtDoesNotExist result Drive Does Not Exist dtRemovable result Removable Drive dtFixed result Fixed Drive dtNetwork result Network Drive dtCDROM result CD ROM Drive dtRAMDisk result RAM Disk Drive end end Returns true if the drive is ready

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/2002/0417.txt (2016-02-14)
    Open archived version from archive


  • drive resides on the local machine i now use Get ExtDPB i ve cut out a bit of my own code which should do what you want on FAT32 drives as you will see i m only interested in the cluster size returned by this function call Cluster Size BytesPerSector SectorsPerCluster type DeviceIoControl registers structure TDevIoCtl Registers Record Reg EBX DWord Reg EDX DWord Reg ECX DWord Reg EAX DWord Reg EDI DWord Reg ESI DWord Reg Flags DWord end the following structure def thanks to Geir Wikran kran online no TExtDPB packed record Extended Drive Parameter Block for FAT32 DriveNumber Byte Drive number 0 A 1 B and so UnitNumber Byte Drive unit number on device SectorSize Word Size of each sector in ClusterMask Byte Number of sectors per cluster minus ClusterShift Byte Number of sectors per cluster as power of 2 FirstFAT Word First sector for the File Allocation Table FATCount Byte Number of FATs on the RootEntries Word Number of entries in root y FirstSector Word First sector of the first MaxCluster Word Number of clusters on drive plus Field is undefined for FAT32 FATSize Word Number of sectors occupied by each Zero indicates a FAT32 Use ExtFATSize for FAT32 DirSector Word First sector for the root y Field is undefined for FAT32 Reserved2 DWord MediaID Byte Media descriptor for the Reserved Byte Reserved3 DWord NextFree Word Most recently allocated cluster Cluster at which to start search for free ters ExtFreeCount DWord Number of free clusters on the FFFFFFFF if the number is ExtFlags Word Flags describing the bits 0 3 0 based number of active bits 4 6 bit 7 FAT mirroring enabled if bit cleared bits 8 15 ExtFSInfoSec Word Sector containing information about the file system in TBifFATBootFSInfo ure This field is set to

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/0612a.txt (2016-02-14)
    Open archived version from archive


  • is A or B floppy disk begin turn off errors OldErrorMode SetErrorMode SEM FAILCRITICALERRORS Result not DiskSize Drive 1 turn on errors SetErrorMode OldErrorMode end if end FloppyDriveHasDisk Where drive is the index of you drive A 1 B 2 Original Message From Stephan Marais mailto fmarais idt net Posted At 20 April 1999 01 53 Posted To writing Conversation Check for Disk and format if exists Subject Re Check

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/0420c.txt (2016-02-14)
    Open archived version from archive



  •