[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [XENBUS PATCH v2 2/2] Be more tolerant of RealTimeIsUniversal values
On Mon, Aug 18, 2025 at 6:55 AM Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx> wrote:
Tolerate RealTimeIsUniversal having the REG_QWORD value type.
In addition, don't fail SystemInitialize when SystemGetTimeInformation
fails to read RealTimeIsUniversal as critical boot drivers (e.g. xenvbd)
may fail to load otherwise.
Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
v2: Log error code from SystemGetTimeInformation
---
src/xen/system.c | 41 +++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/src/xen/system.c b/src/xen/system.c
index 48f9af0..991ce4b 100644
--- a/src/xen/system.c
+++ b/src/xen/system.c
@@ -1183,7 +1183,8 @@ SystemGetTimeInformation(
PSYSTEM_CONTEXT Context = &SystemContext;
UNICODE_STRING Unicode;
HANDLE Key;
- ULONG RealTimeIsUniversal;
+ ULONG ValueDword;
+ ULONGLONG ValueQword;
NTSTATUS status;
RtlInitUnicodeString(&Unicode, L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation");
@@ -1192,27 +1193,30 @@ SystemGetTimeInformation(
if (!NT_SUCCESS(status))
goto fail1;
- status = RegistryQueryDwordValue(Key, "RealTimeIsUniversal",
- &RealTimeIsUniversal);
- if (!NT_SUCCESS(status)) {
- if (status != STATUS_OBJECT_NAME_NOT_FOUND)
- goto fail2;
+ status = RegistryQueryDwordValue(Key, "RealTimeIsUniversal", &ValueDword);
+ if (status == STATUS_OBJECT_NAME_NOT_FOUND) {
+ Context->RealTimeIsUniversal = FALSE;
+ goto done;
+ } else if (NT_SUCCESS(status)) {
+ Context->RealTimeIsUniversal = !!ValueDword;
+ goto done;
+ }
- RealTimeIsUniversal = 0;
+ status = RegistryQueryQwordValue(Key, "RealTimeIsUniversal", &ValueQword);
+ if (NT_SUCCESS(status)) {
+ Context->RealTimeIsUniversal = !!ValueQword;
+ goto done;
}
- Context->RealTimeIsUniversal = RealTimeIsUniversal ? TRUE : FALSE;
+ status = STATUS_UNSUCCESSFUL;
+ Context->RealTimeIsUniversal = FALSE;
+done:
Info("%s\n", Context->RealTimeIsUniversal ? "TRUE" : "FALSE");
RegistryCloseKey(Key);
- return STATUS_SUCCESS;
-
-fail2:
- Error("fail2\n");
-
- RegistryCloseKey(Key);
+ return status;
fail1:
Error("fail1 (%08x)\n", status);
@@ -1318,19 +1322,16 @@ SystemInitialize(
if (!NT_SUCCESS(status))
goto fail8;
- status = SystemGetTimeInformation();
+ status = SystemCheckProcessors();
if (!NT_SUCCESS(status))
goto fail9;
- status = SystemCheckProcessors();
+ status = SystemGetTimeInformation();
if (!NT_SUCCESS(status))
- goto fail10;
+ Error("Cannot read RealTimeIsUniversal (%08x)\n", status);
return STATUS_SUCCESS;
-fail10:
- Error("fail10\n");
-
fail9:
Error("fail9\n");
--
2.50.1.windows.1
Ngoc Tu Dinh | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|