GameHackingAcademy / Wesnoth_ExternalGoldHack

An external memory hack for Wesnoth 1.14.9 that modifies the player's gold.
https://gamehacking.academy/
Apache License 2.0
6 stars 1 forks source link

Update main.cpp #1

Open Brooksey24 opened 3 years ago

Brooksey24 commented 3 years ago

First thanks for the tutorials so far! Brand new here so just finding any reason to get into code. Both bytes_read and bytes_written seem to be unnecessary variables as the documentation specifies NULL is usable in this instance. Figured it might help reduce complexity to newcomers like myself.

attilathedud commented 3 years ago

Thanks for the suggestion and glad you are enjoying the tutorials! I vaguely remember at one point in the past (Windows 7-era) that ReadProcessMemory & WriteProcessMemory would fail in certain situations if not provided with a lpNumberOfBytesRead parameter. However, when looking at the MSDN documentation, this is apparently not the case.

Let me investigate this a bit. If it turns out the parameter is unneeded in all cases, I'll drop it and update all the code.

Brooksey24 commented 3 years ago

Thought there would be a good reason. Cheers for giving an explanation! I'll try give you more feedback for further tutorials (after studying a bit more C++ XD)