flat assembler
Message board for the users of flat assembler.
  
       
      Index
      > Windows > Calling and DLL | 
  
| Author | 
  | 
              
| 
                  
                   vid 06 Jan 2005, 20:16 
                  why "call", just use "invoke GetTickCount" without any arugments and it should work. Anyway, you can call it youself by "call [GetTickCount]" (because "invoke something" is "call [something]", that's why it crashed) 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   denial 06 Jan 2005, 20:28 
                  No Invoke GetTickCount doesn't work! But call [GetTickCount] did work! But I don't understand something: When I write an own function with proc/endp, I have to call it through "call Progname" and not "call [Progname]"... oO What's the matter?
 
                  
                And please help me with my other questions... I really need to know it. Thank you.  | 
              |||
                  
  | 
              
| 
                  
                   msmith 06 Jan 2005, 23:15 
                  Here is a copy/paste from my program. This code works fine every day.
 
                  
                Code: invoke GetTickCount mov [_Tmp1],eax Here are 2 C style calls which work fine also. Code: cinvoke ltoa,eax,[_ConvBuf1],10 ... cinvoke system,[_IOBuffer]  | 
              |||
                  
  | 
              
| 
                  
                   HarryTuttle 06 Jan 2005, 23:18 
                  because if you call an import then
 
                  invoke addr makes call [addr] the import is just pointer to exported function; addr= pointer to dll if you make function ,it has own address not pointer to the address so you call addr addr = proc if you type invoke it means for example call [00041000] and data placed under this address can jumps to the forbidden addres which has no access to execute. every is clear? _________________ Microsoft: brings power of yesterday to computers of today.  | 
              |||
                  
  | 
              
| 
                  
                   msmith 06 Jan 2005, 23:21 
                  BTW, here is the cinvoke stuff I used in the previous post.
 
                  
                Code: ;declares a cdecl procedure macro cproc name,[params] { common name: push ebp mov ebp, esp virtual at ebp +8 if ~ params eq forward local ..params ..params dd ? params equ ..params common end if end virtual local ..dynamic_data,..dynamic_size dynamic_data equ ..dynamic_data dynamic_size equ ..dynamic_size virtual at ebp - dynamic_size dynamic_data: } macro center { dynamic_size = $ - dynamic_data end virtual sub esp,dynamic_size } macro cret { add esp,dynamic_size pop ebp ret } ;calling/ invoking a cdecl procedure macro ccall proc,[arg] ; call cdecl procedure { common local ..param_num ..param_num=0 reverse push arg ..param_num = ..param_num + 4 common call proc add esp, ..param_num } macro cinvoke proc,[arg] ; invoke cdecl procedure (indirect) { common if ~ arg eq ccall [proc],arg else call [proc] end if }  | 
              |||
                  
  | 
              
| 
                  
                   denial 07 Jan 2005, 11:26 
                  Thank you for all your answers. Except the calling-conventions, everything is clear now. However, "invoke GetTickCount" I can't use because FASM gives me errors. I'm confused about. But however, I can use call and understand the system now.
 
                  
                Thank you very much. And if someone knows about calling-conventions, I would be glad for a further answer.  | 
              |||
                  
  | 
              
< Last Thread | Next Thread >  | 
    
Forum Rules: 
  | 
    
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.