With the following asm code i try to pass a string to a loaded C++ dll file:

push DWORD PTR
call


My C++ dll function looks like this:
void TheFunction(char TheString)
{
.....
char *blabla;
blabla=&TheString;
.....
}


But it doesn't work... When i print "blabla" i can see that only the 3 first charchters are correct - the rest of the string is "corrupt" :| Any help? :/
Posted on 2005-04-02 05:25:17 by allanmc
You should pass the address of the string

and use

void TheFunction(char *TheString)
{
.....
.....
}
Posted on 2005-04-02 06:06:36 by roticv
You mean like this?

void TheFunction(char *TheString)
{
.....
char blabla;
blabla=*TheString;
.....
}


Then the application crashes:(
I'm sorry but i'm a bit noobish to pointers? :|

Edit:
And when i try to push the offset of the string, my application still crashes :/?

push offset thestring
call
Posted on 2005-04-02 06:12:38 by allanmc
It should be

void TheFunction(char *TheString)
{
.....
char blabla;
blabla=TheString[0]; // getting the first character in the string
.....
}

If I am not wrong.
Posted on 2005-04-02 07:25:02 by roticv
Still no success:( No matter what i do, either the application crash or i only see 1-3 of the first charchters:/

Should i use "DWORD PTR" or "OFFSET"? And why:S?

And who is sure what i have to write in my C++ function in order to get this to work? Someone must know for sure:o))
Posted on 2005-04-02 07:48:55 by allanmc
What do you mean by " i only see 1-3 of the first charchters"

Please give more codes to illustrate.
Posted on 2005-04-02 09:40:45 by roticv
Well i check the content of the variable by making a messagebox showing the variable.

is my string is "BlaBla" then i only get "B" in some cases, and "Bla" in other cases... I have no clue whats worng:(
Posted on 2005-04-02 10:55:42 by allanmc
It should be

push offset stringarray
call yourfunction

int yourfunction(char *string){
MessageBox(0,string,string,0);
return 0;
}


Is that what you coded?
Posted on 2005-04-02 11:25:02 by roticv
Ahhh finally it worked - thank you very much:o))

So simple code, and i didn't even try that in my 100 different tries:S :D
Posted on 2005-04-02 11:34:15 by allanmc