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