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