@@ -2973,3 +2973,35 @@ const char *program_data_config(void)
2973
2973
}
2974
2974
return * path .buf ? path .buf : NULL ;
2975
2975
}
2976
+
2977
+ /*
2978
+ * Based on https://stackoverflow.com/questions/43002803
2979
+ *
2980
+ * [HKLM\SYSTEM\CurrentControlSet\Services\cexecsvc]
2981
+ * "DisplayName"="@%systemroot%\\system32\\cexecsvc.exe,-100"
2982
+ * "ErrorControl"=dword:00000001
2983
+ * "ImagePath"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,
2984
+ * 6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,
2985
+ * 5c,00,63,00,65,00,78,00,65,00,63,00,73,00,76,00,63,00,2e,00,65,00,78,00,
2986
+ * 65,00,00,00
2987
+ * "Start"=dword:00000002
2988
+ * "Type"=dword:00000010
2989
+ * "Description"="@%systemroot%\\system32\\cexecsvc.exe,-101"
2990
+ * "ObjectName"="LocalSystem"
2991
+ * "ServiceSidType"=dword:00000001
2992
+ */
2993
+ int is_inside_windows_container (void )
2994
+ {
2995
+ static int inside_container = -1 ; /* -1 uninitialized */
2996
+ const char * key = "SYSTEM\\CurrentControlSet\\Services\\cexecsvc" ;
2997
+ HKEY handle = NULL ;
2998
+
2999
+ if (inside_container != -1 )
3000
+ return inside_container ;
3001
+
3002
+ inside_container = ERROR_SUCCESS ==
3003
+ RegOpenKeyExA (HKEY_LOCAL_MACHINE , key , 0 , KEY_READ , & handle );
3004
+ RegCloseKey (handle );
3005
+
3006
+ return inside_container ;
3007
+ }
0 commit comments