@@ -4146,3 +4146,35 @@ int mingw_have_unix_sockets(void)
4146
4146
return ret ;
4147
4147
}
4148
4148
#endif
4149
+
4150
+ /*
4151
+ * Based on https://stackoverflow.com/questions/43002803
4152
+ *
4153
+ * [HKLM\SYSTEM\CurrentControlSet\Services\cexecsvc]
4154
+ * "DisplayName"="@%systemroot%\\system32\\cexecsvc.exe,-100"
4155
+ * "ErrorControl"=dword:00000001
4156
+ * "ImagePath"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,
4157
+ * 6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,
4158
+ * 5c,00,63,00,65,00,78,00,65,00,63,00,73,00,76,00,63,00,2e,00,65,00,78,00,
4159
+ * 65,00,00,00
4160
+ * "Start"=dword:00000002
4161
+ * "Type"=dword:00000010
4162
+ * "Description"="@%systemroot%\\system32\\cexecsvc.exe,-101"
4163
+ * "ObjectName"="LocalSystem"
4164
+ * "ServiceSidType"=dword:00000001
4165
+ */
4166
+ int is_inside_windows_container (void )
4167
+ {
4168
+ static int inside_container = -1 ; /* -1 uninitialized */
4169
+ const char * key = "SYSTEM\\CurrentControlSet\\Services\\cexecsvc" ;
4170
+ HKEY handle = NULL ;
4171
+
4172
+ if (inside_container != -1 )
4173
+ return inside_container ;
4174
+
4175
+ inside_container = ERROR_SUCCESS ==
4176
+ RegOpenKeyExA (HKEY_LOCAL_MACHINE , key , 0 , KEY_READ , & handle );
4177
+ RegCloseKey (handle );
4178
+
4179
+ return inside_container ;
4180
+ }
0 commit comments