@@ -4238,3 +4238,35 @@ int mingw_have_unix_sockets(void)
4238
4238
return ret ;
4239
4239
}
4240
4240
#endif
4241
+
4242
+ /*
4243
+ * Based on https://stackoverflow.com/questions/43002803
4244
+ *
4245
+ * [HKLM\SYSTEM\CurrentControlSet\Services\cexecsvc]
4246
+ * "DisplayName"="@%systemroot%\\system32\\cexecsvc.exe,-100"
4247
+ * "ErrorControl"=dword:00000001
4248
+ * "ImagePath"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,
4249
+ * 6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,
4250
+ * 5c,00,63,00,65,00,78,00,65,00,63,00,73,00,76,00,63,00,2e,00,65,00,78,00,
4251
+ * 65,00,00,00
4252
+ * "Start"=dword:00000002
4253
+ * "Type"=dword:00000010
4254
+ * "Description"="@%systemroot%\\system32\\cexecsvc.exe,-101"
4255
+ * "ObjectName"="LocalSystem"
4256
+ * "ServiceSidType"=dword:00000001
4257
+ */
4258
+ int is_inside_windows_container (void )
4259
+ {
4260
+ static int inside_container = -1 ; /* -1 uninitialized */
4261
+ const char * key = "SYSTEM\\CurrentControlSet\\Services\\cexecsvc" ;
4262
+ HKEY handle = NULL ;
4263
+
4264
+ if (inside_container != -1 )
4265
+ return inside_container ;
4266
+
4267
+ inside_container = ERROR_SUCCESS ==
4268
+ RegOpenKeyExA (HKEY_LOCAL_MACHINE , key , 0 , KEY_READ , & handle );
4269
+ RegCloseKey (handle );
4270
+
4271
+ return inside_container ;
4272
+ }
0 commit comments