From 870443e20383b2fbdf5b72bc981bc89d0f2ed55e Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 11 Apr 2021 02:51:30 +0100 Subject: [PATCH] Detect Microsoft C in 16-bit OS/2 and use different PFSINFO structure format to retrieve volume serial number. --- setter/src/os2/volume.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/setter/src/os2/volume.c b/setter/src/os2/volume.c index e783ce8..ff853a9 100644 --- a/setter/src/os2/volume.c +++ b/setter/src/os2/volume.c @@ -121,8 +121,13 @@ void GetVolumeInfo(const char* path, size_t* clusterSize) if(rc) log_write("Error %d requesting volume information.\n", rc); else { +#ifdef _MSC_VER + usVolSerialHigh = (USHORT)(pfsInfo->ulVSN >> 16); + usVolSerialLow = (USHORT)(pfsInfo->ulVSN & 0xFFFF); +#else usVolSerialHigh = *((PUSHORT)&pfsInfo->ftimeCreation); usVolSerialLow = *((PUSHORT)&pfsInfo->fdateCreation); +#endif log_write("\tVolume label: %s\n", pfsInfo->vol.szVolLabel); log_write("\tVolume created on %04X:%04X\n", usVolSerialHigh, usVolSerialLow); }