@@ -3908,3 +3908,35 @@ int uname(struct utsname *buf)
3908
3908
"%u" , (v >> 16 ) & 0x7fff );
3909
3909
return 0 ;
3910
3910
}
3911
+
3912
+ /*
3913
+ * Based on https://stackoverflow.com/questions/43002803
3914
+ *
3915
+ * [HKLM\SYSTEM\CurrentControlSet\Services\cexecsvc]
3916
+ * "DisplayName"="@%systemroot%\\system32\\cexecsvc.exe,-100"
3917
+ * "ErrorControl"=dword:00000001
3918
+ * "ImagePath"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,
3919
+ * 6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,
3920
+ * 5c,00,63,00,65,00,78,00,65,00,63,00,73,00,76,00,63,00,2e,00,65,00,78,00,
3921
+ * 65,00,00,00
3922
+ * "Start"=dword:00000002
3923
+ * "Type"=dword:00000010
3924
+ * "Description"="@%systemroot%\\system32\\cexecsvc.exe,-101"
3925
+ * "ObjectName"="LocalSystem"
3926
+ * "ServiceSidType"=dword:00000001
3927
+ */
3928
+ int is_inside_windows_container (void )
3929
+ {
3930
+ static int inside_container = -1 ; /* -1 uninitialized */
3931
+ const char * key = "SYSTEM\\CurrentControlSet\\Services\\cexecsvc" ;
3932
+ HKEY handle = NULL ;
3933
+
3934
+ if (inside_container != -1 )
3935
+ return inside_container ;
3936
+
3937
+ inside_container = ERROR_SUCCESS ==
3938
+ RegOpenKeyExA (HKEY_LOCAL_MACHINE , key , 0 , KEY_READ , & handle );
3939
+ RegCloseKey (handle );
3940
+
3941
+ return inside_container ;
3942
+ }
0 commit comments