News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Fun with fake procs

Started by jj2007, November 17, 2010, 09:55:02 PM

Previous topic - Next topic

drizz

What is the purpose of this?

OTOMH, If you want local variables at entrypoint :
.code
Entrypoint proc
LOCAL buffer[1024]:BYTE
LOCAL MyVar:DWORD

leave; not really needed
invoke Exitprocess,0
Entrypoint endp
end Entrypoint
I think "Entrypoint" is used as entrypoint but if it isn't use "/ENTRY:Entrypoint"
The truth cannot be learned ... it can only be recognized.

jj2007

You are a genius, drizz :bg

include \masm32\include\masm32rt.inc

.code
start proc
LOCAL wc:WNDCLASSEX
LOCAL msg:MSG
LOCAL hwnd:HWND
m2m wc.cbSize, SIZEOF WNDCLASSEX
m2m wc.style, CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc, 5678h
; ...
leave; not really needed
invoke ExitProcess, 0
start endp
end start


P.S.: No important purpose. Just for the fun of testing new tricks and shaving off a few bytes here and there  :wink

Antariy

#17
Quote from: drizz on November 18, 2010, 06:56:32 PM
I think "Entrypoint" is used as entrypoint but if it isn't use "/ENTRY:Entrypoint"

It is will used as entry point - assembler writes directive "/ENTRY:XXX" to the object file when find "end XXX".

Jochen, entry point is just a code which can have anything construction, with prologue, or without - have no meaning.

Personally I did not use format of template files as they is, and if you find some early my code posted here, you will find something like:

.code _TEXT

align 16
start proc uses ebx edi

invoke GetCurrentProcess

invoke SetPriorityClass,eax,REALTIME_PRIORITY_CLASS
invoke Sleep,0
...........


:P

uses ebx edi because further exiting is by ret, not by ExitProcess...



Alex