1
0

Getting closer

This commit is contained in:
Benjamin Höglinger-Stelzer 2023-06-25 20:36:13 +02:00
parent fd46e60681
commit 793d29683c

View File

@ -3,6 +3,7 @@
// //
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <Windows.h> #include <Windows.h>
#include <WinSock2.h>
#include <winioctl.h> #include <winioctl.h>
#include <ntddscsi.h> #include <ntddscsi.h>
#include <devioctl.h> #include <devioctl.h>
@ -13,6 +14,8 @@
#include <stdint.h> #include <stdint.h>
#include "ScsiStuff.h" #include "ScsiStuff.h"
#pragma comment(lib, "ws2_32")
// //
// STL // STL
// //
@ -120,22 +123,24 @@ int wmain(int argc, wchar_t* argv[])
ULONG length = 0, returned = 0; ULONG length = 0, returned = 0;
SCSI_PASS_THROUGH_WITH_BUFFERS sptwb; SCSI_PASS_THROUGH_WITH_BUFFERS sptwb;
ZeroMemory(&sptwb, sizeof(SCSI_PASS_THROUGH_WITH_BUFFERS)); ZeroMemory(&sptwb, sizeof(SCSI_PASS_THROUGH_WITH_BUFFERS));
sptwb.spt.Length = sizeof(SCSI_PASS_THROUGH); sptwb.spt.Length = sizeof(SCSI_PASS_THROUGH);
sptwb.spt.PathId = 0; sptwb.spt.PathId = 0;
sptwb.spt.TargetId = 0; sptwb.spt.TargetId = 0;
sptwb.spt.Lun = 0; sptwb.spt.Lun = 0;
sptwb.spt.CdbLength = CDB6GENERIC_LENGTH; sptwb.spt.CdbLength = 10;
sptwb.spt.SenseInfoLength = SPT_SENSE_LENGTH; sptwb.spt.SenseInfoLength = SPT_SENSE_LENGTH;
sptwb.spt.DataIn = SCSI_IOCTL_DATA_IN; sptwb.spt.DataIn = SCSI_IOCTL_DATA_IN;
sptwb.spt.DataTransferLength = 192; sptwb.spt.DataTransferLength = 192;
sptwb.spt.TimeOutValue = 2; sptwb.spt.TimeOutValue = 120;
sptwb.spt.DataBufferOffset = offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS, ucDataBuf); sptwb.spt.DataBufferOffset = offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS, ucDataBuf);
sptwb.spt.SenseInfoOffset = offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS, ucSenseBuf); sptwb.spt.SenseInfoOffset = offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS, ucSenseBuf);
sptwb.spt.Cdb[0] = SCSIOP_MODE_SENSE; sptwb.spt.Cdb[0] = 0x26;
sptwb.spt.Cdb[2] = MODE_SENSE_RETURN_ALL; sptwb.spt.Cdb[6] = 0x11;
sptwb.spt.Cdb[4] = 192;
unsigned short bebufsize = htons(sizeof(id_ctlr));
memcpy(&sptwb.spt.Cdb[7], &bebufsize, 2);
length = offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS, ucDataBuf) + sptwb.spt.DataTransferLength; length = offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS, ucDataBuf) + sptwb.spt.DataTransferLength;