NWNX2 Executable Released to the Public!

Avlis Headlines - www.avlis.org

Moderator: Event DM

Anebril
Newbie
Posts: 2
Joined: Thu Feb 13, 2003 11:10 am

Post by Anebril » Sat Mar 08, 2003 9:35 am

Anebril wrote:I also had the server hang during the first day of using it. I was running a mod on version 1 for 2-3 weeks or so with no problems. Running XP. All I saw in the logs was :

* NWNX2 shutting down.

Restarted it. Will keep monitoring and let you know if it happens again.
Crashed 2 more times in the past 24 hours. Did not restart module either time. Definitely something wrong :(

Pap, any way to add some more logging that might help track the cause of the crash down?
Papillon
Team Member; Retired with Honors
Posts: 3155
Joined: Thu Jul 18, 2002 11:17 pm
Contact:

Post by Papillon » Sat Mar 08, 2003 10:59 am

Apparently, there are about 4 people that experience hangs with NWNX2. Please give me some information on your system (os, nwn version, etc.) and maybe add a link where I can download the module so I can reproduce the problem. Send all the info to my email address, please.

[url]mailto:papillon@blackdagger.com[/url]
Rowell
Newbie
Posts: 5
Joined: Thu Mar 06, 2003 2:32 pm
Contact:

Post by Rowell » Mon Mar 10, 2003 8:23 pm

Any luck in reproducing the problem?
FastFrench
Whiney Peasant
Posts: 15
Joined: Wed Jan 29, 2003 10:42 am

Post by FastFrench » Fri Apr 11, 2003 11:20 am

@Papillon, in case you still look at this forum from time to time...
I would like to also hook GetLocalString, instead of only SetLocalString. This way it would be possible to make a much more efficient system. There're some aspect with assembly language that I still have to learn (for instance to return proper string), but I feel confident to find a solution.
But I can't find any solution to figure the proper values to locate the proper function. Could you tell me how you found the values you're using in FindHook (0x8b, 0x44, ...) ? How can I find the equivalent for the GetLocalString function ?

DWORD FindHook()
{
char* ptr = (char*) 0x400000;
while (ptr < (char*) 0x600000)
{
if ((ptr[0] == (char) 0x8b) &&
(ptr[1] == (char) 0x44) &&
(ptr[2] == (char) 0x24) &&
(ptr[3] == (char) 0x04) &&
(ptr[4] == (char) 0x6a) &&
(ptr[5] == (char) 0x01) &&
(ptr[6] == (char) 0x6a) &&
(ptr[7] == (char) 0x03)
)
return (DWORD) ptr;
else
ptr++;
}
return NULL;
}


Thanks if you read this and can give me a clue
Papillon
Team Member; Retired with Honors
Posts: 3155
Joined: Thu Jul 18, 2002 11:17 pm
Contact:

Post by Papillon » Fri Apr 11, 2003 1:59 pm

Finding the location of the functions involves some major debugging. I had a module running SetLocalString once every second and used that to trace through the code until I found the right function. Was quite a lot of work, I can tell you. If you want to make your life easier, use the Linux version and gdb instead, because that contains the functions names in the executable.

Finally, a little advice: I wouldn't try to hook GetLocalString. The way that functions works makes it impossible for madcodehooklib to hijack at the right spot (because it can only hook whole functions, not somewhere in the middle). Been there, done that.
FastFrench
Whiney Peasant
Posts: 15
Joined: Wed Jan 29, 2003 10:42 am

Post by FastFrench » Fri Apr 11, 2003 3:55 pm

Thank you for your answer.

I didn't plan to intercept the call on the return way, but before the former GetLocalString is called. So I think it should be possible.

What I have in mind is to avoid calling the original functions when NWNX is targeted:
SetLocalString would only be used to set a record into the database, wouldn't be used to really change anything in NWNServer memory space if the command targets NWNX (used for SQL commands like 'INSERT', 'UPDATE'... all orders that don't need return values)

GetLocalString would be used to retreive datas from the database (or other structures). Like for SetLocalString, if NWNX is the target of the GetLocalString call, then the original function would not even need to be called.

Also, still with optimization in mind, I consider to directly use MySQL api, instead of ODBC. Seems that ODBC layer is quite time consuming... and MySQL seems to be the most widely used database.

Or... maybe I won't do anything at all, as one could say it's working and it wouldn't save much CPU time (and so much other things to do for my mod and server). Who knows :wink:

BTW, don't you fear that those first 8 bytes may change in some future release of NWN Server ?
Post Reply