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