@@ -3106,3 +3106,35 @@ const char *program_data_config(void)
3106
3106
}
3107
3107
return * path .buf ? path .buf : NULL ;
3108
3108
}
3109
+
3110
+ /*
3111
+ * Based on https://stackoverflow.com/questions/43002803
3112
+ *
3113
+ * [HKLM\SYSTEM\CurrentControlSet\Services\cexecsvc]
3114
+ * "DisplayName"="@%systemroot%\\system32\\cexecsvc.exe,-100"
3115
+ * "ErrorControl"=dword:00000001
3116
+ * "ImagePath"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,
3117
+ * 6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,
3118
+ * 5c,00,63,00,65,00,78,00,65,00,63,00,73,00,76,00,63,00,2e,00,65,00,78,00,
3119
+ * 65,00,00,00
3120
+ * "Start"=dword:00000002
3121
+ * "Type"=dword:00000010
3122
+ * "Description"="@%systemroot%\\system32\\cexecsvc.exe,-101"
3123
+ * "ObjectName"="LocalSystem"
3124
+ * "ServiceSidType"=dword:00000001
3125
+ */
3126
+ int is_inside_windows_container (void )
3127
+ {
3128
+ static int inside_container = -1 ; /* -1 uninitialized */
3129
+ const char * key = "SYSTEM\\CurrentControlSet\\Services\\cexecsvc" ;
3130
+ HKEY handle = NULL ;
3131
+
3132
+ if (inside_container != -1 )
3133
+ return inside_container ;
3134
+
3135
+ inside_container = ERROR_SUCCESS ==
3136
+ RegOpenKeyExA (HKEY_LOCAL_MACHINE , key , 0 , KEY_READ , & handle );
3137
+ RegCloseKey (handle );
3138
+
3139
+ return inside_container ;
3140
+ }
0 commit comments