Hey Merrion,
You got it! But didn't....
I simply changed the vbNull to 0 and BOOM, my device handle is returned!
So I was very happy for a second until I then tried to move the file pointer using SetFilePointer() and got the same error!
VB Code:
<DllImport("kernel32.dll")> _ Public Function SetFilePointer( _ ByVal hFile As Long, _ ByVal lDistanceToMove As Long, _ ByVal lpDistanceToMoveHigh As Long, _ ByVal dwMoveMethod As Long) As Long End Function Public Const FILE_BEGIN As Long = 0 Public Const FILE_EOF As Long = &HFFFFFFFF
Used like so:
VB Code:
If SetFilePointer(hDevice, (iSectorSize * iSectorNumber), 0, FILE_BEGIN) = FILE_EOF Then MessageBox.Show("Unable to find sector " & iSectorNumber, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Return baDataBuffer End If
This threw the same "Attempted to read or write....." error. Hmmmmmm
Thanks Merrion,
Matt.




Reply With Quote