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