Advertisement
ASP_Volume3 Coding Standards #51893

Advance Asm Calling

Advance Calling function in asembly no need for a linker with correct tables :).

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
#include "stdafx.h"<br>
#include "windows.h"<br>
char * title = "Unhanlde Execpetion";<br>
	char * msg = "Proc Base Address";<br>
	char *dump = "Hello";<br>
FARPROC DLLADDRESS;<br>
int APIENTRY WinMain(HINSTANCE hInstance,<br>
      HINSTANCE hPrevInstance,<br>
      LPSTR  lpCmdLine,<br>
      int  nCmdShow)<br>
{<br>
 	// TODO: Place code here.
<p>
	HINSTANCE HI;<br>
	HI = LoadLibrary("USER32.DLL");<br>
	 DLLADDRESS = GetProcAddress<br>(HI,"MessageBoxA");<br>
	if(DLLADDRESS == NULL)<br>
	{<br><p>
		MessageBox(NULL,"Dll not found","Error",MB_OK);<br>
		return 0;<br>
	}<br>
			_asm<br>
	{<br>
		//HWND<br>
		//MSG<br>
		//TITLE<br>
		//TYPE<br>
		push MB_OK<br>
		push title<br>
		push msg<br>
		push NULL<br>
		mov eax,DLLADDRESS<br>
		call eax<br>
	}<br>
	return 0;<br>
}<br>
//<h1> Soure End </h1>
<br>
Your might be wondering how it works. Very simple really<br> I just Get the address of a function in a library then push values into the stack.<br> Backwards because we push data into the stack LIFO(Last in first out). If you don't understand anything email vbmew@hotmail.com
Original Comments (3)
Recovered from Wayback Machine