Skip to content

Commit d4ca256

Browse files
authored
the module's script
I'm new to C++.
1 parent 6b3948a commit d4ca256

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

process.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#define WIN32_LEAN_AND_MEAN
22
#include <Windows.h>
33
#include <luart.h>
4-
//using namespace std;
4+
//using namespace std; // don't need this garbage?
55

66
// process.FindWindow(windowName) method
77
// returns a userdata and the ID of the of the process
@@ -37,6 +37,8 @@ LUA_METHOD(process, WriteProcessMemory)
3737
CloseHandle(pHandle);
3838

3939
/*
40+
// checks if it was written with success
41+
// returns false if no and true if yes.
4042
if (memory == bytes) {
4143
lua_pushboolean(L,1); // returns true if the bytes were written correctly
4244
return 1;
@@ -60,7 +62,7 @@ LUA_METHOD(process, ReadProcessMemory)
6062
const int pID = lua_tonumber(L, 1);
6163
const int address = lua_tonumber(L,2);
6264
const int size = lua_tonumber(L,3);
63-
char memory[size];
65+
char memory[size]; // the string to be returned
6466

6567
HANDLE pHandle = OpenProcess(PROCESS_ALL_ACCESS, 0, pID);
6668

@@ -104,4 +106,4 @@ int __declspec(dllexport) luaopen_process(lua_State *L)
104106
{
105107
lua_regmodulefinalize(L, process);
106108
return 1;
107-
}
109+
}

0 commit comments

Comments
 (0)