@@ -3545,3 +3545,35 @@ const char *program_data_config(void)
3545
3545
}
3546
3546
return * path .buf ? path .buf : NULL ;
3547
3547
}
3548
+
3549
+ /*
3550
+ * Based on https://stackoverflow.com/questions/43002803
3551
+ *
3552
+ * [HKLM\SYSTEM\CurrentControlSet\Services\cexecsvc]
3553
+ * "DisplayName"="@%systemroot%\\system32\\cexecsvc.exe,-100"
3554
+ * "ErrorControl"=dword:00000001
3555
+ * "ImagePath"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,
3556
+ * 6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,
3557
+ * 5c,00,63,00,65,00,78,00,65,00,63,00,73,00,76,00,63,00,2e,00,65,00,78,00,
3558
+ * 65,00,00,00
3559
+ * "Start"=dword:00000002
3560
+ * "Type"=dword:00000010
3561
+ * "Description"="@%systemroot%\\system32\\cexecsvc.exe,-101"
3562
+ * "ObjectName"="LocalSystem"
3563
+ * "ServiceSidType"=dword:00000001
3564
+ */
3565
+ int is_inside_windows_container (void )
3566
+ {
3567
+ static int inside_container = -1 ; /* -1 uninitialized */
3568
+ const char * key = "SYSTEM\\CurrentControlSet\\Services\\cexecsvc" ;
3569
+ HKEY handle = NULL ;
3570
+
3571
+ if (inside_container != -1 )
3572
+ return inside_container ;
3573
+
3574
+ inside_container = ERROR_SUCCESS ==
3575
+ RegOpenKeyEx (HKEY_LOCAL_MACHINE , key , 0 , KEY_READ , & handle );
3576
+ RegCloseKey (handle );
3577
+
3578
+ return inside_container ;
3579
+ }
0 commit comments