@@ -3867,3 +3867,35 @@ int uname(struct utsname *buf)
3867
3867
"%u" , (v >> 16 ) & 0x7fff );
3868
3868
return 0 ;
3869
3869
}
3870
+
3871
+ /*
3872
+ * Based on https://stackoverflow.com/questions/43002803
3873
+ *
3874
+ * [HKLM\SYSTEM\CurrentControlSet\Services\cexecsvc]
3875
+ * "DisplayName"="@%systemroot%\\system32\\cexecsvc.exe,-100"
3876
+ * "ErrorControl"=dword:00000001
3877
+ * "ImagePath"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,
3878
+ * 6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,
3879
+ * 5c,00,63,00,65,00,78,00,65,00,63,00,73,00,76,00,63,00,2e,00,65,00,78,00,
3880
+ * 65,00,00,00
3881
+ * "Start"=dword:00000002
3882
+ * "Type"=dword:00000010
3883
+ * "Description"="@%systemroot%\\system32\\cexecsvc.exe,-101"
3884
+ * "ObjectName"="LocalSystem"
3885
+ * "ServiceSidType"=dword:00000001
3886
+ */
3887
+ int is_inside_windows_container (void )
3888
+ {
3889
+ static int inside_container = -1 ; /* -1 uninitialized */
3890
+ const char * key = "SYSTEM\\CurrentControlSet\\Services\\cexecsvc" ;
3891
+ HKEY handle = NULL ;
3892
+
3893
+ if (inside_container != -1 )
3894
+ return inside_container ;
3895
+
3896
+ inside_container = ERROR_SUCCESS ==
3897
+ RegOpenKeyExA (HKEY_LOCAL_MACHINE , key , 0 , KEY_READ , & handle );
3898
+ RegCloseKey (handle );
3899
+
3900
+ return inside_container ;
3901
+ }
0 commit comments