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