flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
comrade
Try:
Code: .cProcess rb sizeof.PROCESSENTRY32 And should you not lea .cProcess when passing it to Process32First? |
|||
![]() |
|
comrade
I found problem, this happen because you define PROCESSENTRY32 after code, and before data. That is why it work in data section and not in code.
Strange, but I thought FASM would do additional passes to resolve this structure definition... But this is parser (?) stage and passes are done in assembly stage only? |
|||
![]() |
|
JohnFound
Code: proc ListProcesses .SnapShot dd 0 .cProcess PROCESSENTRY32 enter invoke CreateToolhelp32Snapshot, TH32CS_SNAPPROCESS, 0 mov [.SnapShot],eax ;setup code for processentry crap here, it works. lea eax, [.cProcess] invoke Process32First,[.SnapShot], .cProcess ;code here .bListProc: ;code here jmp .bListProc .eListProc: ;code here return Hi. Try above. It should work. Note that you can't get the address of local variable in assembly time, because this address is simply unknown (local variables are in the stack). Other assemblers work the same way, but simply hides this from you. Regards. |
|||
![]() |
|
Tommy
John, ain't
Code: lea eax, [.cProcess] invoke Process32First,[.SnapShot], .cProcess Code: lea eax, [.cProcess] invoke Process32First,[.SnapShot], eax Tommy |
|||
![]() |
|
JohnFound
Hi, Tommy.
Of course you are right. I am still sleeping this morning. ![]() Regards. |
|||
![]() |
|
Tommy
![]() |
|||
![]() |
|
Kevin_Zheng
One Error: The local variable can't initalize on complier period.
So the define is invalid: Code: .SnapShot dd 0 It should be the belowing : Code: .SnapShot dd ? or Code: .SnapShot rd 1 |
|||
![]() |
|
JohnFound
Kevin_Zheng wrote: One Error: The local variable can't initalize on complier period. Of course local variables can not be initialized on compile time, but actually this is not an error. The compilation will pass normally, only you should know that this variable will be initialized with random (even on every call of procedure) value. Regards. |
|||
![]() |
|
GuyonAsm
Thanks guys, I'll try this out when I get home. If it works I'll be able to make the code for a project im working on( and even future windows oriented projects) that much more efficient, when it comes to procedures. Once again thanks everyone for the replys.
_________________ I shall not evade what is predestined because every battle, is another lesson - GuyonAsm. A Believer of The System. |
|||
![]() |
|
GuyonAsm
comrade wrote: Try: Hmm, so when i do this, could i do as they do in nasm and go Code: mov [.cProcess+PROCESSENTRY32.dwSize],sizeof.PROCESSENTRY32 would that work when filling that or what? Thanks everyone for the advice, i'll answer back here with my results. EDIT EDIT EDIT EDIT NEW NEW NEW EDIT EDIT EDIT EDIT New problem arising now. Code: proc ListProcesses, sck .SnapShot rd 1 .Process32 rb sizeof.PROCESSENTRY32 .Process rb 256 .PID rb 12 .Threads rb 12 enter invoke CreateToolhelp32Snapshot,2,0 mov [.SnapShot],eax mov dword [.Process32+PROCESSENTRY32.dwSize],sizeof.PROCESSENTRY32 lea eax,[.Process32] invoke Process32First,[.SnapShot],eax _bListProc: cmp eax,1 jne _eListProc lea eax,[.Process] ;the error is occuring here. invoke lstrcpyn,eax,szCmd3,2 ;code here jmp _bListProc _eListProc: ;code here return on the line lea eax,[.Process] i get "undefined symbol"... yet the freaking symbol is declared in the local right there. Now as i test renaming the variable to something else its the exact same thing, so im coming to the conclusion that maybe these lea instructions aren't gonna work with the proc? I hope im not forced to make all these global variables, thereby wasting memory in the prog.... _________________ I shall not evade what is predestined because every battle, is another lesson - GuyonAsm. A Believer of The System. |
|||
![]() |
|
JohnFound
It is not because of local variables.
You simply forget to define some of the structures. You MUST define them in your source if they are not defined in standard include files. Regards. |
|||
![]() |
|
GuyonAsm
i've used the processentry32 structure before, as ive included it myself inside the kernel equates. I know that the structure is there because when using *cough* global variables, it worked perfectly, but here we go again with this local variable crap. =(
nm now though, I think im just gonna use all gloval variables for this. the next thing I work on (which will be the flat assembler instant messenger(FAIM)) I will try this again.... ![]() _________________ I shall not evade what is predestined because every battle, is another lesson - GuyonAsm. A Believer of The System. Last edited by GuyonAsm on 24 Dec 2003, 17:43; edited 1 time in total |
|||
![]() |
|
silkodyssey
GuyonAsm,
Will the instant messenger use existing protocols like msn's or yahoo's? _________________ silkodyssey |
|||
![]() |
|
GuyonAsm
Its something VeSCeRa and I are gonna put together, perhaps with the help of others. So far it'll be Icq and Aim. Perhaps if we get documentation on other protocols, we could include those later on also.
_________________ I shall not evade what is predestined because every battle, is another lesson - GuyonAsm. A Believer of The System. |
|||
![]() |
|
vid
GuyonAsm: no harm, but i think you shouldnt be using macros unless you know how they are working. I advice you to study 'proc', 'enter', 'return', 'invoke' and mainly 'pushd' which will tell you about 'addr' pseudo operator which can be used instead of lea.
|
|||
![]() |
|
Dunduk
GuyonAsm wrote:
Try Code: lea eax,[ListProcesses.Process] It should work. ".Process" - is local label IMHO and after " _bListProc" label fasm didn't see it (oh, my english...). I think so. |
|||
![]() |
|
GuyonAsm
Well gosh darn, I think your right. And yes sir it works. Thanks alot. Now i can continue on with my project. To discontinue any temptation of abandoning fasm to use another assembler (such as masm or etc.) I've just deleted all the assemblers i had on my comp etc. fasm. I will depend on fasm now =).
Ahh im so happy, this is a christmas present in itself. Thank you sooo much. ![]() _________________ I shall not evade what is predestined because every battle, is another lesson - GuyonAsm. A Believer of The System. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.