Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 19:15

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



c++ dll exportierte varaiblen

Discussion on c++ dll exportierte varaiblen within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: May 2010
Posts: 793
Received Thanks: 268
c++ dll exportierte varaiblen

c++ dll konnen ja neben Funktionen auch variablen Exportieren.
an die adressen der funktionen komme cih mittels GetProcAddress, wie bekomme ich die adressen von Exportieren Varablen?
genauso?

hie ein beispiel von GetProcAddress aus einem meiner programme

c++ code:
PHP Code:
void ThisCall(char modNamechar funcNameint paramsint paramsAnzvoidthisPionter)
{

    
HMODULE hMod GetModuleHandleA(modName);
    if(
hMod == 0){
        
MessageBox(0,L"Module nicht gefunden",L"FAIL",0);
        
MessageBoxA(0,modName,"Module Name:",0);
        return;
    }
    
unsigned int FuncP =  (unsigned int)GetProcAddress(hModfuncName);
    if(
FuncP == 0){
        
MessageBox(0,L"Function nicht gefunden",L"FAIL",0);
        
MessageBoxA(0,funcName,"Function Name:",0);
        return;
    }
    
paramsAnz;
    
intlastPlus1 = &params[paramsAnz];
    
_asm
    
{
        
push eax
        push ebx
        push ecx
        push edx

        mov ebx
params
        mov ecx
lastPlus1
startLoop
:
        
cmp ebxecx
        je end
        sub ecx
,4
        mov eax
, [ecx]
        
push eax
        jmp startLoop
end
:
        
mov ecxthisPionter
        call FuncP


        pop edx
        pop ecx
        pop ebx
        pop eax
    
}

nkkk is offline  
Old 06/12/2010, 13:46   #2
 
elite*gold: 0
Join Date: May 2008
Posts: 489
Received Thanks: 210
Code:
#include <windows.h>

extern "C" __declspec(dllexport) int glob = 1337;

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
	return TRUE;
}
Code:
#include <windows.h>
#include <iostream>

int main()
{
	HMODULE dll = LoadLibraryA("dll.dll");
	int* test = (int*)GetProcAddress(dll, "glob");
	std::cout<<*test;
	return 0;
}
schlurmann is offline  
Thanks
2 Users
Reply




All times are GMT +1. The time now is 19:15.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.