From 30aa1cf2fe5333e6ac5fa660545777887a01fb49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=B6glinger-Stelzer?= Date: Mon, 26 Jun 2023 09:38:44 +0200 Subject: [PATCH] Update SmartArrayControllerTool.cpp --- .../SmartArrayControllerTool.cpp | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/SmartArrayControllerTool/SmartArrayControllerTool.cpp b/SmartArrayControllerTool/SmartArrayControllerTool.cpp index 29be3a6..ca495b4 100644 --- a/SmartArrayControllerTool/SmartArrayControllerTool.cpp +++ b/SmartArrayControllerTool/SmartArrayControllerTool.cpp @@ -123,7 +123,7 @@ int wmain(int argc, wchar_t* argv[]) 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; @@ -148,7 +148,7 @@ int wmain(int argc, wchar_t* argv[]) handle, IOCTL_SCSI_PASS_THROUGH, &sptwb, - sizeof(SCSI_PASS_THROUGH), + sizeof(SCSI_PASS_THROUGH) + sptwb.spt.SenseInfoLength, &sptwb, sizeof(SCSI_PASS_THROUGH_WITH_BUFFERS), &returned, @@ -162,7 +162,21 @@ int wmain(int argc, wchar_t* argv[]) } else { - std::wcerr << L"Failed to send request, error: 0x" << std::hex << GetLastError() << std::endl; + const DWORD error = GetLastError(); + + std::wstring errorCode = L"Unknown"; + + switch (error) + { + case ERROR_IO_DEVICE: + errorCode = L"ERROR_IO_DEVICE"; + break; + case ERROR_INVALID_PARAMETER: + errorCode = L"ERROR_INVALID_PARAMETER"; + break; + } + + std::wcerr << L"Failed to send request, error: " << errorCode << std::endl; } #ifdef ACU_REPLAY @@ -247,4 +261,4 @@ int wmain(int argc, wchar_t* argv[]) #endif CloseHandle(handle); -} + }