javascript – Protect memory address

Question:

I'm developing a simple game. I want to protect the memory address where the player's score is located so that only a specific process can access it, thus preventing the user from changing or accessing this memory address with a cheat tool. It is possible?

Answer:

Use Windows documentation

https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx

BOOL WINAPI CreateProcess(
  _In_opt_    LPCTSTR               lpApplicationName,
  _Inout_opt_ LPTSTR                lpCommandLine,
  _In_opt_    LPSECURITY_ATTRIBUTES lpProcessAttributes,
  _In_opt_    LPSECURITY_ATTRIBUTES lpThreadAttributes,
  _In_        BOOL                  bInheritHandles,
  _In_        DWORD                 dwCreationFlags,
  _In_opt_    LPVOID                lpEnvironment,
  _In_opt_    LPCTSTR               lpCurrentDirectory,
  _In_        LPSTARTUPINFO         lpStartupInfo,
  _Out_       LPPROCESS_INFORMATION lpProcessInformation
);

Where

https://msdn.microsoft.com/en-us/library/windows/desktop/ms682453(v=vs.85).aspx

HANDLE WINAPI CreateThread(
  _In_opt_  LPSECURITY_ATTRIBUTES  lpThreadAttributes,
  _In_      SIZE_T                 dwStackSize,
  _In_      LPTHREAD_START_ROUTINE lpStartAddress,
  _In_opt_  LPVOID                 lpParameter,
  _In_      DWORD                  dwCreationFlags,
  _Out_opt_ LPDWORD                lpThreadId
);

Note the parameter of the two functions whose type is LPSECURITY_ATTRIBUTES. According to Microsoft documentation, if the value is NULL the process or thread is created without inheritance to child processes. But if you want to do something more secure, study about the struct SECURITY_ATTRIBUTES.

Scroll to Top