public unsafe static string AMDeviceCopyValue(void *device, string name)
        {
            string result;

            try
            {
                MobileDeviceBase.__CFString *ptr = MobileDeviceBase.AMDeviceCopyValue_1(device, 0u, MobileDeviceBase.__CFStringMakeConstantString(MobileDeviceBase.StringToCString(name)));
                if (ptr != null)
                {
                    uint   num   = (uint)MobileDeviceBase.CFStringGetLength(ptr);
                    uint   num2  = 4u * num + 2u;
                    sbyte *value = (sbyte *)MobileDevice32.malloc(num2);
                    MobileDeviceBase.CFStringGetCString(ptr, (void *)value, (int)num2, 134217984u);
                    UTF8Marshaler uTF8Marshaler = new UTF8Marshaler();
                    result = (string)uTF8Marshaler.MarshalNativeToManaged(new IntPtr((void *)value));
                    return(result);
                }
            }
            catch (Exception ex)
            {
                LogViewer.LogEvent(0, "AMDeviceCopyValue Error: " + ex.ToString());
                result = "Unknown";
                return(result);
            }
            result = string.Empty;
            return(result);
        }
示例#2
0
        // Token: 0x06000082 RID: 130 RVA: 0x000056A8 File Offset: 0x000038A8
        public static XEFileInfo Open(iPhoneXE phone, string path, FileAccess openmode)
        {
            OpenMode openMode;
            long     num2;

            lock (phone)
            {
                openMode = OpenMode.None;
                switch (openmode)
                {
                case FileAccess.Read:
                    openMode = OpenMode.Read;
                    break;

                case FileAccess.Write:
                    openMode = OpenMode.Write;
                    break;

                case FileAccess.ReadWrite:
                    throw new NotImplementedException("Read+Write not (yet) implemented");
                }
                int num = MobileDeviceBase.AFCFileRefOpen(phone.AFCHandle, Encoding.UTF8.GetBytes(path), (ulong)((long)openMode), out num2);
                if (num != 0 && num != 0)
                {
                    LogViewer.LogEvent(0, "**ERROR:  " + path);
                    throw new IOException("AFCFileRefOpen failed with error " + num.ToString());
                }
            }
            return(new XEFileInfo(phone, num2, openMode));
        }
示例#3
0
 // Token: 0x0600014A RID: 330 RVA: 0x00008AD4 File Offset: 0x00006CD4
 public void CleanUpNativeData(IntPtr pNativeData)
 {
     if (this.allocated.Contains(pNativeData))
     {
         Marshal.FreeHGlobal(pNativeData);
         this.allocated.Remove(pNativeData);
     }
     else
     {
         LogViewer.LogEvent(1, "WARNING: Trying to free an unallocated pointer!");
         LogViewer.LogEvent(1, "         This is most likely a bug in mono");
     }
 }