can be found here:

http://194.65.3.199/win32asm/


3 examples ONLY NASM without no linker and no resource builder :

1 -- simple message

2 -- simple window

3 -- Dialog Based

4 -- DLL
Posted on 2004-02-22 05:39:57 by Nguga
%define ONLY_NASM
%include "\lab\vasm\inc\nagoa.inc"

section .data

section .text

__start:

nasm MessageBox , NULL,"info","title",MB_OK
xor eax,eax
ret



; --- [ IMPORTS MUST BE THE LAST PART OF PROGRAM ]


LAST_BEGIN

__LIBS_ user32, "user32.dll"

__IMPORT_ user32,MessageBox, "MessageBoxA",0

LAST_END




;-------------------------------------------
; BIN OPTION IN NAGOA RAD IDE
; in NAGOA RAD IDE menu go to , project -> build settings -> BIN
;-------------------------------------------
Posted on 2004-02-22 05:42:07 by Nguga
%define ONLY_NASM
%include "\lab\vasm\inc\nagoa.inc"

section .data

hInst dd 0
ClassName db "NaGoA" , 0
WindowName db " only NASM no linker ! " , 0


section .text


__start:


proc WinMain,
stack msgs,MSG_size
stack hWnd,4
stack WC, WNDCLASSEX_size


nasm RtlZeroMemory,ADDR_ WC,WNDCLASSEX_size
mov dword ,WNDCLASSEX_size
mov dword ,CS_VREDRAW + CS_HREDRAW + CS_DBLCLKS
mov dword , WndProc
mov dword ,15
mov dword , ClassName
m2m ,
nasm LoadIconA,,IDI_APPLICATION
mov , eax
mov , eax
nasm LoadCursorA,,IDC_ARROW
mov , eax
nasm RegisterClassExA, ADDR_ WC

nasm CreateWindowExA, WS_EX_WINDOWEDGE + WS_EX_CLIENTEDGE,\
ClassName,WindowName,\
WS_OVERLAPPEDWINDOW,200,\
200,200, 200,\
NULL,NULL,,NULL

nasm ShowWindow,eax,TRUE
nasm UpdateWindow,0

msg_loop:

nasm GetMessageA,ADDR_ msgs ,0,0,0
or eax,eax
jz Fin_Bucle
nasm DispatchMessageA, ADDR_ msgs
jmp msg_loop

Fin_Bucle:
nasm ExitProcess,0
endproc

proc WndProc, hwnd, msg, wParam, lParam

stack hdc,4
stack rect,RECT_size
stack ps,PAINTSTRUCT_size

mov eax,
cmp eax, WM_PAINT
je .WM_PAINT
cmp eax, WM_DESTROY
je .WM_DESTROY
nasm DefWindowProcA,,,,
return

.WM_PAINT:


nasm BeginPaint,,ADDR_ ps ;eax
mov ,eax
nasm GetClientRect,,ADDR_ rect

nasm DrawTextA,,"Hi everybody!!!",\
-1,ADDR_ rect ,\
DT_SINGLELINE + DT_CENTER + DT_VCENTER

nasm EndPaint, ,ADDR_ ps
return

.WM_DESTROY:
nasm PostQuitMessage,0
endproc










; -------- MUST BE THE LAST PART OF PROGRAM

LAST_BEGIN


__LIBS_ kernel32, "kernel32.dll", \
user32, "user32.dll"

__IMPORT_ kernel32, \
GetModuleHandleA, "GetModuleHandleA", 0, \
ExitProcess, "ExitProcess", 0,\
RtlZeroMemory,"RtlZeroMemory",0

__IMPORT_ user32, \
MessageBox, "MessageBoxA", 0, LoadIconA, "LoadIconA", 0, \
LoadCursorA, "LoadCursorA", 0, RegisterClassExA, "RegisterClassExA", 0, \
CreateWindowExA, "CreateWindowExA", 0, ShowWindow, "ShowWindow", 0, \
GetMessageA, "GetMessageA", 0, DispatchMessageA, "DispatchMessageA", 0 ,\
DefWindowProcA, "DefWindowProcA", 0, BeginPaint, "BeginPaint", 0, \
GetClientRect, "GetClientRect", 0, EndPaint, "EndPaint", 0, \
DrawTextA, "DrawTextA", 0, PostQuitMessage, "PostQuitMessage", 0, \
UpdateWindow, "UpdateWindow", 0, GetWindowRect, "GetWindowRect", 0, \
GetDesktopWindow, "GetDesktopWindow", 0, MoveWindow, "MoveWindow", 0


LAST_END







; PROJECT BUILD SETTINGS
; COMPILE BIN OPTION
; IN NAGOA RAD IDE
Posted on 2004-02-22 05:44:40 by Nguga
%define ONLY_NASM
%define RSRC
%include "\lab\vasm\inc\nagoa.inc"


section .data

hInst dd 0


; - - - - - - - - - - - - - - - - - - - -
section .text

__start:
nasm DialogBoxParam,,200,0,DlgProc,0
ret
; - - - - - - - - - - - - - - - - - - - -
proc DlgProc ,hdlg, msg, wParam,lParam

