• <i id='Eqm4l'><tr id='Eqm4l'><dt id='Eqm4l'><q id='Eqm4l'><span id='Eqm4l'><b id='Eqm4l'><form id='Eqm4l'><ins id='Eqm4l'></ins><ul id='Eqm4l'></ul><sub id='Eqm4l'></sub></form><legend id='Eqm4l'></legend><bdo id='Eqm4l'><pre id='Eqm4l'><center id='Eqm4l'></center></pre></bdo></b><th id='Eqm4l'></th></span></q></dt></tr></i><div id='Eqm4l'><tfoot id='Eqm4l'></tfoot><dl id='Eqm4l'><fieldset id='Eqm4l'></fieldset></dl></div>

    <small id='Eqm4l'></small><noframes id='Eqm4l'>

      1. <legend id='Eqm4l'><style id='Eqm4l'><dir id='Eqm4l'><q id='Eqm4l'></q></dir></style></legend>
        • <bdo id='Eqm4l'></bdo><ul id='Eqm4l'></ul>

      2. <tfoot id='Eqm4l'></tfoot>
      3. 如何在 C++ 中获取进程的起始/基地址?

        时间:2023-09-15

          <small id='Wb4xm'></small><noframes id='Wb4xm'>

          <i id='Wb4xm'><tr id='Wb4xm'><dt id='Wb4xm'><q id='Wb4xm'><span id='Wb4xm'><b id='Wb4xm'><form id='Wb4xm'><ins id='Wb4xm'></ins><ul id='Wb4xm'></ul><sub id='Wb4xm'></sub></form><legend id='Wb4xm'></legend><bdo id='Wb4xm'><pre id='Wb4xm'><center id='Wb4xm'></center></pre></bdo></b><th id='Wb4xm'></th></span></q></dt></tr></i><div id='Wb4xm'><tfoot id='Wb4xm'></tfoot><dl id='Wb4xm'><fieldset id='Wb4xm'></fieldset></dl></div>
              <tfoot id='Wb4xm'></tfoot>

                <tbody id='Wb4xm'></tbody>
            • <legend id='Wb4xm'><style id='Wb4xm'><dir id='Wb4xm'><q id='Wb4xm'></q></dir></style></legend>
              • <bdo id='Wb4xm'></bdo><ul id='Wb4xm'></ul>

                1. 本文介绍了如何在 C++ 中获取进程的起始/基地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在 Microsoft 的 Spider Solitaire 上使用它来测试整个基本/静态指针.所以我得到了玩家使用的移动"数量的基本指针,作弊引擎告诉我它是SpiderSolitaire.exe+B5F78".所以现在我被困在如何找出 SpiderSolitaire.exe 的起始地址(当然每次程序启动时都会改变).如何找到 SpiderSolitaire.exe 的起始地址,以便我可以添加偏移量并获得moves"值的真实地址(当然是在 C++ 中)?

                  I'm testing this whole base/static pointer thing by using it on Microsoft's Spider Solitaire. So I got the base pointer of the amount of "moves" the player has used, and cheat engine tells me it's "SpiderSolitaire.exe+B5F78". So now I'm stuck on how to figure out what the starting address is of SpiderSolitaire.exe (of course this changes every time the program starts). How do I find the starting address of SpiderSolitaire.exe so I can add the offsets and get the real address of the "moves" value (in c++ of course)?

                  推荐答案

                  这是另一种方法,用 Visual Studio 2015 编写,但应该向后兼容.

                  Here's another way, written in Visual Studio 2015 but should be backwards compatible.

                  #define PSAPI_VERSION 1
                  #include <windows.h>
                  #include <tchar.h>
                  #include <stdio.h>
                  #include <psapi.h>
                  
                  // To ensure correct resolution of symbols, add Psapi.lib to TARGETLIBS
                  #pragma comment(lib, "psapi.lib")
                  
                  void GetBaseAddressByName(DWORD processId, TCHAR *processName)
                  {
                      TCHAR szProcessName[MAX_PATH] = TEXT("<unknown>");
                  
                      HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION |
                          PROCESS_VM_READ,
                          FALSE, processId);
                  
                      if (NULL != hProcess)
                      {
                          HMODULE hMod;
                          DWORD cbNeeded;
                  
                          if (EnumProcessModulesEx(hProcess, &hMod, sizeof(hMod),
                              &cbNeeded, LIST_MODULES_32BIT | LIST_MODULES_64BIT))
                          {
                              GetModuleBaseName(hProcess, hMod, szProcessName,
                                  sizeof(szProcessName) / sizeof(TCHAR));
                              if (!_tcsicmp(processName, szProcessName)) {
                                  _tprintf(TEXT("0x%p
                  "), hMod);
                              }
                          }
                      }
                  
                      CloseHandle(hProcess);
                  }
                  
                  int main(void)
                  {
                      DWORD aProcesses[1024];
                      DWORD cbNeeded;
                      DWORD cProcesses;
                  
                      // Get the list of process identifiers.
                      if (!EnumProcesses(aProcesses, sizeof(aProcesses), &cbNeeded))
                          return 1;
                  
                      // Calculate how many process identifiers were returned.
                      cProcesses = cbNeeded / sizeof(DWORD);
                  
                      // Check the names of all the processess (Case insensitive)
                      for (int i = 0; i < cProcesses; i++) {
                          GetBaseAddressByName(aProcesses[i], TEXT("SpiderSolitaire.exe"));
                      }
                  
                      return 0;
                  }
                  

                  这篇关于如何在 C++ 中获取进程的起始/基地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:C++中对象是如何存储在内存中的? 下一篇:C++虚函数表内存开销

                  相关文章

                  最新文章

                    <bdo id='0T6AS'></bdo><ul id='0T6AS'></ul>
                      <legend id='0T6AS'><style id='0T6AS'><dir id='0T6AS'><q id='0T6AS'></q></dir></style></legend>

                    1. <i id='0T6AS'><tr id='0T6AS'><dt id='0T6AS'><q id='0T6AS'><span id='0T6AS'><b id='0T6AS'><form id='0T6AS'><ins id='0T6AS'></ins><ul id='0T6AS'></ul><sub id='0T6AS'></sub></form><legend id='0T6AS'></legend><bdo id='0T6AS'><pre id='0T6AS'><center id='0T6AS'></center></pre></bdo></b><th id='0T6AS'></th></span></q></dt></tr></i><div id='0T6AS'><tfoot id='0T6AS'></tfoot><dl id='0T6AS'><fieldset id='0T6AS'></fieldset></dl></div>

                    2. <small id='0T6AS'></small><noframes id='0T6AS'>

                      <tfoot id='0T6AS'></tfoot>