Hello! I am trying to make a Get Address and Call function for darkbasic and what it is suppose to do is get the address of a USER(not dll) function and then using call be able to to call the function and it go to it
it is still in testing stage and of course it is not suppose to just be this, this is just a testing
now then
my C++ code
#include <windows.h>
#include "globstruct.h"
//?ReceiveCoreDataPtr@@YAXPAX@Z
GlobStruct *g_pGlob;
void ReceiveCoreDataPtr( void *cdp ){
g_pGlob = (GlobStruct *) cdp;
}
extern "C"{
DWORD dbpstring(LPSTR pstring)
{
LPSTR pret=NULL;
DWORD dwSize=strlen((LPSTR)pstring );
g_pGlob->CreateDeleteString ( (DWORD*)&pret, dwSize+1 );
strcpy(pret, (LPSTR)pstring);
return (DWORD) pret;
}
DWORD test1(){
return dbpstring("HELLO WORLD!!");
}
typedef struct{
char *name;
void *next;
}name;
name *names;
unsigned int last=0;
DWORD temp;
char *ptr;
DWORD Get_Address(DWORD name){ //ggets the address of a user function -- must be called at the first line
__asm(".intel_syntax noprefix\n"
"pop _temp\n"
"push _temp\n" //pushes back the address, but has temp filled
".att_syntax\n");
// malloc(strlen(name));
return temp;
}
//typedef void*(func)();
DWORD call2;
void Call1(DWORD address){
call2=address;
__asm(".intel_syntax noprefix\n"
//"pop call2\n"
"call [_call2]\n" //call what is stored at call2
".att_syntax\n");
return;
}
}
and my testing dbp code
`testing program for GetAddress DLL
test AS DWORD
testing1()
Call test
wait key
function testing1
test=Get Address("testing1") `this MUST be the first line of the function
print "hello world"
endfunction
and I guess that's it
btw yes I know the naming system thing don't work