@@ -3990,3 +3990,35 @@ int mingw_have_unix_sockets(void)
3990
3990
}
3991
3991
return ret ;
3992
3992
}
3993
+
3994
+ /*
3995
+ * Based on https://stackoverflow.com/questions/43002803
3996
+ *
3997
+ * [HKLM\SYSTEM\CurrentControlSet\Services\cexecsvc]
3998
+ * "DisplayName"="@%systemroot%\\system32\\cexecsvc.exe,-100"
3999
+ * "ErrorControl"=dword:00000001
4000
+ * "ImagePath"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,
4001
+ * 6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,
4002
+ * 5c,00,63,00,65,00,78,00,65,00,63,00,73,00,76,00,63,00,2e,00,65,00,78,00,
4003
+ * 65,00,00,00
4004
+ * "Start"=dword:00000002
4005
+ * "Type"=dword:00000010
4006
+ * "Description"="@%systemroot%\\system32\\cexecsvc.exe,-101"
4007
+ * "ObjectName"="LocalSystem"
4008
+ * "ServiceSidType"=dword:00000001
4009
+ */
4010
+ int is_inside_windows_container (void )
4011
+ {
4012
+ static int inside_container = -1 ; /* -1 uninitialized */
4013
+ const char * key = "SYSTEM\\CurrentControlSet\\Services\\cexecsvc" ;
4014
+ HKEY handle = NULL ;
4015
+
4016
+ if (inside_container != -1 )
4017
+ return inside_container ;
4018
+
4019
+ inside_container = ERROR_SUCCESS ==
4020
+ RegOpenKeyExA (HKEY_LOCAL_MACHINE , key , 0 , KEY_READ , & handle );
4021
+ RegCloseKey (handle );
4022
+
4023
+ return inside_container ;
4024
+ }
0 commit comments