@@ -2992,3 +2992,35 @@ const char *program_data_config(void)
2992
2992
}
2993
2993
return * path .buf ? path .buf : NULL ;
2994
2994
}
2995
+
2996
+ /*
2997
+ * Based on https://stackoverflow.com/questions/43002803
2998
+ *
2999
+ * [HKLM\SYSTEM\CurrentControlSet\Services\cexecsvc]
3000
+ * "DisplayName"="@%systemroot%\\system32\\cexecsvc.exe,-100"
3001
+ * "ErrorControl"=dword:00000001
3002
+ * "ImagePath"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,
3003
+ * 6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,
3004
+ * 5c,00,63,00,65,00,78,00,65,00,63,00,73,00,76,00,63,00,2e,00,65,00,78,00,
3005
+ * 65,00,00,00
3006
+ * "Start"=dword:00000002
3007
+ * "Type"=dword:00000010
3008
+ * "Description"="@%systemroot%\\system32\\cexecsvc.exe,-101"
3009
+ * "ObjectName"="LocalSystem"
3010
+ * "ServiceSidType"=dword:00000001
3011
+ */
3012
+ int is_inside_windows_container (void )
3013
+ {
3014
+ static int inside_container = -1 ; /* -1 uninitialized */
3015
+ const char * key = "SYSTEM\\CurrentControlSet\\Services\\cexecsvc" ;
3016
+ HKEY handle = NULL ;
3017
+
3018
+ if (inside_container != -1 )
3019
+ return inside_container ;
3020
+
3021
+ inside_container = ERROR_SUCCESS ==
3022
+ RegOpenKeyExA (HKEY_LOCAL_MACHINE , key , 0 , KEY_READ , & handle );
3023
+ RegCloseKey (handle );
3024
+
3025
+ return inside_container ;
3026
+ }
0 commit comments