Click here to Skip to main content
15,892,059 members
Home / Discussions / C#
   

C#

 
QuestionIssue with Session Management Pin
Member 107334468-Apr-14 3:21
Member 107334468-Apr-14 3:21 
AnswerRe: Issue with Session Management Pin
Wes Aday8-Apr-14 4:16
professionalWes Aday8-Apr-14 4:16 
QuestionInvalidCastException while changing windows service startup type Pin
AshwiniSH7-Apr-14 21:26
professionalAshwiniSH7-Apr-14 21:26 
QuestionRe: InvalidCastException while changing windows service startup type Pin
Ravi Bhavnani8-Apr-14 4:39
professionalRavi Bhavnani8-Apr-14 4:39 
Questionunable to start debugging Pin
arulbaskar7-Apr-14 3:54
arulbaskar7-Apr-14 3:54 
AnswerRe: unable to start debugging Pin
OriginalGriff7-Apr-14 4:38
mveOriginalGriff7-Apr-14 4:38 
AnswerRe: unable to start debugging Pin
ZurdoDev7-Apr-14 8:47
professionalZurdoDev7-Apr-14 8:47 
Questionc# get method object by address from C++ program Pin
Lord Baaleos7-Apr-14 0:45
Lord Baaleos7-Apr-14 0:45 
Ok, so I play a game called neverwinter nights, that has a good modding community.
They created this plugin based server addon called nwnx, which is wrote in c++ code, and allows the invoking/calling of internal nwnserver methods with the desired arguements.

The community were able to build this because bioware were kind enough to release an idb (symbols database) for decompiling the nwnserver program.

This allows us to know the exact memory locations of methods within the server application.

My question is this:
If I have memory offsets of the methods, is there anyway to bind a c# method to those locations, and invoke them from a c# program.
I am aware of appdomains and protection, but I believe I have a way around that.
I have my own nwnx plugin,that allows me to call c# code from the c++ code.
The problem with this is that its a one way call.
Once the nwn -> nwnx -> c# code is executed, it has no way of calling back from c# -> nwnx -> nwn

The good news is that all these dll plugins, are run inside the nwnserver process through dll injection.
So the appdomain protection should be bypassed.
So the question - can I, given the method locations are known, invoke them from c# code, and if so, can someone give me an example

Eg:
Given a c++ method signature of
C++
void                (__thiscall *CNWSCreature__PossessCreature)(CNWSCreature *pTHIS, nwn_objid_t oidPossessee) = (void (__thiscall*)(CNWSCreature *pTHIS, nwn_objid_t oidPossessee))0x004CD1B0;

How would I go about binding 0x004cd1b0 to a method that I can invoke in my c# code.

I know reflection can accomplish something similar with objects created in vbScript through the getref method.
eg
C#
objRef.GetType().InvokeMember("", System.Reflection.BindingFlags.InvokeMethod,
                                       null, objRef, args);

AnswerRe: c# get method object by address from C++ program Pin
Richard Deeming7-Apr-14 2:07
mveRichard Deeming7-Apr-14 2:07 
AnswerRe: c# get method object by address from C++ program Pin
BobJanova7-Apr-14 2:57
BobJanova7-Apr-14 2:57 
QuestionAdvantages of using virtual method in base class? Pin
Varun Thakur7-Apr-14 0:01
Varun Thakur7-Apr-14 0:01 
AnswerRe: Advantages of using virtual method in base class? PinPopular
OriginalGriff7-Apr-14 0:37
mveOriginalGriff7-Apr-14 0:37 
GeneralRe: Advantages of using virtual method in base class? Pin
Varun Thakur7-Apr-14 18:48
Varun Thakur7-Apr-14 18:48 
AnswerRe: Advantages of using virtual method in base class? Pin
pallelokanathareddy8-Apr-14 6:43
professionalpallelokanathareddy8-Apr-14 6:43 
QuestionHow to merger data from two sql databases that have a same structure ? Pin
taibc6-Apr-14 23:59
taibc6-Apr-14 23:59 
AnswerRe: How to merger data from two sql databases that have a same structure ? Pin
Peter Leow7-Apr-14 0:08
professionalPeter Leow7-Apr-14 0:08 
Questiondatagridview doesn´t show the datasource Pin
tom_ma6-Apr-14 21:40
tom_ma6-Apr-14 21:40 
AnswerRe: datagridview doesn´t show the datasource Pin
V.6-Apr-14 22:13
professionalV.6-Apr-14 22:13 
GeneralRe: datagridview doesn´t show the datasource Pin
tom_ma6-Apr-14 22:34
tom_ma6-Apr-14 22:34 
GeneralRe: datagridview doesn´t show the datasource Pin
V.6-Apr-14 22:45
professionalV.6-Apr-14 22:45 
GeneralRe: datagridview doesn´t show the datasource Pin
tom_ma7-Apr-14 0:24
tom_ma7-Apr-14 0:24 
GeneralRe: datagridview doesn´t show the datasource Pin
V.7-Apr-14 1:19
professionalV.7-Apr-14 1:19 
GeneralRe: datagridview doesn´t show the datasource Pin
tom_ma7-Apr-14 0:24
tom_ma7-Apr-14 0:24 
AnswerRe: datagridview doesn´t show the datasource Pin
OriginalGriff6-Apr-14 22:27
mveOriginalGriff6-Apr-14 22:27 
GeneralRe: datagridview doesn´t show the datasource Pin
tom_ma6-Apr-14 22:38
tom_ma6-Apr-14 22:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.