article

Advance Asm Calling

Email
Submitted on: 1/3/2015 11:09:00 AM
By: OpcodeVoid (from psc cd)  
Level: Advanced
User Rating: By 6 Users
Compatibility: C, C++ (general), Microsoft Visual C++, Borland C++, UNIX C++
Views: 671
 
     Advance Calling function in asembly no need for a linker with correct tables :).

 
				#include "stdafx.h"
#include "windows.h"
char * title = "Unhanlde Execpetion";
char * msg = "Proc Base Address";
char *dump = "Hello";
FARPROC DLLADDRESS;
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTRlpCmdLine,
intnCmdShow)
{
// TODO: Place code here.

HINSTANCE HI;
HI = LoadLibrary("USER32.DLL");
DLLADDRESS = GetProcAddress
(HI,"MessageBoxA");
if(DLLADDRESS == NULL)
{

MessageBox(NULL,"Dll not found","Error",MB_OK);
return 0;
}
_asm
{
//HWND
//MSG
//TITLE
//TYPE
push MB_OK
push title
push msg
push NULL
mov eax,DLLADDRESS
call eax
}
return 0;
}
//

Soure End


Your might be wondering how it works. Very simple really
I just Get the address of a function in a library then push values into the stack.
Backwards because we push data into the stack LIFO(Last in first out). If you don't understand anything email vbmew@hotmail.com


Other 5 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Advanced category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.