gm_process - Process manipulation for Winders

I would make this cross-platform but yknow, no access to a linux machine, they manage processes very differently, etc etc.
Source[SUB](behold horrible code)[/SUB]

  Returns a table of processes. Lua replication of the PROCESSENTRY32 struct.
  Returns a new Process userdata or nil if failed.

Process metatable:

  Terminates the process, optionally with the exit code.
  Returns the full path to the process
  Returns the name of the process(like calc.exe)
  Returns a list of modules(usually DLLs) that are loaded into the process.
  Returns Lua replication of the PROCESS_MEMORY_COUNTERS struct.
  Closes the process handle, rendering the userdata useless.

After I finish it, I will clean up that god awful source code. I just noticed it has remnants of an old project which I’ll also clean up later.

[editline]3rd July 2012[/editline]

I’ll add process.Launch(commandline) later and methods to get STDIN/STDOUT/STDERR and read/writing from memory once I iron out this version.

[editline]3rd July 2012[/editline]

Possibly I’ll add access to PDH too(so you can get things like CPU usage and I/O usage)
Update log:

July 02:
  Initial Release
July 03: [](
  Fixed crash with GetPath/GetName.

I recommend using SIGAR API. It’s a library for obtaining various kinds of information from the OS like CPU usage. It’s a bit complicated though. If you need help using it, I’m available. It has support for multiple OSes. It is licensed under Apache 2.

I’m surprised it doesn’t crash on the first run. LPSTR is a typedef of char*. You’re declaring a pointer to char but not initializing it.

Use this instead

[cpp]char Buffer[MAX_PATH];
if(GetModuleBaseName(handle, 0, Buffer, MAX_PATH)){
return 1;

Same for GetPath.

I was at first I believe but I got some compile errors. I’ll try using that.

[editline]3rd July 2012[/editline]

That fixed it! -snip- Updating OP

What sort of use would this module have?

Maybe you can tell them their antivirus is outdated or something.

Everything I said in the OP shows ways it can be used.

Ways a module can be used != uses for a module

IMO this module has absolutely zero usage. There is no reason to use it.

Uh, I think he means real world examples.
Which I can’t think of any, besides maybe checking if a process is using to much memory and possibly kill it. But then again, this should be handled outside of a game.

tits, Remscar got it.

You could force all clients to have it installed and use GetModuleInfo() to see if they’ve attached any nasty DLL’s to GMod :wink:

Of course, at the sacrifice of your entire userbase.

It’s just for private use. I don’t expect this to be used on a server. I didn’t think I’d be told “THIS MODULE HAS NO USAGE AT ALL” as I expected people just to use it like the steamworks module, for fun.

A injected dll can circumvent this pretty easily.

Of course, but you do only need to catch people out once to be able to ban them.