Exemplo n.º 1
0
        public static IntPtr GetIngameDllAddress(string moduleName)
        {
            IntPtr[] modules  = new IntPtr[255];
            uint     cbNeeded = 0;

            PSAPI.EnumProcessModules(Hook.DarkSouls3Handle.GetHandle(), modules, 4 * 1024, ref cbNeeded);

            var numModules = cbNeeded / IntPtr.Size;

            for (int i = 0; i <= numModules - 1; i++)
            {
                var disModule = modules[i];
                System.Text.StringBuilder name = new System.Text.StringBuilder();
                PSAPI.GetModuleBaseName(Hook.DarkSouls3Handle.GetHandle(), disModule, name, 255);

                if ((name.ToString().ToUpper().Equals(moduleName.ToUpper())))
                {
                    return(modules[i]);
                }
            }

            return(IntPtr.Zero);
        }
Exemplo n.º 2
0
        private uint GetIngameDllAddress(string moduleName)
        {
            uint[] modules  = new uint[255];
            uint   cbNeeded = 0;

            PSAPI.EnumProcessModules(Hook.DARKSOULS.GetHandle(), modules, 4 * 1024, ref cbNeeded);

            uint numModules = (uint)(cbNeeded / IntPtr.Size);


            for (int i = 0; i <= numModules - 1; i++)
            {
                var disModule = new IntPtr(modules[i]);
                System.Text.StringBuilder name = new System.Text.StringBuilder();
                PSAPI.GetModuleBaseName(Hook.DARKSOULS.GetHandle(), disModule, name, 255);

                if ((name.ToString().ToUpper().Equals(moduleName.ToUpper())))
                {
                    return(modules[i]);
                }
            }

            return(0);
        }