Beispiel #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;
                }
            }
        }
    }
Beispiel #2
0
    // Token: 0x06000351 RID: 849 RVA: 0x0103888C File Offset: 0x01036A8C
    private static bool smethod_5(GClass8 gclass8_0, IntPtr intptr_7, int int_0)
    {
        List <string> list   = new List <string>();
        string        empty  = string.Empty;
        bool          result = false;

        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) && !string.IsNullOrEmpty(empty) && Class7.smethod_3(empty, int_0).smethod_4())
            {
                list.Add(empty);
            }
        }
        if (list.Count > 0)
        {
            byte[] array = Class7.smethod_1(gclass8_0);
            string text  = string.Empty;
            if (array != null)
            {
                text = GClass11.smethod_2(array);
            }
            else
            {
                if (string.IsNullOrEmpty(gclass8_0.String_0) || !File.Exists(Path.Combine(Path.GetDirectoryName(gclass8_0.String_0), Path.GetFileName(gclass8_0.String_0) + ".manifest")))
                {
                    IntPtr[] array2 = GClass10.smethod_0(GEnum7.Standard).GClass10.\u200E\u206B\u200D\u202B\u200F\u206A\u206D\u200E\u200E\u206B\u206F\u202E\u200F\u200B\u206E\u202B\u206A\u200E\u206B\u206A\u206C\u202A\u206C\u202B\u206B\u206F\u206A\u200F\u206A\u200E\u202B\u200F\u200F\u200E\u200E\u200B\u200E\u202B\u206D\u202A\u202E(list.ToArray(), intptr_7);
                    for (int i = 0; i < array2.Length; i++)
                    {
                        if (array2[i].smethod_4())
                        {
                            return(false);
                        }
                    }
                    return(true);
                }
                text = Path.Combine(Path.GetDirectoryName(gclass8_0.String_0), Path.GetFileName(gclass8_0.String_0) + ".manifest");
            }
            if (string.IsNullOrEmpty(text))
            {
                return(false);
            }
            IntPtr intPtr  = GClass5.VirtualAllocEx(intptr_7, IntPtr.Zero, (uint)Class7.byte_1.Length, 12288, 64);
            IntPtr intPtr2 = GClass5.smethod_0(intptr_7, Encoding.ASCII.GetBytes(text + "\0"), 4);
            IntPtr intPtr3 = GClass5.smethod_0(intptr_7, Encoding.ASCII.GetBytes(string.Join("\0", list.ToArray()) + "\0"), 4);
            if (!intPtr.smethod_4())
            {
                byte[] array3 = (byte[])Class7.byte_1.Clone();
                uint   num    = 0u;
                BitConverter.GetBytes(Class7.intptr_1.smethod_7(intPtr.smethod_0(63L)).ToInt32()).CopyTo(array3, 59);
                BitConverter.GetBytes(Class7.intptr_0.smethod_7(intPtr.smethod_0(88L)).ToInt32()).CopyTo(array3, 84);
                BitConverter.GetBytes(Class7.intptr_3.smethod_7(intPtr.smethod_0(132L)).ToInt32()).CopyTo(array3, 128);
                BitConverter.GetBytes(Class7.intptr_4.smethod_7(intPtr.smethod_0(146L)).ToInt32()).CopyTo(array3, 142);
                BitConverter.GetBytes(Class7.intptr_2.smethod_7(intPtr.smethod_0(200L)).ToInt32()).CopyTo(array3, 196);
                BitConverter.GetBytes(Class7.intptr_5.smethod_7(intPtr.smethod_0(209L)).ToInt32()).CopyTo(array3, 205);
                BitConverter.GetBytes(intPtr2.ToInt32()).CopyTo(array3, 31);
                BitConverter.GetBytes(list.Count).CopyTo(array3, 40);
                BitConverter.GetBytes(intPtr3.ToInt32()).CopyTo(array3, 49);
                if (GClass5.WriteProcessMemory(intptr_7, intPtr, array3, array3.Length, out num) && (ulong)num == (ulong)((long)array3.Length))
                {
                    uint num2 = GClass5.smethod_7(intptr_7, intPtr, 0u, 5000);
                    result = (num2 != uint.MaxValue && num2 > 0u);
                }
                GClass5.VirtualFreeEx(intptr_7, intPtr3, 0, 32768);
                GClass5.VirtualFreeEx(intptr_7, intPtr2, 0, 32768);
                GClass5.VirtualFreeEx(intptr_7, intPtr, 0, 32768);
            }
        }
        return(result);
    }