Jump to content
Fórum Script Brasil
  • 0

[DUVIDA] Operação com LPVOID


WanKapef
 Share

Question

#include <stdio.h>
#include <windows.h>
#include <string.h>
#include <stdlib.h>
#pragma comment(lib, "user32.lib")

int main()
{
  HWND     hWindow;
  DWORD    dwPID;
  HANDLE   hProcess;
  
  LPVOID  lpAddress = (LPVOID)0xA6CF9C;   //Pointer 
  LPVOID  lpBufferAddress = (LPVOID)0X0;  //Address do pointer
  LPVOID  lpNewAddress = (LPVOID)0x0;     //Address+offset = address verdadeiro
  LPVOID  Offset = (LPVOID)0x3F6;            //Offset

  //Lê o address contido no pointer

     hWindow = FindWindow(0,"Point Blank");
     GetWindowThreadProcessId(hWindow, &dwPID);
     hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwPID);
     ReadProcessMemory(hProcess, lpAddress, &lpBufferAddress, sizeof(lpBufferAddress), NULL);
   
  //Acha o novo address
     
     lpNewAddress = lpBufferAddress + Offset;    //lpBufferAddress + 3F6


     system("pause");

  return 0;
}

Como fazer para somar o conteudo de lpBufferAddress com o offset? alguma solução?

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Um endereço é um número. Porém não é possível fazer a soma diretamente pois não é suportado por LPVOID.

Assim, basta converter para um valor numérico, fazer a soma e converter novamente para LPVOID:

lpNewAddress = (LPVOID)((unsigned int)lpBufferAddress + (unsigned int)Offset);

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      150.9k
    • Total Posts
      648.8k
×
×
  • Create New...