Deviceiocontrol error 998

deviceiocontrol error 998

74:174, Error controlling alert system for CommCell. 35:998, Failed to change Storage Policy for Consistency Points Backups because job [] is. Unable to enumerate user-mode unloaded modules, Win32 error 0n30 Loading NULL)) { printf("DeviceIoControl Error - bytes returned %#x\n". Log(LOG_ERROR, "GetMuxPipeProperties: DeviceIoControl error %d", GetLastError()); 0x0B966D409,0x0CE61E49F,0x5EDEF90E,0x29D9C998,0x0B0D09822.

youtube video

Fix Invalid Access To Memory Location Error In Windows 10/8/7 (2020 Tips) executing jump error l7e file

Large files files are truncated, but you can click here to view the full file

1//Copyright 2009-2010 by Victor Derevyanko, [email protected] 2//http://code.google.com/p/dvsrc/ 3//http://derevyanko.blogspot.com/2009/02/hardware-id-diskid32-delphi.html 4//{$Id: hwid_impl.pas 51 2012-01-15 06:46:35Z [email protected] $} 5 6unit hwid_impl; 7{$DEFINE DEBUG} 8{$DEFINE PRINTING_TO_CONSOLE_ALLOWED} //comment it to disable console output 9 10// diskid32.cpp 11 12 13// for displaying the details of hard drives in a command window 14 15 16// 06/11/00 Lynn McGuire written with many contributions from others, 17// deviceiocontrol error 998 IDE drives only under Windows NT/2K and 9X, 18// maybe SCSI drives later 19// 11/20/03 Lynn McGuire added ReadPhysicalDriveInNTWithZeroRights 20// 10/26/05 Lynn McGuire fix the flipAndCodeBytes function 21// 01/22/08 Lynn McGuire deviceiocontrol error 998 changes from Gonzalo Diethelm, 22// remove media serial number code since does lineage 2 runtime error 23// not work on USB hard drives or thumb drives 24// 01/29/08 Lynn McGuire add ReadPhysicalDriveInNTUsingSmart 25// 05/02/09 Ported from C++ to Delphi by Victor Derevyanko, [email protected] 26// The translation was donated by efaktum (http://www.efaktum.dk). 27// If you find any error please send me bugreport by email. Thanks in advance. 28 29// Original code can be taken here: 30// http://www.winsim.com/diskid32/diskid32.html 31 32//{$Id: hwid_impl.pas 51 2012-01-15 06:46:35Z [email protected] $} 33 34interface 35uses Windows, deviceiocontrol error 998, SysUtils; 36 37type 38//record for storing results (instead of printing on console) 39 tresults_dv = record 40 ControllerType: Integer; //0 - primary, 1 - secondary, 2 - Tertiary, deviceiocontrol error 998, 3 - Quaternary 41 DriveMS: Integer; //0 - master, 1 - slave 42 error writing fstab read-only file system DriveModelNumber: String; 43 DriveSerialNumber: String; 44 DriveControllerRevisionNumber: String; 45 ControllerBufferSizeOnDrive: Int64; 46 DriveType: String; //fixed or removable or unknown 47 DriveSizeBytes: Int64; 48 end; 49 50 tresults_array_dv = array of tresults_dv; 51 52//use one by one all ReadXXX methods to fill global variables HardDriveSerialNumber and HardDriveModelNumber 53//with information about FIRST found HDD 54//returns unique id for this computer 55function getHardDriveComputerID(var Dest: tresults_array_dv): Longint; 56 57//Calling SetPrintDebugInfo(true) will lead to printing additional debug info on console 58//(only if PRINTING_TO_CONSOLE_ALLOWED is defined) 59procedure SetPrintDebugInfo(bOn: Boolean); 60 61function ReadIdeDriveAsScsiDriveInNT(var Dest: tresults_array_dv): Boolean; 62function ReadDrivePortsInWin9X(var Dest: tresults_array_dv): Boolean; //!This code wasn't tested 63function ReadPhysicalDriveInNTWithZeroRights(var Dest: tresults_array_dv): Boolean; 64function ReadPhysicalDriveInNTUsingSmart(var Dest: tresults_array_dv): Boolean; 65function ReadPhysicalDriveInNTWithAdminRights(var Dest: tresults_array_dv): Boolean; 66 67{$IFDEF DEBUG} deviceiocontrol error 998 68//to ensure that sizes of declared structurs are correct (same as in original c++-sources) 69procedure test; 70{$ENDIF} 71 72implementation 73uses winioctl, deviceiocontrol error 998, crtdll_wrapper; 74var 75 HardDriveSerialNumber: array [0.1023] of AnsiChar; 76 HardDriveModelNumber: array [0.1023] of AnsiChar; 77 78//readonly values 79 deviceiocontrol error 998 SMART_GET_VERSION: Integer; 80 SMART_SEND_DRIVE_COMMAND: Integer; 81 SMART_RCV_DRIVE_DATA: Integer; 82 83 PRINT_DEBUG: Boolean; 84 85const 86 TITLE = 'DiskId32'; 87 88 IDENTIFY_BUFFER_SIZE = 512; 89 90 // IOCTL commands 91 DFP_GET_VERSION = $00074080; 92 DFP_SEND_DRIVE_COMMAND = $0007c084; 93 DFP_RECEIVE_DRIVE_DATA = $0007c088; 94 95 FILE_DEVICE_SCSI = $0000001b; 96 IOCTL_SCSI_MINIPORT_IDENTIFY = ((FILE_DEVICE_SCSI shl 16) + $0501); 97 IOCTL_SCSI_MINIPORT = $0004D008; // see NTDDSCSI.H for definition 98 99type 100{$Align 1} //#pragma pack(1) // Required to ensure correct PhysicalDrive IOCTL structure setup 101 error for saving db5 GETVERSIONINPARAMS = record 102 bVersion: Byte; error 1723 java minecraft // Binary driver version. hdio_drive_cmd failed input/output error ubuntu bRevision: Byte; // Binary driver revision, deviceiocontrol error 998. 104 bReserved: Byte; // Not used. 105 bIDEDeviceMap: Byte; // Bit map of IDE devices, deviceiocontrol error 998. 106 fCapabilities: Cardinal; // Bit mask of driver capabilities, deviceiocontrol error 998. 107 dwReserved: array [0.3] of Cardinal; // For future use. 108 end; 109{$Align On} //default value 110 PGETVERSIONINPARAMS = ^GETVERSIONINPARAMS; 111 LPGETVERSIONINPARAMS = ^GETVERSIONINPARAMS; 112 113// GETVERSIONOUTPARAMS sshd error key_read uudecode the data returned from the 114// Get Driver Version function. 115 GETVERSIONOUTPARAMS = record 116 bVersion: Byte;// Binary driver version. 117 bRevision: Byte;// Binary driver revision. 118 bReserved: Byte;// Not used. 119 bIDEDeviceMap: Byte;// Bit map of IDE devices. 120 fCapabilities: Longword;// Bit mask of driver capabilities. 121 dwReserved: array [0.3] of Longword;// For future use. 122 end; 123 PGETVERSIONOUTPARAMS = ^GETVERSIONOUTPARAMS; 124 LPGETVERSIONOUTPARAMS = ^GETVERSIONOUTPARAMS; 125 126const 127 // Bits returned in the fCapabilities member of GETVERSIONOUTPARAMS 128 CAP_IDE_ID_FUNCTION = 1; // ATA ID command supported 129 CAP_IDE_ATAPI_ID = 2; // ATAPI ID command supported 130 CAP_IDE_EXECUTE_SMART_FUNCTION = 4; // SMART commannds supported 131 132type 133 // IDE registers 134 IDEREGS = record 135 bFeaturesReg: Byte;// Used for specifying SMART "commands", deviceiocontrol error 998. 136 bSectorCountReg: Byte;// IDE sector count register 137 bSectorNumberReg: Byte;// IDE sector number register 138 bCylLowReg: Byte;// IDE low order cylinder value 139 bCylHighReg: Byte;// IDE high order cylinder value 140 bDriveHeadReg: Byte;// IDE drive/head register 141 bCommandReg: Byte;// Actual IDE command. 142 bReserved: Byte;// reserved for future use. Must be zero. 143 end; 144 PIDEREGS = ^IDEREGS; 145 LPIDEREGS = ^IDEREGS; 146 147 148// SENDCMDINPARAMS contains the input parameters for the 149// deviceiocontrol error 998 Send Command to Drive function. 150{$ALIGN 1} 151 SENDCMDINPARAMS = record 152 cBufferSize: Longword;// Buffer size in bytes 153 irDriveRegs: IDEREGS; // Structure with drive register values. 154 bDriveNumber: Byte;// Physical drive number to send 155 // command to (0,1,2,3). 156 bReserved: array[0.2] of Byte;// Reserved for future expansion. 157 dwReserved: array [0.3] of Longword;// For future use. 158 bBuffer: array [0.0] of Byte;// Input buffer. run-time error 429 vba excel //!TODO: this is array of single element 159 end; 160{$ALIGN on} 161 PSENDCMDINPARAMS = ^SENDCMDINPARAMS; 162 LPSENDCMDINPARAMS = ^SENDCMDINPARAMS; 163 164 165 // Valid values for the bCommandReg member of IDEREGS, deviceiocontrol error 998. 166const 167 deviceiocontrol error 998 IDE_ATAPI_IDENTIFY = $A1; // Returns ID sector for ATAPI. 168 IDE_ATA_IDENTIFY = $EC; // Returns ID sector for ATA, deviceiocontrol error 998. 169 170{$ALIGN 1} 171type 172 // Status returned from driver 173 DRIVERSTATUS = record 174 bDriverError: Byte;// Error code from driver, deviceiocontrol error 998, or 0 if no error. 175 bIDEStatus: Byte;// Contents of IDE Error register. 176 // Only valid when bDriverError is SMART_IDE_ERROR. 177 bReserved: array [0.1] of 14001 error aion Reserved for future expansion. 178 dwReserved: array [0.1] of Longword;// Reserved for future expansion. 179 end; 180{$ALIGN on} 181 PDRIVERSTATUS = ^DRIVERSTATUS; 182 LPDRIVERSTATUS = ^DRIVERSTATUS; 183 184 // Structure returned by PhysicalDrive IOCTL for several commands 185{$ALIGN 1} 186 SENDCMDOUTPARAMS = record 187 cBufferSize: Longword;// Size of bBuffer in bytes 188 DriverStatus: DRIVERSTATUS;// Driver status structure. 189 bBuffer: array [0.0] of Byte;// Buffer of arbitrary length in which to store the data read from the fmod error in fsound // drive. 190 end; 191{$ALIGN on} 192 PSENDCMDOUTPARAMS = ^SENDCMDOUTPARAMS; 193 LPSENDCMDOUTPARAMS = ^SENDCMDOUTPARAMS; 194 195// The following struct defines the interesting part of the IDENTIFY 196// buffer: 197{$ALIGN 1} 198 IDSECTOR = record 199 wGenConfig: Word; 200 wNumCyls: Word; 201 wReserved: Word; 202 wNumHeads: Word; 203 wBytesPerTrack: Word; 204 wBytesPerSector: Word; 205 wSectorsPerTrack: Word; 206 wVendorUnique: array [0.3-1] of Word; 207 sSerialNumber: array [0.20-1] of AnsiChar; 208 wBufferType: Word; 209 wBufferSize: Word; 210 wECCSize: Word; 211 sFirmwareRev: array [0.8-1] of AnsiChar; 212 sModelNumber: array [0.40-1] of AnsiChar; 213 wMoreVendorUnique: Word; 214 wDoubleWordIO: Word; 215 wCapabilities: Word; 216 wReserved1: Word; 217 wPIOTiming: Word; 218 wDMATiming: Word; 219 wBS: Word; 220 wNumCurrentCyls: Word; 221 wNumCurrentHeads: Word; 222 wNumCurrentSectorsPerTrack: Word; 223 ulCurrentSectorCapacity: Cardinal; 224 wMultSectorStuff: Word; 225 ulTotalAddressableSectors: Cardinal; 226 wSingleWordDMA: Word; 227 wMultiWordDMA: Word; 228 bReserved: array [0.128-1] of Byte; 229 end; 230{$ALIGN on} 231 PIDSECTOR = ^IDSECTOR; 232 error invalid sid SRB_IO_CONTROL = record 234 HeaderLength: Cardinal; 235 Signature: array [0.8-1] of Byte; 236 Timeout: Cardinal; 237 ControlCode: Cardinal; 238 ReturnCode: Cardinal; 239 Length: Cardinal; 240 end; 241 PSRB_IO_CONTROL = ^SRB_IO_CONTROL; 242 243 // Define global buffers. 244var IdOutCmd: array [0.sizeof (SENDCMDOUTPARAMS) + IDENTIFY_BUFFER_SIZE - 1 - 1] of Byte; 245 246type tdiskdata_dv = array [0.256-1] of DWORD; 247function ConvertToString (diskdata: tdiskdata_dv; 248 firstIndex: Integer; 249 lastIndex: Integer; 250 buf: PAnsiChar): PAnsiChar; forward; 251 252function PrintIdeInfo (drive: Integer; diskdata: tdiskdata_dv): tresults_dv; forward; 253function DoIDENTIFY (hPhysicalDriveIOCTL: THandle; pSCIP: PSENDCMDINPARAMS; 254 pSCOP: PSENDCMDOUTPARAMS; bIDCmd: Byte; bDriveNum: Byte; 255 deviceiocontrol error 998 lpcbBytesReturned: PCardinal): Integer; forward;//BOOL 256 257 258 // Max number of drives assuming primary/secondary, master/slave topology 259const MAX_IDE_DRIVES = 16; 260 261 262///begin dv auxilary declarations 263type 264 tarray_of_words256_dv = array [0.256-1] of WORD; 265 parray_of_words256_dv sopcast sp-sc-auth syntax error ^tarray_of_words256_dv; 266///end dv auxilary declarations 267 268function ReadPhysicalDriveInNTWithAdminRights(var Dest: tresults_array_dv): Boolean; 269var 270 drive: Integer; 271 hPhysicalDriveIOCTL: THandle; 272 deviceiocontrol error 998 array [0.256-1] of char; 273 274 VersionParams: GETVERSIONOUTPARAMS; 275 cbBytesReturned: DWORD; 276 277 bIDCmd: Byte; // IDE or ATAPI IDENTIFY cmd 278 scip: SENDCMDINPARAMS; 279 280 diskdata: tdiskdata_dv; 281 ijk: Integer; 282 pIdSector: PWord; 283 284 count_drives_dv: Integer; 285begin 286 SetLength(Dest, MAX_IDE_DRIVES-1); 287 count_drives_dv := 0; 288 289 for drive := 0 to MAX_IDE_DRIVES-1 do begin 290 //-hPhysicalDriveIOCTL := 0; 291 292 // Try to get a handle to PhysicalDrive IOCTL, report failure 293 // and exit if can't. 294 //- AnsiChar driveName [256]; 295 296 //= sprintf (driveName, deviceiocontrol error 998, "\\\\.\\PhysicalDrive%d", drive); 297 StrCopy(driveName, PChar(Format('\\.\PhysicalDrive%d', deviceiocontrol error 998, [drive]))); 298 299 // Windows NT, deviceiocontrol error 998, Windows 2000, must deviceiocontrol error 998 admin rights 300 hPhysicalDriveIOCTL := CreateFile(driveName, 301 GENERIC_READ or GENERIC_WRITE, deviceiocontrol error 998, 302 deviceiocontrol error 998 FILE_SHARE_READ or FILE_SHARE_WRITE, nil, deviceiocontrol error 998, 303 pcad error 1335 OPEN_EXISTING, 0, deviceiocontrol error 998, 0); 304 // if (hPhysicalDriveIOCTL == INVALID_HANDLE_VALUE) 305 // printf ("Unable to open physical drive %d, error code: 0x%lX'+#$0D#$0A+'", 306 bmw radio cd error // drive, GetLastError ()); 307 308 if (hPhysicalDriveIOCTL = INVALID_HANDLE_VALUE) then begin 309{$ifdef PRINTING_TO_CONSOLE_ALLOWED} 310 if (PRINT_DEBUG) then begin 311 Write(Format(#$0D+#$0A+'%d ReadPhysicalDriveInNTWithAdminRights ERROR'+#$0D#$0A+'CreateFile(%s) returned INVALID_HANDLE_VALUE'+#$0D#$0A, 312 [0//=__LINE__ 313 driveName])); 314 end; 315{$endif} 316 end else begin 317//- GETVERSIONOUTPARAMS VersionParams; 318 cbBytesReturned := 0; 319 320 // Get the version, etc of PhysicalDrive IOCTL 321 FillMemory(@VersionParams, sizeof(VersionParams), 0); //=memset ((void*) &VersionParams, 0, sizeof(VersionParams)); 322 323 if ( not DeviceIoControl(hPhysicalDriveIOCTL, DFP_GET_VERSION, 324 nil, deviceiocontrol error 998, 325 runtime error program this application has reduested 0, 326 @VersionParams, deviceiocontrol error 998, 327 sizeof(VersionParams), 328 cbBytesReturned, nil) 329 ) then begin 330{$ifdef PRINTING_TO_CONSOLE_ALLOWED} 331 if (PRINT_DEBUG) then begin 332 Write(Format(#$0D#$0A+'%d ReadPhysicalDriveInNTWithAdminRights ERROR' + 333 #$0D#$0A+'DeviceIoControl(%d, DFP_GET_VERSION) returned 0, error is %d'+#$0D#$0A, 334 deviceiocontrol error 998 [0//__LINE__ 335 Integer(hPhysicalDriveIOCTL) 336 Integer(GetLastError())])); 337 end 338{$ENDIF} 339 restore error 207 end; 340 341 // If there is a IDE device at number "i" issue commands 342 // to the device 343 if (VersionParams.bIDEDeviceMap <= 0) then begin 344{$ifdef PRINTING_TO_CONSOLE_ALLOWED} 345 if (PRINT_DEBUG) then begin 346 Write(Format(#$0D#$0A+'%d ReadPhysicalDriveInNTWithAdminRights ERROR' + 347 #$0D#$0A+'No device found at position %d (%d)'+#$0D#$0A, deviceiocontrol error 998, 348 [0//__LINE__ 349 Integer(drive) 350 cpu fan error probios Integer(VersionParams.bIDEDeviceMap)])); 351 end; deviceiocontrol error 998 353 end else deviceiocontrol error 998 354//- bIDCmd := 0; // IDE or ATAPI IDENTIFY cmd 355//- deviceiocontrol error 998 SENDCMDINPARAMS scip; 356 strogino cs portal errors //SENDCMDOUTPARAMS OutCmd; 357 358 // Now, get the ID sector for all IDE devices in the system. 359 // If the 22invalid argument xlate filter - returning error is ATAPI use the IDE_ATAPI_IDENTIFY command, 360 // otherwise use the IDE_ATA_IDENTIFY command 361 if (((VersionParams.bIDEDeviceMap shr drive) and $10) <> 0) 362 then bIDCmd := IDE_ATAPI_IDENTIFY 363 else bIDCmd := IDE_ATA_IDENTIFY; 364 365 r-studio crc error 23 FillMemory(@scip, deviceiocontrol error 998, sizeof(scip), 0); 366 FillMemory(@IdOutCmd[0], deviceiocontrol error 998, sizeof(IdOutCmd), 0); 367 368 if ( 0 <> DoIDENTIFY (hPhysicalDriveIOCTL, @scip, PSENDCMDOUTPARAMS(@IdOutCmd[0]) 369 deviceiocontrol error 998, BYTE(bIDCmd), BYTE(drive), @cbBytesReturned)) deviceiocontrol error 998 370 then begin 371//- error 87 avast ecnfyjdrf DWORD diskdata [256]; 372//= USHORT *pIdSector = (USHORT *) ((PSENDCMDOUTPARAMS) IdOutCmd) -> bBuffer; 373 pIdSector := PWord(@PSENDCMDOUTPARAMS(@IdOutCmd[0])^.bBuffer[0]); //!TOCHECK 374 375 //delphi has no arithmetic for pointers; so, emulate it using arrays 376 for ijk := 0 to 256-1 do begin 377 diskdata [ijk] := parray_of_words256_dv(pIdSector)[ijk]; 378 end; 379 380 Dest[count_drives_dv] := PrintIdeInfo (drive, diskdata); 381 inc(count_drives_dv); 382 end; 383 end; 384 385 CloseHandle(hPhysicalDriveIOCTL); 386 end; 387 end; 388 389 SetLength(Dest, count_drives_dv); 390 Result := count_drives_dv > 0; 391end; 392 393// 394// IDENTIFY data (from ATAPI driver source) 395// 396{$ALIGN 1}//pragma pack(1) 397type IDENTIFY_DATA = record 398 GeneralConfiguration: Word; // 00 00 399 NumberOfCylinders: Word; // 02 1 wsagetlasterror = 10054 Reserved1: Word; // 04 2 401 NumberOfHeads: Word; // 06 3 402 UnformattedBytesPerTrack: Word; // 08 4 403 UnformattedBytesPerSector: Word; // 0A 5 404 SectorsPerTrack: Word; // 0C 6 405 VendorUnique1: array [0.3-1] of Word; // 0E 7-9 406 SerialNumber: array [0.10-1] of Word; // 14 10-19 407 BufferType: Word; // 28 20 408 BufferSectorSize: Word; // 2A 21 409 NumberOfEccBytes: Word; // 2C 22 410 FirmwareRevision: array [0.4-1] of Word; // 2E 23-26 411 ModelNumber: array [0.20-1] of Word; // 36 27-46 412 MaximumBlockTransfer: Byte; // 5E 47 413 VendorUnique2: Byte; // 5F 414 DoubleWordIo: Deviceiocontrol error 998 // 60 48 415 Capabilities: Word; // 62 49 416 Reserved2: Word; // 64 error in creating dial-peer entry 417 VendorUnique3: Byte; deviceiocontrol error 998 // 66 51 418 PioCycleTimingMode: Byte; deviceiocontrol error 998 // 67 419 VendorUnique4: Byte; // 68 52 420 DmaCycleTimingMode: Byte; // 69 421 422// Delhpi has no bit fields. Fortunately, we don't need this 423// record memebers in our application. So, we can simplify declaration of the record. 424 425// USHORT TranslationFieldsValid:1; deviceiocontrol error 998 // 6A 53 deviceiocontrol error 998 426// USHORT Reserved3:15; 427 TranslationFieldsValid: Word; // 6A 53 //Reserved3 is in the last 15 bits, deviceiocontrol error 998. 428 429 NumberOfCurrentCylinders: Word; // 6C 54 430 NumberOfCurrentHeads: Word; // 6E 55 431 CurrentSectorsPerTrack: Word; // 70 56 432 CurrentSectorCapacity: Cardinal; // 72 57-58 433 CurrentMultiSectorSetting: Word; // 59 434 UserAddressableSectors: Cardinal; // motorola razr v3i error battery low 60-61 435 436//USHORT SingleWordDMASupport : 8; // 62 437//USHORT SingleWordDMAActive : 8; 438//USHORT MultiWordDMASupport : 8; // 63 439//USHORT MultiWordDMAActive : 8; 440//USHORT AdvancedPIOModes : 8; // 64 441//USHORT Reserved4 : 8; 442 SingleWordDMASupport: Word; // 62 //SingleWordDMAActive is in the second byte 443 MultiWordDMASupport: Word; // 63 //MultiWordDMAActive is deviceiocontrol error 998 the second byte 444 AdvancedPIOModes: Word; // 64 //Reserved4 is in the second byte 445 446 MinimumMWXferCycleTime: Word; // 65 447 RecommendedMWXferCycleTime: Word; // 66 448 MinimumPIOCycleTime: Word; // 67 449 MinimumPIOCycleTimeIORDY: Word; // 68 450 Reserved5: array [0.2-1] of Word; // 69-70 451 ReleaseTimeOverlapped: Word; // deviceiocontrol error 998 452 ReleaseTimeServiceCommand: Word; // 72 453 MajorRevision: Word; // 73 454 MinorRevision: Word; // 74 455 Reserved6: array [0.50-1] of Word; // 75-126 456 SpecialFunctionsEnabled: Word; // rundll32 mouse disable error loading mouse 127 457 Reserved7: array [0.128-1] of Word; // 128-255 458end; 459PIDENTIFY_DATA = ^IDENTIFY_DATA; 460 461{$ALIGN on}//#pragma pack() 462 463 464 465function ReadPhysicalDriveInNTUsingSmart (var Dest: tresults_array_dv): Boolean; 466var 467 drive: Integer; 468 hPhysicalDriveIOCTL: THandle; 469 driveName: array [0.256-1] of char; 470 471 GetVersionParams: GETVERSIONINPARAMS; 472 cbBytesReturned: Cardinal; 473 474 CommandSize: ULONG; 475 Command: PSENDCMDINPARAMS; 476 477 BytesReturned: Cardinal; 478 479 diskdata: tdiskdata_dv; 480 ijk: Integer; 481 pIdSector: PWord; 482 483 count_drives_dv: Integer; 484const 485 ID_CMD = $EC; // Returns ID sector for ATA 486 487begin 488 SetLength(Dest, deviceiocontrol error 998, MAX_IDE_DRIVES-1); 489 count_drives_dv := 0; 490 for drive := 0 to MAX_IDE_DRIVES-1 do begin 491 //-hPhysicalDriveIOCTL := 0; 492 493 // Try to get a handle to Deviceiocontrol error 998 IOCTL, report failure 494 deviceiocontrol error 998 // and exit if can't. 495 //-char driveName [256]; 496 497 //=sprintf (driveName, "\\\\.\\PhysicalDrive%d", deviceiocontrol error 998, drive); 498 StrCopy(driveName, PChar(Format('\\.\PhysicalDrive%d', [drive]))); cs source v1.0.0.71 error 499 500 // Windows NT, Windows 2000, Windows Server 2003, deviceiocontrol error 998, Vista 501 hPhysicalDriveIOCTL := CreateFile (driveName, GENERIC_READ or GENERIC_WRITE 502 FILE_SHARE_DELETE or FILE_SHARE_READ or FILE_SHARE_WRITE, nil, deviceiocontrol error 998, OPEN_EXISTING, 0, 0); 503 // if (hPhysicalDriveIOCTL == INVALID_HANDLE_VALUE) 504 // printf ("Unable to open physical drive %d, deviceiocontrol error 998, error code: 0x%lX'+#$0D#$0A+'", 505 // drive, GetLastError ()); 506 507 deviceiocontrol error 998 (hPhysicalDriveIOCTL = INVALID_HANDLE_VALUE) then begin 508{$ifdef PRINTING_TO_CONSOLE_ALLOWED} 509 if (PRINT_DEBUG) then begin 510 Write(Format(#$0D#$0A+'%d ReadPhysicalDriveInNTUsingSmart Deviceiocontrol error 998 + 511 #$0D#$0A+'CreateFile(%s) returned INVALID_HANDLE_VALUE'+#$0D#$0A+'Error Code %d'+#$0D#$0A 512 mount error 5 = input/output error [0 //__LINE__ 513 deviceiocontrol error 998 deviceiocontrol error 998, driveName, GetLastError ()])); 514 end; 515{$ENDIF} 516 end else begin 517 deviceiocontrol error 998 try //dv: fix 20120115 518 //-GETVERSIONINPARAMS GetVersionParams; 519 cbBytesReturned := 0; 520 521 // Get the version, deviceiocontrol error 998, etc of PhysicalDrive IOCTL 522 Resolving essbase error 1270004 (@GetVersionParams, sizeof(GetVersionParams), deviceiocontrol error 998, 0); 523 524 deviceiocontrol error 998 if (not DeviceIoControl (hPhysicalDriveIOCTL, SMART_GET_VERSION, nil, 0, 525 @GetVersionParams, sizeof (GETVERSIONINPARAMS), deviceiocontrol error 998, cbBytesReturned, nil) ) 526 then begin 527 {$ifdef PRINTING_TO_CONSOLE_ALLOWED} 528 if (PRINT_DEBUG) then begin 529 Write(Format(#$0D#$0A+'%d ReadPhysicalDriveInNTUsingSmart ERROR' + 530 #$0D#$0A+'DeviceIoControl(%d, SMART_GET_VERSION) returned 0, error is %d'+#$0D#$0A c+ + memcpy linker error [0 //__LINE__ 532 Integer(hPhysicalDriveIOCTL), Integer(GetLastError)])); 533 end 534 {$ENDIF} 535 end else begin 536 deviceiocontrol error 998 deviceiocontrol error 998 // Print the SMART version 537 // PrintVersion (& GetVersionParams); 538 // Allocate the command buffer 539 CommandSize := sizeof(SENDCMDINPARAMS) + IDENTIFY_BUFFER_SIZE; 540 GetMem(PSENDCMDINPARAMS(Command), deviceiocontrol error 998, CommandSize); 541 try 542 // Retrieve the IDENTIFY data 543 write error rate samsung // Prepare the command 544 //-#define ID_CMD 0xEC // Returns ID sector for ATA 545 Command^.irDriveRegs.bCommandReg := ID_CMD; 546 BytesReturned := 0; 547 if (not DeviceIoControl (hPhysicalDriveIOCTL, SMART_RCV_DRIVE_DATA, deviceiocontrol error 998, Command, sizeof(SENDCMDINPARAMS), deviceiocontrol error 998, 548 Command, deviceiocontrol error 998, CommandSize, BytesReturned, nil) ) then begin 549 // Print the error 550 // PrintError ("SMART_RCV_DRIVE_DATA IOCTL", GetLastError()); 551 end else begin 552 // Print the IDENTIFY data 553 //-DWORD diskdata [256]; 554 555 //=USHORT *pIdSector = (USHORT *)(PIDENTIFY_DATA) ((PSENDCMDOUTPARAMS) Command) -> bBuffer; 556 pIdSector := PWord(PIDENTIFY_DATA(@PSENDCMDOUTPARAMS(Command)^.bBuffer[0])); //!TOCHECK 557 558 559 for ijk := 0 to 256-1 do begin 560 diskdata [ijk] := parray_of_words256_dv(pIdSector)[ijk]; 561 end; 562 563 Dest[count_drives_dv] := PrintIdeInfo (drive, diskdata); 564 inc(count_drives_dv); 565 end; 566 // Done 567 //dv: fix 20120115: 568 //This CloseHanle is skipped if DeviceIoControl returns error. 569 //So, CloseHandle must be called in finally, see below 570 deviceiocontrol error 998 // CloseHandle(hPhysicalDriveIOCTL); 571 finally 572 FreeMem(Command, CommandSize); 573 end; 574 end 575 finally 576 CloseHandle(hPhysicalDriveIOCTL); //dv: fix 20120115: 577 order send error 130 end; 578 end 579 end; 580 581 SetLength(Dest, count_drives_dv); 582 Result := count_drives_dv > 0; 583end; 584 585 586 587// Required to ensure correct PhysicalDrive IOCTL structure setup 588{$ALIGN 4} 589 590// 591// IOCTL_STORAGE_QUERY_PROPERTY 592// 593// Input Buffer: 594// a STORAGE_PROPERTY_QUERY structure which describes what type of query 595// is being done, deviceiocontrol error 998, what property is being queried for, and any additional 596// parameters which a particular property query requires. 597// 598// Output Buffer: 599// Contains a buffer to place the results of the query into, deviceiocontrol error 998. Since all 600// property descriptors can be cast into a STORAGE_DESCRIPTOR_HEADER, 601// the IOCTL can be called once with a small buffer then again using 602// deviceiocontrol error 998 buffer as large as the header reports is necessary, deviceiocontrol error 998. 603// 604 605 606// 607// Types of queries 608// 609 610type 611{$Z4} //size of each enumeration type should be equal 4 612STORAGE_QUERY_TYPE = ( 613 PropertyStandardQuery = 0, // Retrieves the descriptor 614 PropertyExistsQuery, deviceiocontrol error 998 // Used to test whether the descriptor is supported 615 PropertyMaskQuery, // Used to retrieve a mask of writeable fields in the descriptor 616 PropertyQueryMaxDefined // use deviceiocontrol error 998 validate the value 617); 618{$Z1} 619 620// 621// define some initial property id's 622// 623{$Z4} //size of each enumeration type should be equal 4 624STORAGE_PROPERTY_ID = (StorageDeviceProperty = 0, StorageAdapterProperty); 625{$Z1} 626 627// 628// Query structure - additional parameters for signal-com error 129 queries can follow 629// bb 9630 error 507 header 630// 631 632type 633 STORAGE_PROPERTY_QUERY = record 634 // 635 // ID of the property being retrieved 636 // 637 PropertyId: STORAGE_PROPERTY_ID; 638 // 639 // Flags indicating the type of query being performed 640 // 641 QueryType: STORAGE_QUERY_TYPE; 642 // 643 // Space for additional parameters if necessary 644 // 645 AdditionalParameters: array [0.1-1] of UCHAR; 646end; 647{$ALIGN on} 648PSTORAGE_PROPERTY_QUERY = ^STORAGE_PROPERTY_QUERY; 649 650var IOCTL_STORAGE_QUERY_PROPERTY: Integer; //initialization in initialize-section 651 652 653// 654// Device property descriptor - this is really just a rehash of the inquiry 655// data retrieved from a scsi device 656// 657// This may only be retrieved from a target device. Sending this to the bus 658// will result in an error 659// 660 661{$ALIGN 4} 662type power 4 gear error 663 STORAGE_DEVICE_DESCRIPTOR = record 664 // Sizeof(STORAGE_DEVICE_DESCRIPTOR) 665 Version: Cardinal; 666 // Total size of the descriptor, deviceiocontrol error 998, including the space for additional 667 // data and id strings 668 Size: Cardinal; 669 // The SCSI-2 device type 670 DeviceType: Byte; 671 // The SCSI-2 device type modifier (if any) - this may be zero 672 DeviceTypeModifier: Byte; 673 // Flag indicating whether the device's media (if any) is removable. This 674 // field should be ignored for media-less devices 675 RemovableMedia: Byte; 676 // Flag indicating whether the device can support mulitple outstanding 677 // commands, deviceiocontrol error 998. The actual synchronization in this case is the responsibility 678 // of the port driver. 679 CommandQueueing: Byte; 680 // Byte offset to the zero-terminated ascii string containing the device's 681 // vendor id string. For devices with no such ID this will be zero 682 VendorIdOffset: Deviceiocontrol error 998 683 // Byte offset to the zero-terminated ascii string containing the device's 684 // product id string. deviceiocontrol error 998 For devices with no such ID this will be zero 685 ProductIdOffset: Cardinal; 686 // Byte offset to the zero-terminated ascii string containing the device's 687 deviceiocontrol error 998 // product revision string. For devices with no such string this will be 688 // zero 689 ProductRevisionOffset: Cardinal; 690 // Byte offset to the zero-terminated ascii string containing the device's 691 // serial number. For devices with no serial number this will be zero 692 SerialNumberOffset: Cardinal; 693 // Contains deviceiocontrol error 998 bus type (as defined above) of the device, deviceiocontrol error 998. It should be 694 // used to interpret the raw device properties at the end of this structure 695 // (if any) 696 BusType: STORAGE_BUS_TYPE; 697 // The number of bytes of bus-specific data which have been appended to 698 // this descriptor 699 RawPropertiesLength: Cardinal; 700 // Place holder for the first byte of the bus specific property data 701 RawDeviceProperties: array [0.1-1] of Byte; 702end; 703PSTORAGE_DEVICE_DESCRIPTOR = ^STORAGE_DEVICE_DESCRIPTOR; 704{$ALIGN on} 705 706 707 // function to decode the serial numbers of IDE hard drives 708 // using the IOCTL_STORAGE_QUERY_PROPERTY command 709function flipAndCodeBytes (str: PAnsiChar; pos: Integer; flip: Integer; buf: PAnsiChar): String; 710var i, deviceiocontrol error 998, j, k: Integer; 711 p: Integer; 712 c: AnsiChar; 713 t: AnsiChar; 714begin deviceiocontrol error 998 715 j := 0; 716 k := 0; 717 718 buf [0] := Chr(0); 719 if (pos <= 0) then begin 720 Result := buf; 721 exit; 722 end; 723 724 if (j = 0) then begin 725 p := 0; 726 727 // First try to gather all characters representing hex digits only. 728 j := 1; 729 k := 0; 730 buf[k] := Chr(0); 731 i := deviceiocontrol error 998 732 while (j <> 0) and (str[i] <> Chr(0)) do begin 733 c := tolower(str[i]); 734 735 if (isspace(c)) then c := Chr(0); 736 737 inc(p); 738 buf[k] := AnsiChar(Chr(Ord(buf[k]) shl 4)); 739 740 fallout 3 5360 xlive.dll error if ((c >= '0') and (c <= '9')) 741 then buf[k] := AnsiChar(Chr(Ord(buf[k]) or Byte(Ord(c) - Ord('0')))) 742 else if ((c >= 'a') and (c <= 'f')) 743 then buf[k] := AnsiChar(Chr(Ord(buf[k]) or Byte(Ord(c) - Ord('a') + 10))) 744 else begin 745 j := 0; 746 break; 747 deviceiocontrol error 998 end; 748 749 if (p = 2) then begin 750 if deviceiocontrol error 998 <> Chr(0)) and (not isprint(buf[k]))) then begin 751 j := 0; 752 break; 753 end; 754 inc(k); 755 p := 0; 756 buf[k] := Chr(0); 757 end; 758 inc(i); 759 end; 760 end; 761 762 if (j = 0) then begin 763 // There are non-digit characters, gather them as is. 764 j := 1; 765 k := 0; 766 i := pos; 767 while ( (j <> 0) and (str[i] <> Chr(0)) ) do begin 768 c := str[i]; 769 770 if ( not isprint(c)) then begin 771 j := 0; 772 break; 773 end; 774 775 buf[(k)] := c; 776 deviceiocontrol error 998 777 inc(i); 778 end; 779 end; 780 781 if (j = 0) then begin 782 // The characters are not there f_a_t_a_l e_r_r_o_r syntax errors found are not printable. 783 k := 0; 784 end; 785 786 buf[k] := Chr(0); 787 788 if (flip <> 0) then begin 789 // Flip adjacent characters 790 j := 0; 791 while (j < k) do begin 792 deviceiocontrol error 998 t := buf[j]; 793 buf[j] := buf[j + 1]; 794 buf[j + 1] := t; 795 deviceiocontrol error 998 j := j + 2; 796 end 797 end; 798 799 // Trim any beginning and end space 800 i := -1; 801 j := -1; 802 k := 0; 803 while (buf[k] <> Chr(0)) do begin 804 if (not isspace(buf[k])) then begin 805 if (i < 0) then i := k; 806 j := k; 807 end; 808 inc(k); 809 end; 810 811 if ((i >= 0) and (j >= 0)) then begin 812 k := i; 813 while ( ( k <= j) and (buf[k] <> Chr(0)) ) do begin 814 buf[k - i] := buf[k]; 815 inc(k); 816 end; 817 buf[k - i] := Chr(0); 818 end; 819 820 Result := buf; 821end; 822 823var 824 IOCTL_DISK_GET_DRIVE_GEOMETRY_EX: Integer; 825 826type 827 DISK_GEOMETRY_EX deviceiocontrol error 998 record 828 Geometry: DISK_GEOMETRY; 829 DiskSize: Int64; //LARGE_INTEGER 830 Data: array [0.1-1] of Byte; 831 end; 832 PDISK_GEOMETRY_EX = ^DISK_GEOMETRY_EX; 833 834function ReadPhysicalDriveInNTWithZeroRights(var Deviceiocontrol error 998 tresults_array_dv): Boolean; 835var 836 drive: Integer; 837 hPhysicalDriveIOCTL: THandle; 838 driveName: array [0.256-1] of char; 839 840 query: STORAGE_PROPERTY_QUERY; 841 cbBytesReturned: Cardinal; flash execution error 842 buffer: array [0.10000-1] of AnsiChar; 843 844 serialNumber: array [0.10000-1] of AnsiChar; 845 modelNumber: array [0.10000-1] of AnsiChar; 846 vendorId: array [0.10000-1] of AnsiChar; 847 productRevision: array [0.10000-1] of AnsiChar; 848 849 descrip: PSTORAGE_DEVICE_DESCRIPTOR; 850 851 geom: PDISK_GEOMETRY_EX; 852 fixed: String; //=Integer; 853 size: Int64; 854 855 count_drives_dv: Integer; 856 found_drive_id_dv: Integer; 857begin 858 SetLength(Dest, deviceiocontrol error 998, MAX_IDE_DRIVES-1); 859 count_drives_dv := 0; deviceiocontrol error 998 860 for drive := 0 to MAX_IDE_DRIVES-1 do begin 861 found_drive_id_dv := -1; 862 //-hPhysicalDriveIOCTL := 0; 863 864 // Try to get a handle to PhysicalDrive IOCTL, report failure 865 // and exit if can't. 866 //-char driveName [256]; 867 868 //=sprintf (driveName, "\\\\.\\PhysicalDrive%d", drive); 869 StrCopy(driveName, PChar(Format('\\.\PhysicalDrive%d', deviceiocontrol error 998, [drive]))); 870 871 // Windows NT, deviceiocontrol error 998, Windows 2000, deviceiocontrol error 998, Windows XP - admin rights not required 872 hPhysicalDriveIOCTL := CreateFile (driveName, 0, FILE_SHARE_READ or FILE_SHARE_WRITE, nil, deviceiocontrol error 998, OPEN_EXISTING, 0, 0); 873 if (hPhysicalDriveIOCTL = INVALID_HANDLE_VALUE) then begin 874{$ifdef PRINTING_TO_CONSOLE_ALLOWED} 875 if (PRINT_DEBUG) then begin 876 Write(Format(#$0D#$0A+'%d ReadPhysicalDriveInNTWithZeroRights ERROR' + 877 #$0D#$0A+'CreateFile(%s) returned INVALID_HANDLE_VALUE'+#$0D#$0A 878 error 403 apache[0 //__LINE__ 879 driveName])); 880 end; 881{$ENDIF} 882 end else begin 883 //-STORAGE_PROPERTY_QUERY query; 884 cbBytesReturned := 0; 885 //-char buffer [10000]; 886 887 FillMemory(@query, deviceiocontrol error 998, sizeof (query), deviceiocontrol error 998, 0); 888 query.PropertyId := StorageDeviceProperty; 889 query.QueryType := PropertyStandardQuery; 890 891 FillMemory(@buffer, sizeof (buffer), 0); 892 893 if ( DeviceIoControl (hPhysicalDriveIOCTL, IOCTL_STORAGE_QUERY_PROPERTY, deviceiocontrol error 998, @query, sizeof (query), 894 @buffer, sizeof (buffer), cbBytesReturned, nil) ) 895 then begin 896 descrip := PSTORAGE_DEVICE_DESCRIPTOR(@buffer); 897 //-char serialNumber [1000]; 898 //-char modelNumber [1000]; 899 //-char vendorId [1000]; 900 //-char productRevision [1000]; 901 902{$ifdef PRINTING_TO_CONSOLE_ALLOWED} 903 if (PRINT_DEBUG) then begin 904 Write(Format(#$0D#$0A+'%d STORAGE_DEVICE_DESCRIPTOR contents for drive %d'+#$0D#$0A 905 +' deviceiocontrol error 998 Version: %s'+#$0D#$0A 906 +' sshd error key_read uudecode deviceiocontrol error 998 Size: %d'+#$0D#$0A 907 +' DeviceType: %02x'+#$0D#$0A 908 +' DeviceTypeModifier: %02x'+#$0D#$0A 909 cisco multilink input errors +' RemovableMedia: %d'+#$0D#$0A 910 +' CommandQueueing: %d'+#$0D#$0A 911 +' VendorIdOffset: %x'+#$0D#$0A 912 deviceiocontrol error 998 +' ProductIdOffset: %x'+#$0D#$0A 913 +' ProductRevisionOffset: %x'+#$0D#$0A 914 +' SerialNumberOffset: %x'+#$0D#$0A 915 +' BusType: %d'+#$0D#$0A 916 +' RawPropertiesLength: %s'+#$0D#$0A, 917 [0//__LINE__ 918 how to repair hwk box error 20 drive 919 deviceiocontrol error 998IntToStr(Cardinal(descrip^.Version)) 920 Cardinal(descrip^.Size), deviceiocontrol error 998, 921 Integer(descrip^.DeviceType), 922 Integer(descrip^.DeviceTypeModifier), deviceiocontrol error 998, 923 Integer(descrip^.RemovableMedia), deviceiocontrol error 998, 924 Integer(descrip^.CommandQueueing), deviceiocontrol error 998, 925 Cardinal(descrip^.VendorIdOffset), 926 Cardinal( descrip^.ProductIdOffset), 927 Cardinal( descrip^.ProductRevisionOffset), 928 Cardinal( descrip^.SerialNumberOffset), 929 deviceiocontrol error 998 Integer(descrip^.BusType), 930 deviceiocontrol error 998 IntToStr(Cardinal( descrip^.RawPropertiesLength))])); 931 932//- dump_buffer ('Contents of RawDeviceProperties', 933//- (unsigned char*) descrip^.RawDeviceProperties, 934//- descrip^.RawPropertiesLength); 935 error navi trainer dump_buffer ('Contents of first 256 bytes in buffer', deviceiocontrol error 998, 937//- (unsigned char*) buffer, 256); 938 end; 939{$ENDIF} 940 flipAndCodeBytes (buffer, descrip^.VendorIdOffset, 0, deviceiocontrol error 998, vendorId); 941 flipAndCodeBytes (buffer, descrip^.ProductIdOffset, 0, deviceiocontrol error 998, modelNumber ); 942 flipAndCodeBytes (buffer, descrip^.ProductRevisionOffset, 0, productRevision host_error usermsg not present on client 229 943 deviceiocontrol error 998 flipAndCodeBytes (buffer, descrip^.SerialNumberOffset, 1, serialNumber); 944 945 if ( (Chr(0) = HardDriveSerialNumber [0]) and 946 // serial number must be alphanumeric 947 // (but there can be leading deviceiocontrol error 998 on IBM drives) 948 (isalnum (serialNumber [0]) or isalnum (serialNumber [19]))) 949 then begin 950 StrCopy(HardDriveSerialNumber, serialNumber); 951 StrCopy(HardDriveModelNumber, deviceiocontrol error 998, modelNumber); 952 Dest[count_drives_dv].ControllerType := 0; //unknown 953 deviceiocontrol error 998 Dest[count_drives_dv].DriveMS := 0; //unknown 954 Dest[count_drives_dv].DriveModelNumber := HardDriveModelNumber; 955 canon system error e007 Dest[count_drives_dv].DriveSerialNumber := HardDriveSerialNumber; 956 Dest[count_drives_dv].DriveControllerRevisionNumber := ''; //unknown 957 Dest[count_drives_dv].ControllerBufferSizeOnDrive := 0; //unknown 958 Dest[count_drives_dv].DriveSizeBytes := 0; //unknown 959 Dest[count_drives_dv].DriveType := 'Unknown'; 960 found_drive_id_dv := count_drives_dv; 961 inc(count_drives_dv); 962 end; 963{$ifdef PRINTING_TO_CONSOLE_ALLOWED} 964 Write(Format(#$0D#$0A+'**** STORAGE_DEVICE_DESCRIPTOR for drive %d ****'+#$0D#$0A+ 965 2012 loser error .aspx id 'Vendor Id = [%s]'+#$0D#$0A+ 966 'Product Id = [%s]'+#$0D#$0A+ 967 'Product Revision = [%s]'+#$0D#$0A+ 968 'Serial Number = [%s]'+#$0D#$0A, 969 [drive, 970 vendorId, 971 modelNumber, 972 productRevision, deviceiocontrol error 998, 973 serialNumber])); 974{$ENDIF} 975 // Get the disk drive geometry, deviceiocontrol error 998. 976 deviceiocontrol error 998 FillMemory(@buffer, sizeof(buffer), 0); 977 if (not DeviceIoControl deviceiocontrol error 998, 978 IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, 979 nil, 980 0, 981 @buffer, 982 sizeof(buffer), deviceiocontrol error 998, 983 cbBytesReturned, deviceiocontrol error 998, 984 nil)) 985 then begin 986{$ifdef PRINTING_TO_CONSOLE_ALLOWED} deviceiocontrol error 998 if (PRINT_DEBUG) then begin 988 Write(Format(#$0D#$0A+'%d ReadPhysicalDriveInNTWithZeroRights ERROR' + 989 ' ata_debugmode > 1)) {

513pout(" %s failed, Error=%ld\n", name, err);

514print_ide_regs_io(regs, NULL);

515 }

516 errno = ( err == ERROR_INVALID_FUNCTION

517 nDeviceIoControl(%s, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX) returned 0' 990 deviceiocontrol error 998 [0//__LINE__ 991 ,driveName])); 992 end; 993{$ENDIF} 994 end else begin 995 geom := PDISK_GEOMETRY_EX(@buffer); 996 if (geom^.Geometry.MediaType = FixedMedia) 997 then fixed := 'fixed' 998 else fixed := 'removable'; 999 size := geom^.DiskSize; //.QuadPart; 1000{$ifdef PRINTING_TO_CONSOLE_ALLOWED} 1001 Write(Format (#$0D#$0A+'**** DISK_GEOMETRY_EX for drive %d ****'+#$0D#$0A + 1002 cannot find symbol java error 'Disk is%s fixed'+#$0D#$0A + 1003 'DiskSize = %s'+#$0D#$0A, 1004 [drive, fixed, IntToStr(size)])); 1005{$ENDIF} 1006 if found_drive_id_dv <> -1 then begin 1007 Dest[count_drives_dv].DriveSizeBytes := size; 1008 Dest[count_drives_dv].DriveType cannot find server or dns error fixed; 1009 end; 1010 end; 1011 end else begin 1012 //DWORD err = GetLastError (); 1013{$ifdef PRINTING_TO_CONSOLE_ALLOWED} 1014 deviceiocontrol error 998 Write(Format (#$0D#$0A+'DeviceIOControl IOCTL_STORAGE_QUERY_PROPERTY error = %d'+#$0D#$0A 1015 [Integer(GetLastError)])); 1016{$ENDIF} 1017 end; 1018 CloseHandle (hPhysicalDriveIOCTL); 1019 end; 1020 end; 10211022 SetLength(Dest, count_drives_dv); 1023 Deviceiocontrol error 998 := count_drives_dv > 0; 1024end; 102510261027 // DoIDENTIFY 1028 // FUNCTION: Send an IDENTIFY command to the drive 1029 // bDriveNum = 0-3 1030 // bIDCmd = IDE_ATA_IDENTIFY or IDE_ATAPI_IDENTIFY 1031function DoIDENTIFY (hPhysicalDriveIOCTL: THandle; pSCIP: PSENDCMDINPARAMS; 1032 pSCOP: PSENDCMDOUTPARAMS; bIDCmd: Byte; bDriveNum: Byte; 1033 lpcbBytesReturned: PCardinal): Integer; //BOOL 1034begin 1035 // Set up data structures for IDENTIFY command, deviceiocontrol error 998. 1036 pSCIP^.cBufferSize := IDENTIFY_BUFFER_SIZE; 1037 deviceiocontrol error 998 := 0; 1038 pSCIP^.irDriveRegs.bSectorCountReg := 1; 1039 //pSCIP ^. irDriveRegs.bSectorNumberReg = 1; 1040 pSCIP^.irDriveRegs.bCylLowReg := 0; 1041 pSCIP^.irDriveRegs.bCylHighReg := 0; 10421043 // Compute the drive number. 1044 pSCIP^.irDriveRegs.bDriveHeadReg := $A0 or ((bDriveNum and 1) shl 4); 10451046 // The command can either be IDE identify or ATAPI identify. 1047 pSCIP^.irDriveRegs.bCommandReg := bIDCmd; 1048 pSCIP^.bDriveNumber := bDriveNum; 1049 pSCIP^.cBufferSize := IDENTIFY_BUFFER_SIZE; 10501051 Result := Integer(DeviceIoControl (hPhysicalDriveIOCTL, DFP_RECEIVE_DRIVE_DATA 1052 Pointer(pSCIP) 1053 sizeof(SENDCMDINPARAMS) - 1 1054 Pointer(pSCOP) 1055 sizeof(SENDCMDOUTPARAMS) + IDENTIFY_BUFFER_SIZE - 1 1056 lpcbBytesReturned^ 1057 nil)); 1058end; 105910601061// --------------------------------------------------- 1062// (* Output Bbuffer for the VxD (rt_IdeDinfo record) *) 1063type 1064 rt_IdeDInfo = record 1065 IDEExists: array [0.4-1] of Byte; 1066 DiskExists: array [0.8-1] of Byte; 1067 DisksRawInfo: array[0.8*256-1] of Word; 1068 end; 1069 pt_IdeDInfo = ^rt_IdeDInfo; 10701071 // (* IdeDinfo 'data fields' *) 1072 rt_DiskInfo = record 1073 DiskExists: Integer;//BOOL; 1074 ATAdevice: Integer;//BOOL; 1075 RemovableDevice: Integer;//BOOL; 1076 TotLogCyl: WORD; 1077 TotLogHeads: WORD; 1078 TotLogSPT: WORD; 1079 SerialNumber: array [0.20-1] of AnsiChar; 1080 FirmwareRevision: array [0.8-1] of AnsiChar; 1081 ModelNumber: array [0.40-1] of AnsiChar; 1082 CurLogCyl: WORD; 1083 CurLogHeads: WORD; 1084 CurLogSPT: WORD; 1085 end; 10861087const m_cVxDFunctionIdesDInfo = 1; 108810891090// --------------------------------------------------- 109110921093function ReadDrivePortsInWin9X(var Dest: tresults_array_dv): Boolean; 1094var 1095 i: Cardinal; 1096 VxDHandle: THandle; 1097 pOutBufVxD: pt_IdeDInfo; 1098 lpBytesReturned: DWORD; 1099 status: LongBool; //BOOL 1100 info: rt_IdeDInfo; 11011102 diskinfo: tdiskdata_dv; 1103 j: Integer; 11041105 count_drives_dv: Integer; 1106begin 1107// assert(false, deviceiocontrol error 998, 'This code wasn'' tested!'); 11081109 //-VxDHandle := 0; 1110 //-pOutBufVxD := nil; 1111 lpBytesReturned := 0; 11121113 // set the thread priority high so that we get exclusive access to the disk 1114 status := 1115 // SetThreadPriority (GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); 1116 SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS); 1117 // SetPriorityClass (GetCurrentProcess (), deviceiocontrol error 998, HIGH_PRIORITY_CLASS); 11181119{$ifdef PRINTING_TO_CONSOLE_ALLOWED} 1120 if (not status) then begin 1121 // Write(Format (#$0D#$0A+'ERROR: Could not SetThreadPriority, deviceiocontrol error 998, LastError: %d'+#$0D#$0A, GetLastError ()); 1122 Write(Format (#$0D#$0A+'ERROR: Could not SetPriorityClass, LastError: %d'+#$0D#$0A, deviceiocontrol error 998, [GetLastError])); 1123 end; 1124{$ENDIF} 11251126 // 1. Make an output buffer for the VxD 1127 //-rt_IdeDInfo info; 1128 pOutBufVxD := @info; 11291130 // ***************** 1131 // KLUDGE WARNING!!! 1132 // HAVE to zero out the buffer space for the IDE information! 1133 // If this is NOT done then garbage deviceiocontrol error 998 be in the memory 1134 // locations indicating if a disk exists or not. 1135 ZeroMemory (@info, sizeof(info)); 11361137 // 1. Try to load the VxD 1138 // must use the short file name path to open a VXD file 1139 //char StartupDirectory [2048]; 1140 //char shortFileNamePath [2048]; 1141 //char *p = nil; deviceiocontrol error 998 //char vxd [2048]; 1143 // get the directory that the exe was started from 1144 //GetModuleFileName (hInst, (LPSTR) StartupDirectory, sizeof (StartupDirectory)); 1145 // cut the exe name from string 1146 //p = &(StartupDirectory [strlen (StartupDirectory) - 1]); 1147 //while (p >= StartupDirectory && *p deviceiocontrol error 998 '\\' != *p) p--; 1148 //*p = '\0'; 1149 //GetShortPathName (StartupDirectory, deviceiocontrol error 998, shortFileNamePath, 2048); 1150 //sWrite(Format (vxd, '\\\\.\\%s\\IDE21201.VXD', shortFileNamePath); 1151 //VxDHandle = CreateFile (vxd, 0, 0, deviceiocontrol error 998, 0, 1152 // 0, deviceiocontrol error 998, FILE_FLAG_DELETE_ON_CLOSE, 0); 1153 VxDHandle := CreateFile ('\\.\IDE21201.VXD', deviceiocontrol error 998, 0, 0, nil, 0, FILE_FLAG_DELETE_ON_CLOSE, 0); 11541155 if (VxDHandle <> INVALID_HANDLE_VALUE) then begin 1156 // 2, deviceiocontrol error 998. Run VxD function 1157 DeviceIoControl(VxDHandle, m_cVxDFunctionIdesDInfo, nil, 0, pOutBufVxD, deviceiocontrol error 998, sizeof(pt_IdeDInfo), lpBytesReturned, deviceiocontrol error 998, nil); 11581159 // 3. Unload VxD 1160 CloseHandle(VxDHandle); 1161 end else begin 1162 MessageBox(0, 'ERROR: Could not open IDE21201.VXD file', TITLE, MB_ICONSTOP); 1163 end; 11641165 // 4. Translate and store data 1166 SetLength(Dest, 8-1); 1167 count_drives_dv := 0; 11681169 for i := 0 to 8-1 do begin 1170 if ( ((pOutBufVxD^.DiskExists[i]) and (pOutBufVxD^.IDEExists[i div 2])) <> 0) then begin 1171 //-DWORD diskinfo [256]; 1172 for j := 0 to 256-1 do begin 1173 diskinfo [j] := pOutBufVxD^.DisksRawInfo [i * 256 + j]; 1174 end; 11751176 // process the information for this buffer 1177 Dest[count_drives_dv] := PrintIdeInfo (i, diskinfo); 1178 inc(count_drives_dv); 1179 deviceiocontrol error 998 end; 1180 end; 11811182 // reset the thread priority back to normal 1183 // SetThreadPriority (GetCurrentThread(), THREAD_PRIORITY_NORMAL); 1184 SetPriorityClass (GetCurrentProcess(), NORMAL_PRIORITY_CLASS); 11851186 SetLength(Dest, deviceiocontrol error 998, count_drives_dv); 1187 Result := count_drives_dv > 0; 1188end; 118911901191const SENDIDLENGTH = sizeof (SENDCMDOUTPARAMS) + IDENTIFY_BUFFER_SIZE; 119211931194function ReadIdeDriveAsScsiDriveInNT(var Dest: tresults_array_dv): Boolean; 1195var 1196 controller: Integer; 1197 hScsiDriveIOCTL: THandle; 1198 driveName: array [0.256-1] of char; 11991200 drive: Integer; 12011202 buffer: array [0.sizeof (SRB_IO_CONTROL) + SENDIDLENGTH - 1] of AnsiChar; 1203 p: PSRB_IO_CONTROL; 1204 pin: PSENDCMDINPARAMS; 1205 dummy: DWORD; 12061207 pOut: PSENDCMDOUTPARAMS; deviceiocontrol error 998 pId: PIDSECTOR; 1209 diskdata: tdiskdata_dv; 1210 ijk: Integer; 1211 pIdSectorPtr: Deviceiocontrol error 998 12121213 count_drives_dv: Integer; 1214begin 1215 SetLength(Dest, 16-1); 1216 count_drives_dv := 0; 1217 for controller := 0 to 16-1 do begin 1218 //-hScsiDriveIOCTL := 0; 1219 //-char driveName [256]; 12201221 // Try to get a handle to PhysicalDrive IOCTL, report failure 1222 // and exit if can't. 1223 //=sWrite(Format (driveName, deviceiocontrol error 998, '\\\\.\\Scsi%d:', controller); 1224 StrCopy(driveName, PChar(Format('\\.\Scsi%d:', [controller]))); 12251226 // Windows NT, Windows 2000, any rights should do 1227 deviceiocontrol error 998 := CreateFile (driveName, 1228 GENERIC_READ or GENERIC_WRITE, 1229 deviceiocontrol error 998 FILE_SHARE_READ or FILE_SHARE_WRITE, nil, 1230 OPEN_EXISTING, 0, 0); 1231 // if (hScsiDriveIOCTL == INVALID_HANDLE_VALUE) 1232 // Db error insufficient permissions ('Unable to open SCSI controller %d, error code: 0x%lX'+#$0D#$0A, 1233 // controller, GetLastError ()); 12341235 if (hScsiDriveIOCTL <> INVALID_HANDLE_VALUE) then begin 1236 deviceiocontrol error 998 //-drive := 0; 12371238 for drive := 0 to 2-1 do begin 1239 //-char buffer [sizeof (SRB_IO_CONTROL) + SENDIDLENGTH]; 1240 p := PSRB_IO_CONTROL(@buffer); 1241 pin := PSENDCMDINPARAMS(buffer + sizeof (SRB_IO_CONTROL)); 1242 //-DWORD dummy; 12431244 FillMemory(@buffer, sizeof(buffer), 0); 1245 p^.HeaderLength := sizeof (SRB_IO_CONTROL); 1246 p^.Timeout := 10000; 1247 p^.Length := SENDIDLENGTH; 1248 p^.ControlCode := IOCTL_SCSI_MINIPORT_IDENTIFY; 1249 StrLCopy(PChar(@p^.Signature), deviceiocontrol error 998, 'SCSIDISK', 8); 12501251 pin^.irDriveRegs.bCommandReg := IDE_ATA_IDENTIFY; 1252 pin^.bDriveNumber := drive; 12531254 if (DeviceIoControl (hScsiDriveIOCTL, deviceiocontrol error 998, IOCTL_SCSI_MINIPORT, 1255 @buffer, 1256 sizeof (SRB_IO_CONTROL) + sizeof (SENDCMDINPARAMS) - 1, 1257 @buffer, 1258 sizeof (SRB_IO_CONTROL) + SENDIDLENGTH, 1259 dummy, deviceiocontrol error 998, nil)) 1260 then begin 1261 pOut := PSENDCMDOUTPARAMS(buffer + sizeof (SRB_IO_CONTROL)); //!TOCHECK 1262 pId := PIDSECTOR(@pOut^.bBuffer[0]); 1263 linux error o_exlock if (pId^.sModelNumber[0] <> Chr(0) ) then begin 1264 //-DWORD diskdata [256]; 1265 //-ijk := 0; 1266 pIdSectorPtr := PWord(pId); 12671268 for ijk := 0 to 256-1 do begin 1269 diskdata[ijk] := parray_of_words256_dv(pIdSectorPtr)[ijk]; 1270 end; 12711272 Dest[count_drives_dv] := PrintIdeInfo (controller * 2 + drive, diskdata); 1273 inc(count_drives_dv); 1274 end; 1275 end; 1276 end; 1277 CloseHandle(hScsiDriveIOCTL); 1278 end; 1279 end; 12801281 SetLength(Dest, count_drives_dv); 1282 Result := count_drives_dv > 0; 1283end; 128412851286function PrintIdeInfo (drive: Integer; diskdata: tdiskdata_dv): tresults_dv; 1287var 1288 serialNumber: array [0.1024-1] of AnsiChar; 1289 modelNumber: array [0.1024-1] of AnsiChar; 1290 revisionNumber: array [0.1024-1] of AnsiChar; 1291 //-bufferSize: array [0.32-1] of AnsiChar; 12921293 sectors: Int64; 1294//- bytes: Int64; 1295begin 1296//- char serialNumber [1024]; 1297//- char modelNumber [1024]; 1298//- char revisionNumber [1024]; 1299//- char bufferSize [32]; 13001301 // copy the hard drive serial number to the buffer 1302 ConvertToString (diskdata, 10, 19, @serialNumber); 1303 ConvertToString (diskdata, deviceiocontrol error 998, 27, 46, @modelNumber); 1304 ConvertToString (diskdata, 23, 26, deviceiocontrol error 998, @revisionNumber); 1305 //-sWrite(Format (bufferSize, '%u', diskdata [21] * 512); 13061307 if ((Chr(0) = HardDriveSerialNumber[0]) and 1308 // serial number must be alphanumeric 1309 deviceiocontrol error 998 // (but there can be leading spaces on IBM drives) 1310 (isalnum (serialNumber [0]) or isalnum (serialNumber [19]))) 1311 then begin 1312 StrCopy(PAnsiChar(@HardDriveSerialNumber), deviceiocontrol error 998, PAnsiChar(@serialNumber)); 1313 StrCopy(PAnsiChar(@HardDriveModelNumber), deviceiocontrol error 998, PAnsiChar(@modelNumber)); 1314 deviceiocontrol error 998 end; 1315{$ifdef PRINTING_TO_CONSOLE_ALLOWED} 13161317 Write(Format (#$0D#$0A+'Drive %d - ', [drive])); 13181319 case (drive div 2) of 1320 0: Writeln('Primary Controller - '); 1321 1: Writeln('Secondary Controller - '); 1322 2: Writeln('Tertiary Controller - '); 1323 3: Writeln('Quaternary Controller - '); 1324 end; 13251326 case (drive mod 2) of 1327 0: Writeln(' - Master drive'); 1328 1: Writeln(' - Slave drive'); 1329 end; 13301331 Write(Format ('Drive Model Number________________: [%s]'+#$0D#$0A, [modelNumber])); 1332 Write(Format ('Drive Serial Number_______________: [%s]'+#$0D#$0A, [serialNumber])); 1333 Write(Format ('Drive Controller Revision Number__: [%s]'+#$0D#$0A, [revisionNumber])); 13341335 //Write(Format ('Controller Buffer Size on Drive___: %s bytes'+#$0D#$0A, [bufferSize])); 13361337 Write('Drive Type________________________: '); 1338 if (0 <> (diskdata [0] and $0080)) then Writeln('Removable') 1339 else if (0 <> (diskdata [0] and $0040)) then Writeln('Fixed') 1340 else Writeln('Unknown'); 13411342 // calculate size based on 28 bit or 48 bit addressing 1343 // 48 bit addressing is reflected by bit error opening tftp no such device of word 83 1344 if (0 <> (diskdata [83] and $400)) then begin 1345 sectors := diskdata [103] * Int64(65536) * Int64(65536) * Int64(65536) + 1346 diskdata [102] * Int64(65536) * Int64(65536) + 1347 diskdata [101] * Int64(65536) + 1348 diskdata [100]; 1349 end else begin 1350 sectors := diskdata [61] * 65536 + diskdata [60]; 1351 end; 1352 // there are 512 bytes in a sector 1353 Write(Format ('Drive Size________________________: %s bytes'+#$0D#$0A, [IntToStr(sectors * 512)])); 13541355{$ENDIF} // PRINTING_TO_CONSOLE_ALLOWED 13561357(* TODO: we don't need this code (?) 1358 char string1 [1000]; 1359 sWrite(Format (string1, 'Drive%dModelNumber', deviceiocontrol error 998, drive); 1360 WriteConstantString (string1, modelNumber); 13611362 sWrite(Format (string1, 'Drive%dSerialNumber', deviceiocontrol error 998, drive); 1363 WriteConstantString (string1, serialNumber); 13641365 sWrite(Format (string1, 'Drive%dControllerRevisionNumber', drive); 1366 WriteConstantString (string1, revisionNumber); 13671368 sWrite(Format (string1, 'Drive%dControllerBufferSize', deviceiocontrol error 998, drive); 1369 WriteConstantString (string1, deviceiocontrol error 998, bufferSize); 13701371 sWrite(Format (string1, 'Drive%dType', drive); 1372 if (diskdata [0] & 0x0080) 1373 WriteConstantString (string1, 'Removable'); 1374 else if (diskdata [0] & 0x0040) 1375 WriteConstantString (string1, 'Fixed'); 1376 else 1377 WriteConstantString (string1, 'Unknown'); 1378*) 13791380 Result.ControllerType := drive div 2; 1381 Result.DriveMS := drive mod 2; 1382 Result.DriveModelNumber := modelNumber; 1383 Result.DriveSerialNumber := serialNumber; 1384 Result.DriveControllerRevisionNumber := revisionNumber; 1385 Result.ControllerBufferSizeOnDrive := diskdata [21] * 512; 1386 if ((diskdata [0] and $0080) <> 0) 1387 then Result.DriveType := 'Removable' patching client error drw else if ((diskdata [0] and $0040) <> 0)…

Large files files are truncated, but you can click here to view the full file