Example #1
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;
                }
            }
        }
    }