flat assembler
Message board for the users of flat assembler.
Index
> Windows > error: undefined symbol, are you sure? |
Author |
|
Tommy 04 Nov 2004, 21:54
that's because you're not using local labels inside the proc... you're using wdmINITDIALOG.test1... it's defined as dialog_procedureA.test1
|
|||
04 Nov 2004, 21:54 |
|
vbVeryBeginner 04 Nov 2004, 23:19
thanks tommy,
i didn't realize that once we use a : we are in another scope! Code: wdmINITDIALOG: jmp there .test1 dd ? there: lea eax,[wdmINITDIALOG.test1] lea eax,[dialog_procedureA.test1] stdcall testing,2,4,6,8 return this clear my confuse , thanks |
|||
04 Nov 2004, 23:19 |
|
revolution 05 Nov 2004, 01:22
It's not the : that makes a new scope, it is a label that does nos begin with a . that makes a new scope.
Try this with the four extra .'s instead. Code: proc dialog_procedureA,hDlg,uMsg,wParam,lParam .test1 dd ? ;define the symbol enter cmp [uMsg],WM_CLOSE je .wdmCLOSE cmp [uMsg],WM_INITDIALOG je .wdmINITDIALOG return .wdmCLOSE: invoke EndDialog,[hDlg],0 return .wdmINITDIALOG: lea eax,[.test1] ; Now it works. stdcall testing,2,4,6,8 return endp |
|||
05 Nov 2004, 01:22 |
|
vbVeryBeginner 05 Nov 2004, 03:30
thanks revolution but ...
Code: format PE GUI 4.0 entry start include '%fasminc%\win32a.inc' section '.data' data readable writeable insH dd ? wndTitle db 'On Test',0 buf1 rb 0x30 buf2 rb 0x30 f1 db '.wdmINITDIALOG -> %lu',0 f2 db '.wdmCTLCOLORSTATIC -> %lu',0 section '.code' code readable executable start: invoke GetModuleHandle,0 mov [insH],eax invoke DialogBoxParam,eax,30,NULL,dialog_procedureA,NULL proc dialog_procedureA,hDlg,uMsg,wParam,lParam .t2 dd ? enter cmp [uMsg],WM_CLOSE je .wdmCLOSE cmp [uMsg],WM_INITDIALOG je .wdmINITDIALOG cmp [uMsg],WM_CTLCOLORSTATIC je .wdmCTLCOLORSTATIC return .wdmCLOSE: invoke EndDialog,[hDlg],0 return .wdmINITDIALOG: mov [.t2],30 ;<- so, we move 30 into it mov eax,[.t2] invoke wsprintf,buf1,f1,eax invoke MessageBox,NULL,buf1,wndTitle,MB_OK return .wdmCTLCOLORSTATIC: mov eax,[.t2] ;<- now, do you have any idea invoke wsprintf,buf2,f2,eax ; why it shouldn't be 30? invoke MessageBox,NULL,buf2,wndTitle,MB_OK mov eax,FALSE return endp section '.idata' import data readable library kernel32, 'KERNEL32.DLL',\ user32, 'USER32.DLL' include '%fasminc%\apia\Kernel32.inc' include '%fasminc%\apia\User32.inc' section '.rsrc' resource data readable directory RT_DIALOG,appDialog resource appDialog,\ 30,LANG_NEUTRAL,dlgTest dialog dlgTest,'Test',0,0,170,50,\ DS_MODALFRAME + WS_VISIBLE + WS_CAPTION + WS_POPUP + WS_SYSMENU dialogitem 'STATIC','',0,5,5,100,40,SS_LEFT + WS_VISIBLE enddialog |
|||
05 Nov 2004, 03:30 |
|
revolution 05 Nov 2004, 08:23
The variable ".t2" is not a static variable. It is on the stack. Each time dialog_procedureA is called a new space is allocated within the stack. More than likely the value will be changed by many other things happening on the stack between calls the dialog_procedureA
You need to put ".t2" in the same place as buf1 and the others for it to keep values between calls. Try viewing the actual code generated in a debugger. It may help you to understand how the stack is used by the "proc" macro. |
|||
05 Nov 2004, 08:23 |
|
Matrix 05 Nov 2004, 11:06
Code: stackerproc: .t1 ; this is interpreted as stackerproc.t1 jmp .t2 ; now you see what is the case? cxz: .t2 ; this is interpreted as cxz.t2 .t4 ; this is interpreted as cxz..t4 .t3 ; this is interpreted as cxz.t3 ret local labels are referenced to the nearest global label/procedure upwards. |
|||
05 Nov 2004, 11:06 |
|
vbVeryBeginner 07 Nov 2004, 14:43
arent the stack supposely cannot be modifed?
|
|||
07 Nov 2004, 14:43 |
|
revolution 08 Nov 2004, 01:41
Stacks are always being modified. It is one of the most volitile places to store data. Once the routine returns (RET) it releases the stack for use by other code.
|
|||
08 Nov 2004, 01:41 |
|
vbVeryBeginner 08 Nov 2004, 09:22
thanks you revolution, you RET clears my confuse
ps: i am acutally quite new to assembly language, play with NASM before for a very short time, (no application produced!), any later on, i found FASM (which makes me stick until now) about 4 months already |
|||
08 Nov 2004, 09:22 |
|
revolution 09 Nov 2004, 02:04
Kembali.
PS: Selamat Hari Raya. Anda balik kampung untuk minggu depan? |
|||
09 Nov 2004, 02:04 |
|
vbVeryBeginner 09 Nov 2004, 04:54
thank you revolution never know you could speak malay hah :p
are you from malaysia? anyway, i am chinese :p 希望您开斋节快乐! i don't have kampung to balik lah :p |
|||
09 Nov 2004, 04:54 |
|
revolution 10 Nov 2004, 08:20
Saya tak cakap bahasa cina.
Saya cakap sedikit sahaja bahasa Melayu. Saya kerja dalam Malaysia sebelum ini. Suka berlatih bila-bila saya dapat peluang. |
|||
10 Nov 2004, 08:20 |
|
vbVeryBeginner 10 Nov 2004, 13:05
bagus lah, sedikit pun jadilah :p
chinese language is fun, if you got time, you could learn it maybe someday you would work in china ? |
|||
10 Nov 2004, 13:05 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.