Share your advanced PureBasic knowledge/code with the community.
doctorized
Addict
Posts: 882 Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece
Post
by doctorized » Thu Sep 18, 2014 6:50 pm
@IdeasVacuum: test this please and post the data returned. Admin rights are needed.
Code: Select all
Structure DeviceData
GeneralConfiguration.w; ; 0
LogicalCylinders.w; ; 1 Obsolete
SpecificConfiguration.w; ; 2
LogicalHeads.w; ; 3 Obsolete
Retired1.w[2]; ; 4-5
LogicalSectors.w; ; 6 Obsolete
ReservedForCompactFlash.l; ; 7-8
Retired2.w; ; 9
SerialNumber.a[20]; ; 10-19
Retired3.w; ; 20
BufferSize.w; ; 21 Obsolete
ECCSize.w; ; 22
FirmwareRev.a[8]; ; 23-26
ModelNumber.a[40]; ; 27-46
MaxNumPerInterupt.w; ; 47
Reserved1.w; ; 48
Capabilities1.w; ; 49
Capabilities2.w; ; 50
Obsolute5.l; ; 51-52
Field88and7064.w; ; 53
Obsolute6.w[5]; ; 54-58
MultSectorStuff.w; ; 59
TotalAddressableSectors.l; ; 60-61
Obsolute7.w; ; 62
MultiWordDma.w; ; 63
PioMode.w; ; 64
MinMultiwordDmaCycleTime.w; ; 65
RecommendedMultiwordDmaCycleTime.w; ; 66
MinPioCycleTimewoFlowCtrl.w; ; 67
MinPioCycleTimeWithFlowCtrl.w; ; 68
Reserved2.w[6]; ; 69-74
QueueDepth.w; ; 75
SerialAtaCapabilities.w; ; 76
ReservedForFutureSerialAta.w; ; 77
SerialAtaFeaturesSupported.w; ; 78
SerialAtaFeaturesEnabled.w; ; 79
MajorVersion.w; ; 80
MinorVersion.w; ; 81
CommandSetSupported1.w; ; 82
CommandSetSupported2.w; ; 83
CommandSetSupported3.w; ; 84
CommandSetEnabled1.w; ; 85
CommandSetEnabled2.w; ; 86
CommandSetDefault.w; ; 87
UltraDmaMode.w; ; 88
TimeReqForSecurityErase.w; ; 89
TimeReqForEnhancedSecure.w; ; 90
CurrentPowerManagement.w; ; 91
MasterPasswordRevision.w; ; 92
HardwareResetResult.w; ; 93
Acoustricmanagement.w; ; 94
StreamMinRequestSize.w; ; 95
StreamingTimeDma.w; ; 96
StreamingAccessLatency.w; ; 97
StreamingPerformance.l; ; 98-99
MaxUserLba.q; ; 100-103
StremingTimePio.w; ; 104
Reserved3.w; ; 105
SectorSize.w; ; 106
InterSeekDelay.w; ; 107
IeeeOui.w; ; 108
UniqueId3.w; ; 109
UniqueId2.w; ; 110
UniqueId1.w; ; 111
Reserved4.w[4]; ; 112-115
Reserved5.w; ; 116
WordsPerLogicalSector.l; ; 117-118
Reserved6.w[8]; ; 119-126
RemovableMediaStatus.w; ; 127
SecurityStatus.w; ; 128
VendorSpecific.w[31]; ; 129-159
CfaPowerMode1.w; ; 160
Reserved7.w[7]; ; 161-167
DeviceNominalFormFactor.w; ; 168
DataSetManagement.w; ; 169
AdditionalProductIdentifier.w[4] ; 170-173
ReservedForCompactFlashAssociation.w[2]; 174-175
CurrentMediaSerialNo.a[60]; ; 176-205
SctCommandTransport.w; ; 206 254
ReservedForCeAta1.w[2]; ; 207-208
AlignmentOfLogicalBlocks.w; ; 209
WriteReadVerifySectorCountMode3.l; ; 210-211
WriteReadVerifySectorCountMode2.l; ; 212-213
NvCacheCapabilities.w; ; 214
NvCacheSizeLogicalBlocks.l; ; 215-216
NominalMediaRotationRate.w; ; 217
Reserved8.w; ; 218
NvCacheOptions1.w; ; 219
NvCacheOptions2.w; ; 220
Reserved9.w; ; 221
TransportMajorVersionNumber.w; ; 222
TransportMinorVersionNumber.w; ; 223
ReservedForCeAta2.w[10]; ; 224-233
MinimumBlocksPerDownloadMicrocode.w; ; 234
MaximumBlocksPerDownloadMicrocode.w; ; 235
Reserved10.w[19]; ; 236-254
IntegrityWord.w; ; 255
EndStructure
Structure t_SPTD
Length.w ; data len
ScsiStatus.a ; SCSI Status
PathId.a ; Bus Number
TargetId.a ; Target
Lun.a ; Logical Unit Number
CdbLength.a ; CDB (Command Descriptor Block)
SenseInfoLength.a ; Sense Info len
DataIn.a ; data direction
padding0.a[3]
DataTransferLength.l ; data transfer length
TimeOutValue.i ; command timeout
DataBufferOffset.i ; Pointer to the data buffer
SenseInfoOffset.l ; Sense Info Offset
Cdb.a[16] ; Command Descriptor Block
CompilerIf #PB_Compiler_Processor = #PB_Processor_x64
Fill.a[4] ;
CompilerEndIf
EndStructure
Structure t_SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER
spt.t_SPTD ; SPTD structure
;Fill.l ;
SenseBuffer.a[32] ; Debugging-Info from the drive
DataBuffer.a[512]
EndStructure
pswb.t_SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER: OL.OVERLAPPED
Length.l: returned.l: i.l
status.l
With pswb\spt
\length = SizeOf(t_SPTD) ; size of the substructure
\PathId = 0
\TargetId = 0
\Lun = 0
\DataIn = 1 ; data dir
\TimeOutValue = 2 ; Timeout
\senseInfoLength = 24;SizeOf(pswb\SenseBuffer)-1 ; Sense Info size
\senseInfoOffset = OffsetOf(t_SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER\SenseBuffer) ; Sense Info Offset
\DataTransferLength = 512 ; data len
\DataBufferOffset = OffsetOf(t_SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER\DataBuffer) ; data buffer pointer
\Cdb[0] = $A1
\Cdb[1] = (4 << 1) | 0
\Cdb[2] = (1 << 3) | (1 << 2) | 2
\Cdb[3] = 0
;\Cdb[4] = 1
;\Cdb[5] = 0
;\Cdb[6] = 0
\Cdb[7] = 0
\Cdb[8] = $A0
\Cdb[9] = $EC;7
\CdbLength = 12 ; CDB len
EndWith
Length = OffsetOf(t_SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER\DataBuffer) + pswb\spt\DataTransferLength;;SizeOf(pswb) ; size of the structure
hdh = CreateFile_("\\.\PhysicalDrive2",#GENERIC_READ | #GENERIC_WRITE, #FILE_SHARE_READ | #FILE_SHARE_WRITE,0, #OPEN_EXISTING, 0, 0)
status = DeviceIoControl_(hdh, $4d004, @pswb, SizeOf(t_SPTD), @pswb, Length, @returned, @OL)
CloseHandle_(hdh)
Debug GetLastError_()
Debug returned
ShowMemoryViewer(@pswb,SizeOf(DeviceData))
;CallDebugger
;dev_data.DeviceData
;CopyMemory(@pswb\DataBuffer,@dev_data,SizeOf(t_SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER))
;Debug SizeOf(t_SPTD)
;ShowMemoryViewer(@dev_data,SizeOf(DeviceData))
Last edited by
doctorized on Fri Sep 19, 2014 1:38 pm, edited 2 times in total.
IdeasVacuum
Always Here
Posts: 6426 Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:
Post
by IdeasVacuum » Thu Sep 18, 2014 8:14 pm
...the Procedure test() is missing.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
minimy
Enthusiast
Posts: 556 Joined: Mon Jul 08, 2013 8:43 pm
Location: off world
Post
by minimy » Thu Sep 18, 2014 9:38 pm
IdeasVacuum wrote: ...the Procedure test() is missing.
Me too!
Missing Test() procedure.
Greeting!
If translation =Error : reply ="Sorry, Im Sp ani sh " : Endif
doctorized
Addict
Posts: 882 Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece
Post
by doctorized » Fri Sep 19, 2014 1:28 pm
My mistake. Test() is not necessary. Just delete it. I updated the code.
You just need:
Code: Select all
status = DeviceIoControl_(hdh, $4d004, @pswb, SizeOf(t_SPTD), @pswb, Length, @returned, @OL)
Do not forget to change the number in
"\\.\PhysicalDrive2" to your own disk number. I have two internals and this drive so it is drive #2. Change that number if needed.
I would recommend to wait a little as I will post a new updated code in a while and your drives may be detected then.
doctorized
Addict
Posts: 882 Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece
Post
by doctorized » Fri Sep 19, 2014 2:34 pm
Run this and post the file created. Admin rights are needed. Do not forget to change the number in
"\\.\PhysicalDrive2" to your own disk number.
Code: Select all
Structure DeviceData
GeneralConfiguration.w; ; 0
LogicalCylinders.w; ; 1 Obsolete
SpecificConfiguration.w; ; 2
LogicalHeads.w; ; 3 Obsolete
Retired1.w[2]; ; 4-5
LogicalSectors.w; ; 6 Obsolete
ReservedForCompactFlash.l; ; 7-8
Retired2.w; ; 9
SerialNumber.a[20]; ; 10-19
Retired3.w; ; 20
BufferSize.w; ; 21 Obsolete
ECCSize.w; ; 22
FirmwareRev.a[8]; ; 23-26
ModelNumber.a[40]; ; 27-46
MaxNumPerInterupt.w; ; 47
Reserved1.w; ; 48
Capabilities1.w; ; 49
Capabilities2.w; ; 50
Obsolute5.l; ; 51-52
Field88and7064.w; ; 53
Obsolute6.w[5]; ; 54-58
MultSectorStuff.w; ; 59
TotalAddressableSectors.l; ; 60-61
Obsolute7.w; ; 62
MultiWordDma.w; ; 63
PioMode.w; ; 64
MinMultiwordDmaCycleTime.w; ; 65
RecommendedMultiwordDmaCycleTime.w; ; 66
MinPioCycleTimewoFlowCtrl.w; ; 67
MinPioCycleTimeWithFlowCtrl.w; ; 68
Reserved2.w[6]; ; 69-74
QueueDepth.w; ; 75
SerialAtaCapabilities.w; ; 76
ReservedForFutureSerialAta.w; ; 77
SerialAtaFeaturesSupported.w; ; 78
SerialAtaFeaturesEnabled.w; ; 79
MajorVersion.w; ; 80
MinorVersion.w; ; 81
CommandSetSupported1.w; ; 82
CommandSetSupported2.w; ; 83
CommandSetSupported3.w; ; 84
CommandSetEnabled1.w; ; 85
CommandSetEnabled2.w; ; 86
CommandSetDefault.w; ; 87
UltraDmaMode.w; ; 88
TimeReqForSecurityErase.w; ; 89
TimeReqForEnhancedSecure.w; ; 90
CurrentPowerManagement.w; ; 91
MasterPasswordRevision.w; ; 92
HardwareResetResult.w; ; 93
Acoustricmanagement.w; ; 94
StreamMinRequestSize.w; ; 95
StreamingTimeDma.w; ; 96
StreamingAccessLatency.w; ; 97
StreamingPerformance.l; ; 98-99
MaxUserLba.q; ; 100-103
StremingTimePio.w; ; 104
Reserved3.w; ; 105
SectorSize.w; ; 106
InterSeekDelay.w; ; 107
IeeeOui.w; ; 108
UniqueId3.w; ; 109
UniqueId2.w; ; 110
UniqueId1.w; ; 111
Reserved4.w[4]; ; 112-115
Reserved5.w; ; 116
WordsPerLogicalSector.l; ; 117-118
Reserved6.w[8]; ; 119-126
RemovableMediaStatus.w; ; 127
SecurityStatus.w; ; 128
VendorSpecific.w[31]; ; 129-159
CfaPowerMode1.w; ; 160
Reserved7.w[7]; ; 161-167
DeviceNominalFormFactor.w; ; 168
DataSetManagement.w; ; 169
AdditionalProductIdentifier.w[4] ; 170-173
ReservedForCompactFlashAssociation.w[2]; 174-175
CurrentMediaSerialNo.a[60]; ; 176-205
SctCommandTransport.w; ; 206 254
ReservedForCeAta1.w[2]; ; 207-208
AlignmentOfLogicalBlocks.w; ; 209
WriteReadVerifySectorCountMode3.l; ; 210-211
WriteReadVerifySectorCountMode2.l; ; 212-213
NvCacheCapabilities.w; ; 214
NvCacheSizeLogicalBlocks.l; ; 215-216
NominalMediaRotationRate.w; ; 217
Reserved8.w; ; 218
NvCacheOptions1.w; ; 219
NvCacheOptions2.w; ; 220
Reserved9.w; ; 221
TransportMajorVersionNumber.w; ; 222
TransportMinorVersionNumber.w; ; 223
ReservedForCeAta2.w[10]; ; 224-233
MinimumBlocksPerDownloadMicrocode.w; ; 234
MaximumBlocksPerDownloadMicrocode.w; ; 235
Reserved10.w[19]; ; 236-254
IntegrityWord.w; ; 255
EndStructure
Structure t_SPTD
Length.w ; data len
ScsiStatus.a ; SCSI Status
PathId.a ; Bus Number
TargetId.a ; Target
Lun.a ; Logical Unit Number
CdbLength.a ; CDB (Command Descriptor Block)
SenseInfoLength.a ; Sense Info len
DataIn.a ; data direction
padding0.a[3]
DataTransferLength.l ; data transfer length
TimeOutValue.i ; command timeout
DataBufferOffset.i ; Pointer to the data buffer
SenseInfoOffset.l ; Sense Info Offset
Cdb.a[16] ; Command Descriptor Block
CompilerIf #PB_Compiler_Processor = #PB_Processor_x64
Fill.a[4] ;
CompilerEndIf
EndStructure
Structure t_SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER
spt.t_SPTD ; SPTD structure
;Fill.l ;
SenseBuffer.a[32] ; Debugging-Info from the drive
DataBuffer.a[512]
EndStructure
Global Dim cmd.a(16);command bytes 0-15 and byte 16 is length.
Procedure HDD_SPTD()
pswb.t_SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER: OL.OVERLAPPED
Length.l: returned.l: i.l
status.l
With pswb\spt
\length = SizeOf(t_SPTD) ; size of the substructure
\PathId = 0
\TargetId = 0
\Lun = 0
\DataIn = 1 ; data dir
\TimeOutValue = 2 ; Timeout
\senseInfoLength = 24;SizeOf(pswb\SenseBuffer)-1 ; Sense Info size
\senseInfoOffset = OffsetOf(t_SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER\SenseBuffer) ; Sense Info Offset
\DataTransferLength = 512 ; data len
\DataBufferOffset = OffsetOf(t_SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER\DataBuffer) ; data buffer pointer
\Cdb[0] = cmd(0)
\Cdb[1] = cmd(1)
\Cdb[2] = cmd(2)
\Cdb[3] = cmd(3)
\Cdb[4] = cmd(4)
\Cdb[5] = cmd(5)
\Cdb[6] = cmd(6)
\Cdb[7] = cmd(7)
\Cdb[8] = cmd(8)
\Cdb[9] = cmd(9)
\Cdb[10] = cmd(10)
\Cdb[11] = cmd(11)
\Cdb[12] = cmd(12)
\CdbLength = CMD(16) ; CDB len
EndWith
Length = OffsetOf(t_SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER\DataBuffer) + pswb\spt\DataTransferLength;;SizeOf(pswb) ; size of the structure
hdh = CreateFile_("\\.\PhysicalDrive2",#GENERIC_READ | #GENERIC_WRITE, #FILE_SHARE_READ | #FILE_SHARE_WRITE,0, #OPEN_EXISTING, 0, 0)
status = DeviceIoControl_(hdh, $4d004, @pswb, SizeOf(t_SPTD), @pswb, Length, @returned, @OL)
CloseHandle_(hdh)
i = OpenFile(#PB_Any,"c:\hdd data.txt")
FileSeek(i,Lof(i))
WriteStringN(i,"Command data:")
WriteStringN(i," 0 1 2 3 4 5 6 7 8 9 A B C D E F")
For ii=0 To 15
tmp.s + RSet(Hex(cmd(ii)),2,"0") + " "
Next
WriteStringN(i,tmp)
WriteStringN(i,"")
WriteStringN(i,"Bytes Returned: " + Str(returned))
WriteStringN(i," 0 1 2 3 4 5 6 7 8 9 A B C D E F")
tmp=""
For ii=0 To 512 Step 16
For iii = 0 To 15
tmp.s + RSet(Hex(PeekA(@pswb+ii+iii)),2,"0") + " "
Next
WriteStringN(i,tmp + PeekS(@pswb+ii,16,#PB_Ascii))
tmp=""
Next
WriteStringN(i,"")
CloseFile(i)
EndProcedure
; in every case, #1 and #2 of every command set, the difference is $A0 or $B0 passed in one byte. In my case it seems to have no difference.
;SAT 1
cmd(0) = $A1
cmd(1) = 8
cmd(2) = $E
cmd(3) = 0
cmd(7) = 0
cmd(8) = $A0
cmd(9) = $EC
cmd(16) = 12
HDD_SPTD()
;SAT 2
cmd(0) = $A1
cmd(1) = 8
cmd(2) = $E
cmd(3) = 0
cmd(7) = 0
cmd(8) = $B0
cmd(9) = $EC
cmd(16) = 12
HDD_SPTD()
;SUNPLUS 1
cmd(0) = $F8
cmd(1) = 0
cmd(2) = $22
cmd(3) = $10
cmd(4) = 0
cmd(5) = 0
cmd(6) = 1
cmd(7) = 0
cmd(8) = 0
cmd(9) = 0
cmd(10) = $A0
cmd(11) = $EC
cmd(16) = 12
HDD_SPTD()
;SUNPLUS 2
cmd(0) = $F8
cmd(1) = 0
cmd(2) = $22
cmd(3) = $10
cmd(4) = 0
cmd(5) = 0
cmd(6) = 1
cmd(7) = 0
cmd(8) = 0
cmd(9) = 0
cmd(10) = $B0
cmd(11) = $EC
cmd(16) = 12
HDD_SPTD()
;IO_DATA 1
cmd(0) = $E3
cmd(1) = 0
cmd(2) = 0
cmd(3) = 1
cmd(4) = 0
cmd(5) = 0
cmd(6) = 0
cmd(7) = $A0
cmd(8) = $EC
cmd(9) = 0
cmd(10) = 0
cmd(11) = 0
cmd(16) = 12
HDD_SPTD()
;IO_DATA 2
cmd(0) = $E3
cmd(1) = 0
cmd(2) = 0
cmd(3) = 1
cmd(4) = 0
cmd(5) = 0
cmd(6) = 0
cmd(7) = $B0
cmd(8) = $EC
cmd(9) = 0
cmd(10) = 0
cmd(11) = 0
cmd(16) = 12
HDD_SPTD()
;LOGITEC 1
cmd(0) = $E0
cmd(1) = 0
cmd(2) = 0
cmd(3) = 0
cmd(4) = 0
cmd(5) = 0
cmd(6) = 0
cmd(7) = $A0
cmd(8) = $EC
cmd(9) = $C
cmd(10) = 0
cmd(11) = 0
cmd(16) = 10
HDD_SPTD()
;LOGITEC 2
cmd(0) = $E0
cmd(1) = 0
cmd(2) = 0
cmd(3) = 0
cmd(4) = 0
cmd(5) = 0
cmd(6) = 0
cmd(7) = $B0
cmd(8) = $EC
cmd(9) = $C
cmd(10) = 0
cmd(11) = 0
cmd(16) = 10
HDD_SPTD()
;JMICRON 1
cmd(0) = $DF
cmd(1) = $10
cmd(2) = 0
cmd(3) = 2
cmd(4) = 0
cmd(5) = 0
cmd(6) = 1
cmd(7) = 0
cmd(8) = 0
cmd(9) = 0
cmd(10) = $A0
cmd(11) = $EC
cmd(16) = 12
HDD_SPTD()
;JMICRON 2
cmd(0) = $DF
cmd(1) = $10
cmd(2) = 0
cmd(3) = 2
cmd(4) = 0
cmd(5) = 0
cmd(6) = 1
cmd(7) = 0
cmd(8) = 0
cmd(9) = 0
cmd(10) = $B0
cmd(11) = $EC
cmd(16) = 12
HDD_SPTD()
;CYPRESS 1
cmd(0) = $24
cmd(1) = $24
cmd(2) = 0
cmd(3) = $BE
cmd(4) = 0
cmd(5) = 0
cmd(6) = 0
cmd(7) = 1
cmd(8) = 0
cmd(9) = 0
cmd(10) = 0
cmd(11) = $A0
cmd(12) = $EC
cmd(16) = 16
HDD_SPTD()
;CYPRESS 2
cmd(0) = $24
cmd(1) = $24
cmd(2) = 0
cmd(3) = $BE
cmd(4) = 0
cmd(5) = 0
cmd(6) = 0
cmd(7) = 1
cmd(8) = 0
cmd(9) = 0
cmd(10) = 0
cmd(11) = $B0
cmd(12) = $EC
cmd(16) = 16
HDD_SPTD()
Debug "OK"
doctorized
Addict
Posts: 882 Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece
Post
by doctorized » Mon Sep 22, 2014 1:45 pm
Do not forget to test the above code!!
IdeasVacuum
Always Here
Posts: 6426 Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:
Post
by IdeasVacuum » Tue Sep 23, 2014 12:43 am
Well, you have lost me there because I do not know what exactly "\\.\PhysicalDrive2" represents, or what that API CreateFile_() function is going to do or how safe it is to run your code.....
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
doctorized
Addict
Posts: 882 Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece
Post
by doctorized » Tue Sep 23, 2014 12:48 pm
IdeasVacuum wrote: Well, you have lost me there because I do not know what exactly "\\.\PhysicalDrive2" represents, or what that API CreateFile_() function is going to do or how safe it is to run your code.....
From
http://msdn.microsoft.com/en-us/library ... 85%29.aspx :
Another example of using the Win32 device namespace is using the CreateFile function with "\\.\PhysicalDiskX" (where X is a valid integer value) or "\\.\CdRomX". This allows you to access those devices directly, bypassing the file system. This works because these device names are created by the system as these devices are enumerated, and some drivers will also create other aliases in the system. For example, the device driver that implements the name "C:\" has its own namespace that also happens to be the file system.
APIs that go through the CreateFile function generally work with the "\\.\" prefix because CreateFile is the function used to open both files and devices, depending on the parameters you use.
If you're working with Windows API functions, you should use the "\\.\" prefix to access devices only and not files.
In other words, we take handle of the drive (we say the OS we want to 'talk' to the specified physical drive and we take a number as handle to do the 'interrogation') and then we tell the drive to send as the data we need. It is read-only operation so it is harmless.
Let me say that I was surprised to read such a line from someone that is programming for at least 5 years and has 4187 posts in this forum...
IdeasVacuum
Always Here
Posts: 6426 Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:
Post
by IdeasVacuum » Tue Sep 23, 2014 10:41 pm
.... Well, nobody knows everything! Most of my posts are asking questions, not answering them, though of course I have helped others along the way. I was concerned too that others trying to help you could end up harming the data stored on their drives (so many people out there with only one drive and no backups). "\\.\PhysicalDiskX" was a conundrum because I didn't know what each drive's number was in this context.
hdd data.txt
...I've been writing programs for nearly 40 years now
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
doctorized
Addict
Posts: 882 Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece
Post
by doctorized » Wed Sep 24, 2014 1:31 pm
Your file tells a lot. First of all you must have 5 hard drives and your Seagate Barracuda 7200.11 is the sixth drive, external one. The code detectes the drive successfully and retrieves 588 bytes. I know that they are some drives that cannot be detected, like my Transcend 80GB USB drive. I keep on search for a way to solve the problem. I made a thought, to use this code:
Code: Select all
For b0 = 0 To 10
Debug "b0 = " +Str(b0)
For b1 = 0 To $ff
Debug " b1 = " +Str(b1)
For b2 = 0 To $ff
Debug " b2 = " +Str(b2)
For b3 = 0 To $ff
Debug " b3 = " +Str(b3)
For b4 = 0 To $ff
Debug " b4 = " +Str(b4)
For b5 = 0 To $ff
Debug " b5 = " +Str(b5)
For b6 = 0 To $ff
Debug " b6 = " +Str(b6)
For b7 = 0 To $ff
For b8 = 0 To $ff
For b9 = 0 To $ff
For b10 = 0 To $ff
For b11 = 0 To $ff
For b12 = 0 To $ff
cmd(0) = b0
cmd(1) = b1
cmd(2) = b2
cmd(3) = b3
cmd(4) = b4
cmd(5) = b5
cmd(6) = b6
cmd(7) = b7
cmd(8) = b8
cmd(9) = b9
cmd(10) = b10
cmd(11) = b11
cmd(12) = b12
cmd(16) = 12
HDD_SPTD()
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
but this code will never come to an end. So, I keep on searching....
Thanks a lot for your help. I apologize if I was impolite with you. There was no intention.
EDIT: What is the second external drive? What is your OS?
IdeasVacuum
Always Here
Posts: 6426 Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:
Post
by IdeasVacuum » Wed Sep 24, 2014 3:10 pm
It is a difficult task for sure. This PC is WinXP x86. There are 4 internal drives, 2 external drives.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
doctorized
Addict
Posts: 882 Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece
Post
by doctorized » Wed Sep 24, 2014 4:03 pm
IdeasVacuum wrote: It is a difficult task for sure. This PC is WinXP x86. There are 4 internal drives, 2 external drives.
One external drive is Seagate Barracuda 7200.11. What is the other one?
IdeasVacuum
Always Here
Posts: 6426 Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:
Post
by IdeasVacuum » Wed Sep 24, 2014 4:15 pm
I don't know what Seagate family either external drive is based on. The external drive names are 'FreeAgent' and 'Expansion'
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
doctorized
Addict
Posts: 882 Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece
Post
by doctorized » Wed Sep 24, 2014 8:24 pm
IdeasVacuum wrote: I don't know what Seagate family either external drive is based on. The external drive names are 'FreeAgent' and 'Expansion'
OK. Tomorrow I will post my latest code. I try to do a very small tiny detect of flash drives too.
IdeasVacuum
Always Here
Posts: 6426 Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:
Post
by IdeasVacuum » Wed Sep 24, 2014 10:14 pm
Well here is some news - since running your code CreateFile_("\\.\PhysicalDrive2" etc, the OS cannot 'see' the Expansion drive, even after a re-boot. I didn't realise until my back-up failed because that is what the drive is for.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.