Author Topic: Win32 sample needed  (Read 6726 times)

nobody

  • Guest
Win32 sample needed
« on: September 26, 2005, 01:28:31 PM »
I need a example to create an application which can load through "LoadLibraryA" and "GetProcAddress" the "MessageBoxA" function (get it??? know i write a bit fuzzy :-P)

nobody

  • Guest
Re: Win32 sample needed
« Reply #1 on: October 02, 2005, 06:37:30 PM »
; Assemble with:
; nasm -fobj msg.asm
; alink -subsys win -oPE msg.obj -o msg.exe

import  LoadLibrary     kernel32.dll LoadLibraryA
import  GetProcAddress  kernel32.dll
import  ExitProcess     kernel32.dll

extern  LoadLibrary
extern  GetProcAddress
extern  ExitProcess

section code use32
..start
        push    dword user32
        call    [LoadLibrary]
        push    dword MessageBox
        push    eax
        call    [GetProcAddress]
        push    byte 0
        push    dword Hello
        push    dword Title
        push    byte 0
        call    eax
        push    byte 0
        call    [ExitProcess]

user32          db "user32", 0
MessageBox      db "MessageBoxA", 0
Hello           db "Hello friend", 0
Title           db "Written in NASM", 0

-------------
nmt