Пример #1
0
        static void File_FindNext(Hook hook, RegisterMemory mem)
        {
            int ebp       = mem[Registers.EBP];
            int handlePtr = Process.ReadInt(ebp + 0x8); // findfile handle
            int dataPtr   = ebp - 0x140;                // WIN32_FIND_DATA

            if (FindFileTable.TryGetValue(handlePtr, out FindFileInfo info))
            {
                // this is one of our handles
                bool result = info.Next();
                FindFileInfo.WriteData(dataPtr);
                mem[Registers.EAX] = result ? 1 : 0;

                hook.SetSkipOldCode(true);
            }
            else
            {
                hook.SetSkipOldCode(false);
            }
        }
Пример #2
0
        static void File_FindFirst(Hook hook, RegisterMemory mem)
        {
            int pathPtr = Process.ReadInt(mem[Registers.EBP] + 0x8); // char*
            int dataPtr = mem[Registers.EBP] - 0x140;                // WIN32_FIND_DATA

            string path = ReadString(pathPtr);

            // check if the project folder returns us a handle
            FindFileInfo info = FindFileInfo.First(path);

            if (info != null)
            {
                // files found in the project folder!
                FindFileTable.Add(info.HandlePtr, info);
                FindFileInfo.WriteData(dataPtr);
                mem[Registers.EAX] = info.HandlePtr;

                hook.SetSkipOldCode(true);
            }
            else // nothing found
            {
                hook.SetSkipOldCode(false);
            }
        }