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