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); - } + }