예제 #1
0
    // Token: 0x06000355 RID: 853 RVA: 0x010391E4 File Offset: 0x010373E4
    private static void smethod_9(GClass8 gclass8_0, IntPtr intptr_7)
    {
        GStruct5 gstruct = gclass8_0.GStruct9_0.OptionalHeader.DataDirectory[5];

        if (gstruct.Size > 0u)
        {
            uint     num  = 0u;
            uint     num2 = (uint)(intptr_7.ToInt32() - (int)gclass8_0.GStruct9_0.OptionalHeader.ImageBase);
            uint     num3 = gclass8_0.method_11(gstruct.VirtualAddress);
            uint     num4 = (uint)Marshal.SizeOf(typeof(GStruct4));
            GStruct4 gstruct2;
            while (num < gstruct.Size && gclass8_0.method_3 <GStruct4>((long)((ulong)num3), SeekOrigin.Begin, out gstruct2))
            {
                int  num5 = (int)((gstruct2.SizeOfBlock - num4) / 2u);
                uint num6 = gclass8_0.method_11(gstruct2.VirtualAddress);
                for (int i = 0; i < num5; i++)
                {
                    ushort num7;
                    if (gclass8_0.method_3 <ushort>((long)((ulong)(num3 + num4) + (ulong)((long)((long)i << 1))), SeekOrigin.Begin, out num7) && (num7 >> 12 & 3) != 0)
                    {
                        uint num8 = num6 + (uint)(num7 & 4095);
                        uint num9;
                        if (!gclass8_0.method_3 <uint>((long)((ulong)num8), SeekOrigin.Begin, out num9))
                        {
                            throw gclass8_0.vmethod_1();
                        }
                        gclass8_0.method_7 <uint>(-4L, SeekOrigin.Current, num9 + num2);
                    }
                }
                num  += gstruct2.SizeOfBlock;
                num3 += gstruct2.SizeOfBlock;
            }
        }
    }
예제 #2
0
    // Token: 0x06000354 RID: 852 RVA: 0x01038FC8 File Offset: 0x010371C8
    private static void smethod_8(GClass8 gclass8_0, IntPtr intptr_7, int int_0)
    {
        string empty  = string.Empty;
        string empty2 = string.Empty;

        foreach (GStruct8 gstruct in gclass8_0.method_8())
        {
            if (gclass8_0.method_4((long)((ulong)gclass8_0.method_11(gstruct.Name)), SeekOrigin.Begin, out empty, -1, null))
            {
                IntPtr intPtr = IntPtr.Zero;
                intPtr = Class7.smethod_3(empty, int_0);
                if (intPtr.smethod_4())
                {
                    throw new FileNotFoundException(string.Format("Unable to load dependent module '{0}'.", empty));
                }
                uint      num  = gclass8_0.method_11(gstruct.FirstThunkPtr);
                uint      num2 = (uint)Marshal.SizeOf(typeof(GStruct15));
                GStruct15 gstruct2;
                while (gclass8_0.method_3 <GStruct15>((long)((ulong)num), SeekOrigin.Begin, out gstruct2) && gstruct2.u1.AddressOfData > 0u)
                {
                    IntPtr intPtr2 = IntPtr.Zero;
                    object obj;
                    if ((gstruct2.u1.Ordinal & 2147483648u) != 0u)
                    {
                        obj = (ushort)(gstruct2.u1.Ordinal & 65535u);
                    }
                    else
                    {
                        if (!gclass8_0.method_4((long)((ulong)(gclass8_0.method_11(gstruct2.u1.AddressOfData) + 2u)), SeekOrigin.Begin, out empty2, -1, null))
                        {
                            throw gclass8_0.vmethod_1();
                        }
                        obj = empty2;
                    }
                    if (!(intPtr2 = GClass5.GetModuleHandleA(empty)).smethod_4())
                    {
                        IntPtr intPtr3 = obj.GetType().Equals(typeof(string)) ? GClass5.GetProcAddress(intPtr2, (string)obj) : GClass5.GetProcAddress_1(intPtr2, (uint)((ushort)obj & ushort.MaxValue));
                        if (!intPtr3.smethod_4())
                        {
                            intPtr2 = intPtr.smethod_0((long)intPtr3.smethod_6((long)intPtr2.ToInt32()).ToInt32());
                        }
                    }
                    else
                    {
                        intPtr2 = GClass5.smethod_3(intptr_7, intPtr, obj);
                    }
                    if (intPtr2.smethod_4())
                    {
                        throw new EntryPointNotFoundException(string.Format("Unable to locate imported function '{0}' from module '{1}' in the remote process.", empty2, empty));
                    }
                    gclass8_0.method_7 <int>((long)((ulong)num), SeekOrigin.Begin, intPtr2.ToInt32());
                    num += num2;
                }
            }
        }
    }