View previous topic :: View next topic |
Author |
Message |
Youx
Joined: 08 Jan 2006 Posts: 9
|
Posted: Mon Jan 09, 2006 8:38 Post subject: Retrieving configuration into plugins. |
|
|
Hi all.
Since i'm not really used to the dll stuff, i'd like to know how i could retrieve configuration (ie port passed to nwnx2.exe in a commandline) into the dll.
Is it possible to
* pass arguments to a dll when you load it?
* call in the dll a function which is in the .exe (which would return the data)?
* call in the exe a function which is in the dll?
* use a shared memory segment to do this (well, that would be The Dirty Way (tm) i guess )
Thanks |
|
Back to top |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
Posted: Fri Jan 13, 2006 19:27 Post subject: |
|
|
Since the plugins attach to the nwserver process and nwnx.exe is a totally seperate process, there is no easy way to exchange information between them (which, as I might add, is a shortcoming of the current architecture). Think of two entirely seperate programs on on machine.
The easiest and by far most common option is to add a plugin specific [section] to the nwnx.ini file and get your parameters from there. _________________ Papillon |
|
Back to top |
|
|
Youx
Joined: 08 Jan 2006 Posts: 9
|
Posted: Sun Jan 15, 2006 14:23 Post subject: |
|
|
Papillon wrote: | Since the plugins attach to the nwserver process and nwnx.exe is a totally seperate process, there is no easy way to exchange information between them (which, as I might add, is a shortcoming of the current architecture). Think of two entirely seperate programs on on machine.
The easiest and by far most common option is to add a plugin specific [section] to the nwnx.ini file and get your parameters from there. |
Yeah, i noticed that after digging into the code ... nwnx is only used for dll injection ...
I can't use a config part in nwnx.ini since i wanted to differentiate two running servers (for example by port)
I guess there is no solution for now ... |
|
Back to top |
|
|
Themicles
Joined: 23 Jan 2005 Posts: 30 Location: Wolverine Lake, MI
|
Posted: Mon Jan 23, 2006 8:22 Post subject: |
|
|
One solution is to make a copy of the NWNX files only, in another folder. Then have that copy of NWNX still launch the extra server from the main dedicated server folder. In this way, you can have two seperately configured INI files.
Not the perfect solution, but with NWNX not being very big compared to two seperate dedicated server copies, it's pretty reasonable.
I hope having different INI settings for two different servers on the same computer is what you meant by "differentiate two running servers". _________________ World Leader of Tairis'nądur http://www.tairisnadur.com
Member World of CoPaP http://www.copap.org |
|
Back to top |
|
|
Youx
Joined: 08 Jan 2006 Posts: 9
|
Posted: Fri Feb 10, 2006 20:51 Post subject: |
|
|
i think i just found a nice way of doing this
*drums*
PID
1 )We can retrieve the pid from the launched server in nwnx (since we got a process handler)
2 )We can retrieve the pid from the server in the dll by ... using GetCurrentProcessId(). (i just discovered that)
Imagine ... write information from nwnx in a
"<serverpid>.pid" file
and in the dll, read it and retrieve information ...
here you are |
|
Back to top |
|
|
|