From dc823ae771a34f802f71dd7419aa7037741c5bfa Mon Sep 17 00:00:00 2001 From: Mister Smoer Date: Tue, 22 Aug 2023 02:54:06 +0200 Subject: [PATCH] don't break and add default value for windows --- src/windows/list.cpp | 5 +++-- tests/drivelist.spec.ts | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/windows/list.cpp b/src/windows/list.cpp index 59e3c19..f5dbe8c 100644 --- a/src/windows/list.cpp +++ b/src/windows/list.cpp @@ -673,6 +673,7 @@ bool GetDetailData(DeviceDescriptor* device, device->isReadOnly = !isWritable; + device->attachTimestamp = NULL; const int64_t UNIX_TIME_START= 0x019DB1DED53E8000; const int64_t TICKS_PER_SECOND = 10000000; DWORD requiredSize; @@ -685,9 +686,9 @@ bool GetDetailData(DeviceDescriptor* device, errorCode = GetLastError(); device->error = "Couldn't SetupDiGetDeviceInterfaceDetailW: Error " + std::to_string(errorCode); - result = false; + //result = false; //TOOD is it right to break here? - break; + //break; } FILETIME filetime; LARGE_INTEGER li; diff --git a/tests/drivelist.spec.ts b/tests/drivelist.spec.ts index e14ecdb..0bfbf4d 100644 --- a/tests/drivelist.spec.ts +++ b/tests/drivelist.spec.ts @@ -84,6 +84,10 @@ describe('Drivelist', () => { device.isUAS === null || typeof device.isUAS === 'boolean', `Invalid isUAS flag: ${device.isUAS}`, ); + ok( + device.attachTimestamp === null || Number.isFinite(device.attachTimestamp), + `Invalid attachTimestamp: ${device.attachTimestamp}`, + ); }); });