Here is a simple DLL demo :
; Console functions from the Masm32 package
include ConsFuncs.inc
.code
LibMain PROC instance:DWORD,reason:DWORD,unused:DWORD
mov eax,1
ret
LibMain ENDP
StrLen PROC item:DWORD
mov eax,item
push ebx
lea edx,[eax+3]
@@:
mov ebx,[eax]
add eax, 4
lea ecx,[ebx-01010101h]
not ebx
and ecx,ebx
and ecx, 80808080h
jz @B
test ecx,00008080h
jnz @F
shr ecx,16
add eax,2
@@:
shl cl,1
sbb eax,edx
pop ebx
ret
StrLen ENDP
locate PROC x:DWORD,y:DWORD
LOCAL hOutPut :DWORD
invoke GetStdHandle,STD_OUTPUT_HANDLE
mov hOutPut, eax
mov ecx, x
mov eax, y
shl eax, 16
mov ax, cx
invoke SetConsoleCursorPosition,hOutPut,eax
ret
locate ENDP
StdOut PROC lpszText:DWORD
LOCAL hOutPut :DWORD
LOCAL bWritten :DWORD
LOCAL sl :DWORD
invoke GetStdHandle,STD_OUTPUT_HANDLE
mov hOutPut, eax
invoke StrLen,lpszText
mov sl, eax
invoke WriteFile,hOutPut,lpszText,sl,ADDR bWritten,NULL
mov eax, bWritten
ret
StdOut ENDP
ClearScreen PROC
LOCAL hOutPut:DWORD
LOCAL noc :DWORD
LOCAL cnt :DWORD
LOCAL sbi :CONSOLE_SCREEN_BUFFER_INFO
invoke GetStdHandle,STD_OUTPUT_HANDLE
mov hOutPut, eax
invoke GetConsoleScreenBufferInfo,hOutPut,ADDR sbi
mov eax, sbi.dwSize
push ax
rol eax, 16
mov cx, ax
pop ax
mul cx
cwde
mov cnt, eax
invoke FillConsoleOutputCharacter,hOutPut,32,cnt,NULL,ADDR noc
invoke locate,0,0
ret
ClearScreen ENDP
END LibMain