logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Retrieving configuration into plugins.

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development
View previous topic :: View next topic  
Author Message
Youx



Joined: 08 Jan 2006
Posts: 9

PostPosted: Mon Jan 09, 2006 8:38    Post subject: Retrieving configuration into plugins. Reply with quote

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 Wink )

Thanks Smile
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Fri Jan 13, 2006 19:27    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
Youx



Joined: 08 Jan 2006
Posts: 9

PostPosted: Sun Jan 15, 2006 14:23    Post subject: Reply with quote

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 ... Sad
Back to top
View user's profile Send private message
Themicles



Joined: 23 Jan 2005
Posts: 30
Location: Wolverine Lake, MI

PostPosted: Mon Jan 23, 2006 8:22    Post subject: Reply with quote

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. Wink

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
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Youx



Joined: 08 Jan 2006
Posts: 9

PostPosted: Fri Feb 10, 2006 20:51    Post subject: Reply with quote

i think i just found a nice way of doing this Twisted Evil

*drums*

PID Wink


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 Rolling Eyes
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group