.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Programming
General Programming Help others and get yourself helped here!

Reply
 
Thread Tools
loading a dll
Old
  (#1)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default loading a dll - 16-12-2004

another question , this is purely out of interest for a wild idea i have.

Is it possible to load a dll that is already loaded?

Ie, lets explain my wild idea, as for example HL2.EXE , it provides a metamod style for plugins. Lets say i write a plugin that is able to read out entity lists, player data, etc.

Now i want a seperated EXE program to read this data and also get back to the dll. So kind of like what a BOT DLL would do , but then in a form of an EXE file. Lets say you could make a real-time 2d viewer of the HL2 game... would it be possible. Or is this just stupid?

VIEWER.EXE -> hooks into plugin_viewer.dll -> retrieves info?

or would that make it a 'double hook' ? :S

i am just tossing around here!


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: loading a dll
Old
  (#2)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: loading a dll - 16-12-2004

You can't load a dll into memory twice, but you can use the dll from several different programs. the use of a dll is the fact, that you can have code which is needed by more than one program in your memory, and all use them, thus providing better locality for caching e.g. besides the fact that you need less memory.

so it should be possible to load the dll a second time, but then it'd have another data segment, because it's in another process. therefore it won't be easy to access the data from the HL2 process. In a perfect OS, there isnt any way to do this but interprocesscommunication which has of course to be supported by both sides. Of course this security issue isnt seen as important at all on win9x machines, but on newer OS including linux its hard work, and definately hacking, not coding any more


  
Reply With Quote
Re: loading a dll
Old
  (#3)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: loading a dll - 16-12-2004

Sounds to complicated for me heh.

In that case it would be just simpler to inheret a program into the dll and make it export data to a file so the exe program (seperated viewer) reads that file. And in fact, in that case it should not be too hard even.


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: loading a dll
Old
  (#4)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: loading a dll - 16-12-2004

Wouldn't it just be easier to use sockets instead of reading/writing files back and forth?
Should be easy enough and you can conserve bandwidth by only sending values that have changed rather than worry about delays, ect when reading a file.

Added: You could also just use the file to write the address of your data and then use Read/WriteProcessMemory to access it from the other program.

Last edited by Lazy; 16-12-2004 at 19:31..
  
Reply With Quote
Re: loading a dll
Old
  (#5)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: loading a dll - 16-12-2004

sockets? for a program that is on the server already? dunno, i am not an expert on that field.


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: loading a dll
Old
  (#6)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: loading a dll - 16-12-2004

writing a plugin and sending the data over sockets ( pipes, or however they are called on other OS ) would be definately the way to go. why do you wanna know that btw, stefan ? why do you need to load a dll twice then ? you just need to wrte a plugin to get the data out of there ...



Last edited by @$3.1415rin; 16-12-2004 at 21:38..
  
Reply With Quote
Re: loading a dll
Old
  (#7)
sfx1999
Member
 
sfx1999's Avatar
 
Status: Offline
Posts: 534
Join Date: Jan 2004
Location: Pittsburgh, PA, USA
Default Re: loading a dll - 17-12-2004

Can you spawn a new program and pass parameters somehow? Or can you use threads?


sfx1999.postcount++
  
Reply With Quote
Re: loading a dll
Old
  (#8)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: loading a dll - 17-12-2004

someone , long ago though, proposed another bot architecture. Where you had one EXE file (aka like Cheating Death) you run before you start any game. And when the game starts, the EXE file 'hooks' into that game somehow.

And then the fun begins, as you can simply add bots externally , but server-side ofcourse. THis way you could realize a similiar bot-brain -> interface thingy, though you can completely write the brain seperated and the interface too.

Its just too complicated to me imo. I'd rather do it the compilish way (ie, include a different interface.cpp to compile another bot dll).


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: loading a dll
Old
  (#9)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: loading a dll - 17-12-2004

You can do that on win32, all you need to do is inject a dll into that application using WriteProcessMemory and CreateRemoteThread.
Another way is to find a dependency of the dll and make a proxy of it, that way windows will automatically load your dll into the program's address space and you can go from there.
I'm not sure about this 100% because I think steam has a way of knowing when you do that, for example I was going to add a clock in-game so I could play fullscreen and be able to track the time.
I got my dll loaded and hooked LoadLibrary but after a while it would just die without any warning, after that I just gave up and put a real clock next to my monitor
  
Reply With Quote
Re: loading a dll
Old
  (#10)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: loading a dll - 17-12-2004

Lazy, why aren't you a heck of a bot-coder? You seem to have some pretty good knowledge about this stuff!


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com