Jump to content
  • Advertisement
Sign in to follow this  
nuclear123

library design problem

This topic is 2679 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

// header moduleinjector - header for class moduleinjector itself
// as well as "core" moduleinjector-related functionality

namespace Injection {
class moduleinjector {...};
... // ... = core related functionality e.g. non member functions almost all clients need
...


}



when you construct a moduleinjectior object you must pass in a VALID PROCESS ID. Therefor i constructed the following function



BOOL getProcessID( const std::wstring& processName )
{
HANDLE pSnapList;
PROCESSENTRY32 p32Info;
BOOL p32Status;

pSnapList = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
if( pSnapList == INVALID_HANDLE_VALUE )
return 0;// unable to get a handle on the process snapshot
p32Info.dwSize = sizeof( PROCESSENTRY32 );

p32Status = Process32First( pSnapList, &p32Info );
if( p32Status == NULL )
return 0; // need to recheck what the heck this does

while( Process32Next( pSnapList, &p32Info ) ) {
if( processName == p32Info.szExeFile ) {
return p32Info.th32ProcessID;
}

};
return -1; // is this needed? not found process name in list?
}





my question is where should i place this function with my library?!
1.) Should it be placed in the moduleinjector.h in core functionality as a nonmember function?
2.) Should i place it in a moduleInjectorConvience.h file so user's can use my premade function?
3.) It seems like this function should be places in a .h called PE_ProcessTools.h or PE_Tools.h...should i place it in that .h and include it in my release?

Any thoughts/reasoning behind the choice that you would choice is greatly appreciated! -thx

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!