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