From fd46e60681fa215d0188aabf64d47acd0b03533a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=B6glinger-Stelzer?= Date: Sun, 25 Jun 2023 20:11:31 +0200 Subject: [PATCH] Style fix --- .../SmartArrayControllerTool.cpp | 62 ++++++++++++++++--- 1 file changed, 53 insertions(+), 9 deletions(-) diff --git a/SmartArrayControllerTool/SmartArrayControllerTool.cpp b/SmartArrayControllerTool/SmartArrayControllerTool.cpp index 4067280..982ac92 100644 --- a/SmartArrayControllerTool/SmartArrayControllerTool.cpp +++ b/SmartArrayControllerTool/SmartArrayControllerTool.cpp @@ -118,6 +118,49 @@ int wmain(int argc, wchar_t* argv[]) std::wcout << L"Successfully opened device " << deviceName << std::endl; + ULONG length = 0, returned = 0; + SCSI_PASS_THROUGH_WITH_BUFFERS sptwb; + + ZeroMemory(&sptwb, sizeof(SCSI_PASS_THROUGH_WITH_BUFFERS)); + sptwb.spt.Length = sizeof(SCSI_PASS_THROUGH); + sptwb.spt.PathId = 0; + sptwb.spt.TargetId = 0; + sptwb.spt.Lun = 0; + sptwb.spt.CdbLength = CDB6GENERIC_LENGTH; + sptwb.spt.SenseInfoLength = SPT_SENSE_LENGTH; + sptwb.spt.DataIn = SCSI_IOCTL_DATA_IN; + sptwb.spt.DataTransferLength = 192; + sptwb.spt.TimeOutValue = 2; + sptwb.spt.DataBufferOffset = offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS, ucDataBuf); + sptwb.spt.SenseInfoOffset = offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS, ucSenseBuf); + sptwb.spt.Cdb[0] = SCSIOP_MODE_SENSE; + sptwb.spt.Cdb[2] = MODE_SENSE_RETURN_ALL; + sptwb.spt.Cdb[4] = 192; + + length = offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS, ucDataBuf) + sptwb.spt.DataTransferLength; + + BOOL ret = DeviceIoControl( + handle, + IOCTL_SCSI_PASS_THROUGH, + &sptwb, + sizeof(SCSI_PASS_THROUGH), + &sptwb, + length, + &returned, + NULL + ); + + if (ret) + { + std::wcout << L"Request succeeded" << std::endl; + std::wcout << std::endl; + } + else + { + std::wcerr << L"Failed to send request, error: 0x" << std::hex << GetLastError() << std::endl; + } + +#ifdef ACU_REPLAY UCHAR request01[] = { #include "request01.bin" @@ -137,47 +180,47 @@ int wmain(int argc, wchar_t* argv[]) { #include "request04.bin" }; - + UCHAR request05[] = { #include "request05.bin" }; - + UCHAR request06[] = { #include "request06.bin" }; - + UCHAR request07[] = { #include "request07.bin" }; - + UCHAR request08[] = { #include "request08.bin" }; - + UCHAR request09[] = { #include "request09.bin" }; - + UCHAR request10[] = { #include "request10.bin" }; - + UCHAR request11[] = { #include "request11.bin" }; - + UCHAR request12[] = { #include "request12.bin" }; - + UCHAR request13[] = { #include "request13.bin" @@ -196,6 +239,7 @@ int wmain(int argc, wchar_t* argv[]) SendScsiMiniportRequest(handle, request11, ARRAYSIZE(request11)); SendScsiMiniportRequest(handle, request12, ARRAYSIZE(request12)); SendScsiMiniportRequest(handle, request13, ARRAYSIZE(request13)); +#endif CloseHandle(handle); }