@@ -3581,3 +3581,35 @@ const char *program_data_config(void)
3581
3581
}
3582
3582
return * path .buf ? path .buf : NULL ;
3583
3583
}
3584
+
3585
+ /*
3586
+ * Based on https://stackoverflow.com/questions/43002803
3587
+ *
3588
+ * [HKLM\SYSTEM\CurrentControlSet\Services\cexecsvc]
3589
+ * "DisplayName"="@%systemroot%\\system32\\cexecsvc.exe,-100"
3590
+ * "ErrorControl"=dword:00000001
3591
+ * "ImagePath"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,
3592
+ * 6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,
3593
+ * 5c,00,63,00,65,00,78,00,65,00,63,00,73,00,76,00,63,00,2e,00,65,00,78,00,
3594
+ * 65,00,00,00
3595
+ * "Start"=dword:00000002
3596
+ * "Type"=dword:00000010
3597
+ * "Description"="@%systemroot%\\system32\\cexecsvc.exe,-101"
3598
+ * "ObjectName"="LocalSystem"
3599
+ * "ServiceSidType"=dword:00000001
3600
+ */
3601
+ int is_inside_windows_container (void )
3602
+ {
3603
+ static int inside_container = -1 ; /* -1 uninitialized */
3604
+ const char * key = "SYSTEM\\CurrentControlSet\\Services\\cexecsvc" ;
3605
+ HKEY handle = NULL ;
3606
+
3607
+ if (inside_container != -1 )
3608
+ return inside_container ;
3609
+
3610
+ inside_container = ERROR_SUCCESS ==
3611
+ RegOpenKeyEx (HKEY_LOCAL_MACHINE , key , 0 , KEY_READ , & handle );
3612
+ RegCloseKey (handle );
3613
+
3614
+ return inside_container ;
3615
+ }
0 commit comments