cmp dword , WM_INITDIALOG
je .WM_INITDIALOG
cmp dword , WM_COMMAND
je .WM_COMMAND
cmp dword , WM_CLOSE
jne .next_msg
nasm ExitProcess , 0
.next_msg
return FALSE

; - - - - - - - - - - - - - - - - - - - -
.WM_INITDIALOG:
nasm LoadMenu,,100
nasm SetMenu,,eax
nasm SetDlgItemText,,400,"The Dialog!"
return TRUE
; - - - - - - - - - - - - - - - - - - - -
.WM_COMMAND:
cmp dword , 51
je .about
cmp dword , 52
je .help
cmp dword , 300
jne .next_1
nasm EndDialog,,0
.next_1
return


; - - - - - - - - - - - - - - - - - - - -
.about:
nasm MessageBox,,{ "This Dialog!:", 10, 13,"(c) numit_or 2002 "} ,\
"About This Dialog!",MB_OK
return
; - - - - - - - - - - - - - - - - - - - -
.help:
nasm MessageBox,,{ "This Dialog: demostrates the use of", 10, 13,\
"resourses in flat PE programming" } , "About This Dialog!",MB_OK
return
; - - - - - - - - - - - - - - - - - - - -



endproc ; END DIALOGPROC ( - :







; --- [ THIS MUST BE THE LAST PART OF PROGRAM ]


LAST_BEGIN

%include "RC.ASM"

__LIBS_ kernel32, "kernel32.dll", \
user32, "user32.dll"



__IMPORT_ kernel32,\
GetModuleHandle, "GetModuleHandleA",0,\
GetLastError, "GetLastError",0,\
ExitProcess, "ExitProcess",0


__IMPORT_ user32,\
MessageBox, "MessageBoxA",0, \
DialogBoxParam, "DialogBoxParamA",0, \
LoadMenu, "LoadMenuA",0, \
SetDlgItemText, "SetDlgItemTextA",0, \
SetMenu, "SetMenu", 0, \
EndDialog, "EndDialog", 0

LAST_END
Posted on 2004-02-22 05:46:05 by Nguga
DS_MYDIALOG equ DS_MODALFRAME+DS_CENTER+DS_SETFONT+WS_MINIMIZEBOX+WS_POPUP+WS_VISIBLE+WS_CAPTION+WS_SYSMENU
BS_MYBUTTON equ BS_PUSHBUTTON +BS_CENTER +BS_FLAT+WS_CHILD+WS_VISIBLE+WS_TABSTOP
ES_MYEDIT equ ES_LEFT+ES_READONLY+WS_CHILD+WS_VISIBLE+WS_BORDER





RESOURCES MENU, 1, DIALOG, 1


BEGIN_RES_MENU
RES_MENU 100
END_RES_MENU


BEGIN_RES_DIALOG
RES_DIALOG 200
END_RES_DIALOG


menu_1:
BeginOfMenu
PopupMenuItem "&File"
NormalMenuItem ENDMENU, 300, "&Close"
PopupMenuItem "&Help", 0
NormalMenuItem 0, 51, "&About"
NormalMenuItem MENUBREAK, 0, 0 ; <- add a zero here
NormalMenuItem ENDMENU, 52, "&Help"
end_menu_1

; -------------------------------------------------------------------------------------

dlg_1:

BEGIN_DIALOG DS_MYDIALOG, 0, 2, 10, 10, 130, 55, 0
CAPTION "Dialog made using NASM"
FONT 8, "MS Sans Serif"

BeginControl BS_MYBUTTON, 0, 20, 5, 30, 14, 300, BUTTON
UTEXT "&Close"
EndControl

BeginControl ES_MYEDIT, 0, 58, 5, 48, 12, 400, EDIT
NOTEXT
EndControl
END_DIALOG

end_dlg_1
Posted on 2004-02-22 05:47:03 by Nguga
%define ONLY_NASM
%define DLL
%include "\lab\vasm\inc\nagoa.inc"


section .text

__start:

proc DllEntry, hInstDLL, reason, reserved
return TRUE
endproc


proc funct1, arg_1, arg_2
nasm MessageBox, NULL,,,MB_OK
return TRUE
endproc



proc funct2, arg_1, arg_2
nasm MessageBox , NULL,,,MB_OK
return TRUE
endproc



proc funct3, arg_1, arg_2
nasm MessageBox , NULL,,,MB_OK
return TRUE
endproc





; - - MUST BE THE LAST THING IN THE CODE ALWAYS

LAST_BEGIN

__EXPORTS_ "PE_DLL.DLL",\
funct1, "funct1", \
funct2, "funct2", \
funct3, "funct3"


__LIBS_ user32,"user32.dll"

__IMPORT_ user32,\
MessageBox, "MessageBoxA", 0
LAST_END






; PROJECT -> BUILD SETTINGS -> COMPILE BIN

; PROJECT -> MAKE A DLL

; IN NAGOA RAD IDE
Posted on 2004-02-22 05:48:54 by Nguga
Thanks nuMIT_or for NPEMAC.INC !!!

:)
Posted on 2004-02-22 05:51:22 by Nguga
Thanks :)
Posted on 2004-02-25 07:26:36 by ZobySound