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