예제 #1
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));
        }
예제 #2
0
 // Token: 0x060000F2 RID: 242 RVA: 0x000066A0 File Offset: 0x000048A0
 private unsafe void doConstruction()
 {
     this.dnc  = new DeviceNotificationCallback(this.NotifyCallback);
     this.drn1 = new DeviceRestoreNotificationCallback(this.DfuConnectCallback);
     this.drn2 = new DeviceRestoreNotificationCallback(this.RecoveryConnectCallback);
     this.drn3 = new DeviceRestoreNotificationCallback(this.DfuDisconnectCallback);
     this.drn4 = new DeviceRestoreNotificationCallback(this.RecoveryDisconnectCallback);
     try
     {
         void *ptr;
         int   num = MobileDeviceBase.AMDeviceNotificationSubscribe(this.dnc, 0u, 0u, 0u, out ptr);
         if (num != 0)
         {
             throw new Exception("AMDeviceNotificationSubscribe failed with error " + num);
         }
         num = MobileDeviceBase.AMRestoreRegisterForDeviceNotifications(this.drn1, this.drn2, this.drn3, this.drn4, 0u, null);
         if (num != 0)
         {
             throw new Exception("AMRestoreRegisterForDeviceNotifications failed with error " + num);
         }
     }
     catch (Exception ex)
     {
         throw ex;
         //MessageBox.Show(LocalizedResources.txtUnableToStartIPhoneListner + "\r\n\r\n  Error Code: " + ex.Message.ToString());
     }
 }
예제 #3
0
        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);
        }
예제 #4
0
 // Token: 0x06000080 RID: 128 RVA: 0x00005644 File Offset: 0x00003844
 public override long Seek(long offset, SeekOrigin origin)
 {
     lock (this.phone)
     {
         MobileDeviceBase.AFCFileRefSeek(this.phone.AFCHandle, this.handle, (long)((ulong)((uint)offset)), 0L);
     }
     return(offset);
 }
예제 #5
0
 // Token: 0x0600007D RID: 125 RVA: 0x000054C0 File Offset: 0x000036C0
 protected override void Dispose(bool disposing)
 {
     if (disposing && this.handle != 0L)
     {
         MobileDeviceBase.AFCFileRefClose(this.phone.AFCHandle, this.handle);
         this.handle = 0L;
     }
     base.Dispose(disposing);
 }
예제 #6
0
        public unsafe static int IDDirectoryRead(void *conn, void *dir, ref string itemName)
        {
            void *ptr    = null;
            int   result = MobileDeviceBase.AFCDirectoryRead(conn, dir, ref ptr);

            if (ptr != null)
            {
                IntPtr ptr2 = new IntPtr(ptr);
                itemName = MobileDeviceBase.PointerToString(ptr2);
            }
            else
            {
                itemName = null;
            }
            return(result);
        }
예제 #7
0
 // Token: 0x0600007F RID: 127 RVA: 0x000055BC File Offset: 0x000037BC
 public override void Write(byte[] buffer, int offset, int count)
 {
     lock (this.phone)
     {
         if (!this.CanWrite)
         {
             throw new NotImplementedException("Stream open for reading only");
         }
         byte[] array;
         if (offset == 0)
         {
             array = buffer;
         }
         else
         {
             array = new byte[count];
             Buffer.BlockCopy(buffer, offset, array, 0, count);
         }
         MobileDeviceBase.AFCFileRefWrite(this.phone.AFCHandle, this.handle, array, (uint)count);
     }
 }
예제 #8
0
        // Token: 0x0600007E RID: 126 RVA: 0x00005514 File Offset: 0x00003714
        public override int Read(byte[] buffer, int offset, int count)
        {
            if (!this.CanRead)
            {
                throw new NotImplementedException("Stream open for writing only");
            }
            int result;

            lock (this.phone)
            {
                if (offset != 0)
                {
                    MobileDeviceBase.AFCFileRefSeek(this.phone.AFCHandle, this.handle, (long)offset, 0L);
                }
                uint num = (uint)count;
                if (MobileDeviceBase.AFCFileRefRead(this.phone.AFCHandle, this.handle, buffer, ref num) != 0)
                {
                    throw new IOException("AFCFileRefRead error..");
                }
                result = (int)num;
            }
            return(result);
        }
예제 #9
0
 // Token: 0x06000081 RID: 129 RVA: 0x000020CF File Offset: 0x000002CF
 public override void Flush()
 {
     MobileDeviceBase.AFCFlushData(this.phone.AFCHandle, this.handle);
 }
예제 #10
0
 // Token: 0x0600007C RID: 124 RVA: 0x00005498 File Offset: 0x00003698
 public override void SetLength(long value)
 {
     MobileDeviceBase.AFCFileRefSetFileSize(this.phone.AFCHandle, this.handle, (uint)value);
 }
예제 #11
0
		public unsafe static extern int CFStringGetLength(MobileDeviceBase.__CFString* thisString);
예제 #12
0
		public unsafe static extern byte CFStringGetCString(MobileDeviceBase.__CFString* thisString, void* value, int length, uint format);
예제 #13
0
		public unsafe static extern int CFDictionaryGetKeysAndValues(MobileDeviceBase.__CFDictionary* CFDictionary, ref MobileDeviceBase.__CFArray* CFArrayKeys, ref MobileDeviceBase.__CFArray* CFArrayValues);
예제 #14
0
		public unsafe static extern uint CFDictionaryGetCount(MobileDeviceBase.__CFDictionary* CFDictionary);
예제 #15
0
		public unsafe static extern int AMDeviceLookupApplications(void* device, void* options, ref MobileDeviceBase.__CFDictionary* appBundles);