flat assembler
Message board for the users of flat assembler.
  
       
      Index
      > Windows > PE64: how can I start an exe with ShellExecuteA? | 
  
| Author | 
  | 
              
| 
                  
                   fasmnewbie 28 Feb 2018, 15:58 
                  You got the parameters all wrong for ShellExecuteA. Shell Execute is defined here: https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153(v=vs.85).aspx
 
                  
                Also I don't see any null-terminated strings for all your string data. Use a simple test case, for example, using "ping" for your _software and "yahoo.com" for your _param. This way you have some time delay window to see the actual output (whether it works or not).  | 
              |||
                  
  | 
              
| 
                  
                   DimonSoft 28 Feb 2018, 16:11 
                  lucbert wrote: Hello! First of all, I’d suggest you to switch from ANSI to Unicode functions. 64-bit applications are not going to run on any Windows version without W-functions anyway. As for the passing the parameters, in Microsoft x64 calling convention used by WinAPI functions you pass only 4 parameters with registers, the rest is pushed onto the stask right-to-left. The last two in your case. Besides, you’re overwriting the value of RCX just before the call.  | 
              |||
                  
  | 
              
| 
                  
                   fasmnewbie 28 Feb 2018, 16:13 
                  Ok, since today is my 7th "anniversary" on this board, I modified your source to run as an object source so that you can compile it from command prompt instead. I use "ping" to "yahoo.com". Enjoy and good luck.
 
                  
                Code: ;fasm this.asm ;golink /console this.obj kernel32.dll user32.dll shell32.dll format MS64 COFF public start extrn MessageBoxA extrn ShellExecuteA extrn ExitProcess section '.data' data readable writeable _action db 'open',0 _software db 'ping',0 _param db 'yahoo.com',0 _capzion db 'Setup start',0 _message db 'Start!',0 _capzion2 db 'Setup end',0 _message2 db 'End!',0 section '.text' code readable executable start: sub rsp,8*7 mov r9d,0 lea r8,[_capzion] lea rdx,[_message] mov rcx,0 call MessageBoxA mov qword[rsp+40],5 ;SW_SHOW mov qword[rsp+32],0 ;PATH mov r9,_param mov r8,_software mov rdx,_action mov rcx,0 call ShellExecuteA mov r9d,0 lea r8,[_capzion2] lea rdx,[_message2] mov rcx,0 call MessageBoxA xor ecx,ecx call ExitProcess  | 
              |||
                  
  | 
              
< Last Thread | Next Thread >  | 
    
Forum Rules: 
  | 
    
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.