qb-0 / pyMeow

Python Game Hacking Library
MIT License
355 stars 39 forks source link

Fix for ALL_UPPERCASE names #60

Closed Hypnootika closed 3 months ago

qb-0 commented 3 months ago

If I'm not wrong, this will force all module names to be lower case. Is that always the case on windows?

I saw #59 and if my guess isn't wrong this is related to https://github.com/qb-0/pyMeow/blob/master/src/memcore.nim#L222 - In which case is the process not listed at the modules with the same name?

Hypnootika commented 3 months ago

You are not wrong, it will force all Module names to be lowercase. As far as I know, the Process main Module is always the name of the .exe.

I can't 100% promise that they are always all lowercase. I mainly did this approach because my initial attempt of doing a lowercase comparison in getModule failed.

When im back at my PC, i will test it and verify if that doesn't interfere and i will also check if main Modules always have the name as the process + if they are always lowercase

Hypnootika commented 3 months ago

All right, i did some testing and found out, that MOST processes main module is exactly named like the process. Yet, system processes arent. With my fix im fixing the current problem with openProcess.

Unfortunately if one would go ahead and use getModule on all processes from enumProcesses, that person would get an error.

The first module from enumModules is always the mainModule. I would have changed it but enumModules is an iterator which doesn't let us do enumModules[0].

qb-0 commented 3 months ago

I guess the correct fix for https://github.com/qb-0/pyMeow/blob/master/src/memcore.nim#L222 would be enumModules.toSeq[0] then. This needs to be tested on linux also.

Im not on machine till monday. So we either do it with the pr or I'll change it monday.

Hypnootika commented 3 months ago

Apart from the System Processes (access denied), i opened every process on my System using openProcess and my recent push in Nim. Worked flawelessly

NyshMy commented 3 months ago

I pulled the latest code and compiled it, but it still doesn't seem to work. Is it caused by a change in some part of the code? It was able to open normally in last year's version

Hypnootika commented 3 months ago

I pulled the latest code and compiled it, but it still doesn't seem to work. Is it caused by a change in some part of the code? It was able to open normally in last year's version

The latest code from my "patch-1" branch of my Fork? Since it is 100% working because the issue was that open_process used "get_module" to populate the "base" field of the Process object you get as the return value. It now does this differently and will work, as long as you have permissions

qb-0 commented 3 months ago

Thanks Frog