From 3df30bbd047bec8470771136b75632a4623cacc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=B6glinger-Stelzer?= Date: Mon, 26 Jun 2023 10:15:41 +0200 Subject: [PATCH] Update SmartArrayControllerTool.cpp --- src/SmartArrayControllerTool.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/SmartArrayControllerTool.cpp b/src/SmartArrayControllerTool.cpp index ca495b4..fe2062d 100644 --- a/src/SmartArrayControllerTool.cpp +++ b/src/SmartArrayControllerTool.cpp @@ -139,18 +139,24 @@ int wmain(int argc, wchar_t* argv[]) sptwb.spt.Cdb[0] = 0x26; sptwb.spt.Cdb[6] = 0x11; - unsigned short bebufsize = htons(sizeof(id_ctlr)); - memcpy(&sptwb.spt.Cdb[7], &bebufsize, 2); + const unsigned short reqSize = htons(sizeof(id_ctlr)); + memcpy(&sptwb.spt.Cdb[7], &reqSize, 2); length = offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS, ucDataBuf) + sptwb.spt.DataTransferLength; + std::wcout << std::dec + << L"Total struct size: " << sizeof(SCSI_PASS_THROUGH_WITH_BUFFERS) + << L", Calculated length: " << length + << L", Header length: " << sptwb.spt.Length + << std::endl; + BOOL ret = DeviceIoControl( handle, IOCTL_SCSI_PASS_THROUGH, &sptwb, sizeof(SCSI_PASS_THROUGH) + sptwb.spt.SenseInfoLength, &sptwb, - sizeof(SCSI_PASS_THROUGH_WITH_BUFFERS), + length, &returned, NULL ); @@ -261,4 +267,4 @@ int wmain(int argc, wchar_t* argv[]) #endif CloseHandle(handle); - } + }