@@ -28,6 +28,14 @@ func runtimeWindowsDetector(pf *inventory.Platform, conn shared.Connection) (boo
2828 current , err := win .GetWindowsOSBuild (conn )
2929 if err == nil && current .UBR > 0 {
3030 platformFromWinCurrentVersion (pf , current )
31+
32+ hotpatchEnabled , err := win .GetWindowsHotpatch (conn , pf )
33+ if err != nil {
34+ // Don't return an error here, as it is expected that this key may not exist
35+ log .Debug ().Err (err ).Msg ("could not get windows hotpatch status" )
36+ }
37+
38+ pf .Labels ["windows.mondoo.com/hotpatch" ] = strconv .FormatBool (hotpatchEnabled )
3139 return true , nil
3240 }
3341
@@ -76,6 +84,7 @@ func platformFromWinCurrentVersion(pf *inventory.Platform, current *win.WindowsC
7684
7785 pf .Labels ["windows.mondoo.com/product-type" ] = productType
7886 pf .Labels ["windows.mondoo.com/display-version" ] = current .DisplayVersion
87+ pf .Labels ["windows.mondoo.com/edition-id" ] = current .EditionID
7988
8089 correctForWindows11 (pf )
8190}
@@ -106,6 +115,18 @@ func staticWindowsDetector(pf *inventory.Platform, conn shared.Connection) (bool
106115 pf .Title = productName .Value .String
107116 }
108117
118+ editionID , err := rh .GetRegistryItemValue (registry .Software , "Microsoft\\ Windows NT\\ CurrentVersion" , "EditionID" )
119+ if err == nil {
120+ log .Debug ().Str ("editionID" , editionID .Value .String ).Msg ("found editionID" )
121+ pf .Labels ["windows.mondoo.com/edition-id" ] = editionID .Value .String
122+ }
123+
124+ arch , err := rh .GetRegistryItemValue (registry .Software , "Microsoft\\ Windows NT\\ CurrentVersion" , "Architecture" )
125+ if err == nil && arch .Value .String != "" {
126+ log .Debug ().Str ("architecture" , arch .Value .String ).Msg ("found architecture" )
127+ pf .Arch = arch .Value .String
128+ }
129+
109130 ubr , err := rh .GetRegistryItemValue (registry .Software , "Microsoft\\ Windows NT\\ CurrentVersion" , "UBR" )
110131 if err == nil && ubr .Value .String != "" {
111132 log .Debug ().Str ("ubr" , ubr .Value .String ).Msg ("found ubr" )
@@ -124,6 +145,28 @@ func staticWindowsDetector(pf *inventory.Platform, conn shared.Connection) (bool
124145 }
125146 }
126147
148+ platformArch := "amd64"
149+ if pf .Arch != "" {
150+ platformArch = strings .ToLower (pf .Arch )
151+ }
152+ hotpatchPackage , err := rh .GetRegistryItemValue (registry .Software , "Microsoft\\ Windows NT\\ CurrentVersion\\ Update\\ TargetingInfo\\ DynamicInstalled\\ Hotpatch." + platformArch , "Name" )
153+ if err == nil && hotpatchPackage .Value .String != "" {
154+ log .Debug ().Str ("hotpatchPackage" , hotpatchPackage .Value .String ).Msg ("found hotpatchPackage" )
155+ }
156+
157+ enableVirtualizationBasedSecurity , err := rh .GetRegistryItemValue (registry .System , "CurrentControlSet\\ Control\\ DeviceGuard" , "EnableVirtualizationBasedSecurity" )
158+ if err == nil && enableVirtualizationBasedSecurity .Value .String != "" {
159+ log .Debug ().Str ("enableVirtualizationBasedSecurity" , enableVirtualizationBasedSecurity .Value .String ).Msg ("found enableVirtualizationBasedSecurity" )
160+ }
161+
162+ hotPatchTableSize , err := rh .GetRegistryItemValue (registry .System , "CurrentControlSet\\ Control\\ Session Manager\\ Memory Management" , "HotPatchTableSize" )
163+ if err == nil && enableVirtualizationBasedSecurity .Value .String != "" {
164+ log .Debug ().Str ("hotPatchTableSize" , hotPatchTableSize .Value .String ).Msg ("found hotPatchTableSize" )
165+ }
166+
167+ hotpatchEnabled := hotpatchPackage .Value .String == win .HotpatchPackage && enableVirtualizationBasedSecurity .Value .String == "1" && hotPatchTableSize .Value .String != "0"
168+ pf .Labels ["windows.mondoo.com/hotpatch" ] = strconv .FormatBool (hotpatchEnabled )
169+
127170 correctForWindows11 (pf )
128171
129172 return true , nil
0 commit comments