First post on these forums, I have written plenty of code for *nix systems using c. Unfortunately I never got into windows programming which leads me to my question.

I'm attempting to write a dll injector which is already called upon by the program. So i'm not 100% sure if i need to get the proc id or not. If i do I have already found code that will do that. In short all I want this program to do is inject do one thing to a memory offset. I just want it to make it do nothing. Just a basic example or something would help. I had to dig out to offset on my own but i know its right I just don't know where to start.

Basically the program loads dsetup.dll by default which is perfect because its not used by the program. The memory offset is 0x850BFC i just want to NULL it out so it does nothing.

This is not for anything fishy its for a game I'm currently working on. Its an emulated game. I hope someone can help its been driving me bonkers.

Thanks

August 2nd, 2013, 01:41 AM

Igor Vartanov

Re: DLL Injection Question( Not for a malicious purpose)

I read this twice. And got no idea what you are after. To be helped you have to explain your problem/design in more clear/simple language. Now it sounds just gibberish.

Is the program to which you want to inject the DLL written by you or you have the source and can recompile it? If you do then there is no need to use DLL injection, you can do this by IPC. DLL injection should be the last avenue to explore if it can't be done any other way. You also nee to be carreful about hard coded memory offsets. Just because it is currently this value on your systems doesn't mean its always this value.

August 2nd, 2013, 10:21 AM

VladimirF

Re: DLL Injection Question( Not for a malicious purpose)

Quote:

Originally Posted by Brentx

This is not for anything fishy...

It sure does sound fishy :)

Quote:

Originally Posted by Brentx

The memory offset is 0x850BFC i just want to NULL it out so it does nothing.

You don't need to inject your DLL for that.
Just use WriteProcessMemory()

August 2nd, 2013, 10:28 AM

Brentx

Re: DLL Injection Question( Not for a malicious purpose)

Its actually for a Everquest emulator. I do not have the client source but the server source. Which unfortunately you can't control if the map comes on or not. Basically all I'm looking to do is inject so the map doesn't come on to better an earlier player experience. Now there is a program called Macroquest 2 which lists all the known offsets for the client. Another server already does this to prevent hacking etc we are looking to do something similiar down the road right now all we want to do is control the map.

Its probably only about 10 lines of code. I just didn't have any knowledge of windows based programming until yesterday, its more or less a big project for a newbie. From what i'm seeing so far it looks like detours is the way to go. I'm working on it just taking me longer than it would someone else. Guess I was hoping for a quick answer.

But one question I would like to ask you guys. This is all hypothetical can I use detours to inject at that point in memory, and put my own function in. Or even if I do that will the original data from the program still work anyways. Just need to know if I need to figure out the programs functions prototypes or not.

August 2nd, 2013, 10:30 AM

Brentx

Re: DLL Injection Question( Not for a malicious purpose)

Quote:

Originally Posted by VladimirF

It sure does sound fishy :)

You don't need to inject your DLL for that.
Just use WriteProcessMemory()

Thanks I'll give it a try today. Also its not fishy, its for a emu server making the game with a more classic look and feel. There was no map in the ERA we are setting the game.

August 2nd, 2013, 10:31 AM

2kaud

Re: DLL Injection Question( Not for a malicious purpose)

Quote:

Originally Posted by VladimirF

You don't need to inject your DLL for that.
Just use WriteProcessMemory()

Yes, but WriteProcessMemory requires that the target process must have PROCESS_VM_WRITE and PROCESS_VM_OPERATION access.

August 2nd, 2013, 11:15 AM

VladimirF

Re: DLL Injection Question( Not for a malicious purpose)

Quote:

Originally Posted by 2kaud

Yes, but WriteProcessMemory requires that the target process must have PROCESS_VM_WRITE and PROCESS_VM_OPERATION access.

Yes, but it's less than PROCESS_CREATE_THREAD, PROCESS_QUERY_INFORMATION, PROCESS_VM_OPERATION, PROCESS_VM_WRITE, and PROCESS_VM_READ required for dll injection :)

August 2nd, 2013, 12:13 PM

2kaud

Re: DLL Injection Question( Not for a malicious purpose)

Well I know that I'm injecting a thread into dll's that don't have those process accesses - so I've dusted off the cobwebs from VS6 and found some source code from way back when. The program I'm using has to run as an administrator and grabs the SeDebugPrivilege right.:cool:

August 2nd, 2013, 01:06 PM

VladimirF

Re: DLL Injection Question( Not for a malicious purpose)

Quote:

Originally Posted by 2kaud

The program I'm using has to run as an administrator and grabs the SeDebugPrivilege right.:cool:

Then it will have no problems calling WriteProcessMemory(). Right?

August 2nd, 2013, 02:39 PM

2kaud

Re: DLL Injection Question( Not for a malicious purpose)

Right. I had to figure out what I'd written all those years ago as I'd forgotten.