mirror of
https://github.com/isar/libmdbx.git
synced 2025-06-05 17:12:42 +08:00
mdbx-windows: fix bootid
generation for case of change system' time.
This commit is contained in:
parent
28c36af67c
commit
0b120b8fa9
14
src/osal.c
14
src/osal.c
@ -2330,12 +2330,16 @@ __cold MDBX_INTERNAL_FUNC bin128_t mdbx_osal_bootid(void) {
|
|||||||
0x03 /* SystemTmeOfDayInformation */, &buf.SysTimeOfDayInfo,
|
0x03 /* SystemTmeOfDayInformation */, &buf.SysTimeOfDayInfo,
|
||||||
sizeof(buf.SysTimeOfDayInfo), &len);
|
sizeof(buf.SysTimeOfDayInfo), &len);
|
||||||
if (NT_SUCCESS(status) &&
|
if (NT_SUCCESS(status) &&
|
||||||
len >= offsetof(union buf, SysTimeOfDayInfoHacked.BootTime) +
|
len >= offsetof(union buf, SysTimeOfDayInfoHacked.BootTimeBias) +
|
||||||
sizeof(buf.SysTimeOfDayInfoHacked.BootTime) &&
|
sizeof(buf.SysTimeOfDayInfoHacked.BootTimeBias) &&
|
||||||
buf.SysTimeOfDayInfoHacked.BootTime.QuadPart) {
|
buf.SysTimeOfDayInfoHacked.BootTime.QuadPart) {
|
||||||
bootid_collect(&bin, &buf.SysTimeOfDayInfoHacked.BootTime,
|
const uint64_t UnbiasedBootTime =
|
||||||
sizeof(buf.SysTimeOfDayInfoHacked.BootTime));
|
buf.SysTimeOfDayInfoHacked.BootTime.QuadPart -
|
||||||
got_boottime = true;
|
buf.SysTimeOfDayInfoHacked.BootTimeBias;
|
||||||
|
if (UnbiasedBootTime) {
|
||||||
|
bootid_collect(&bin, &UnbiasedBootTime, sizeof(UnbiasedBootTime));
|
||||||
|
got_boottime = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!got_boottime) {
|
if (!got_boottime) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user