flat assembler
Message board for the users of flat assembler.

Index > Windows > ..

Author
Thread Post new topic Reply to topic
pool



Joined: 08 Jan 2007
Posts: 97
Location: Philippines
pool
..


Last edited by pool on 17 Mar 2013, 12:09; edited 1 time in total
Post 18 Aug 2012, 19:55
View user's profile Send private message Visit poster's website Reply with quote
Enko



Joined: 03 Apr 2007
Posts: 678
Location: Mar del Plata
Enko
Post 18 Aug 2012, 20:01
View user's profile Send private message Reply with quote
pool



Joined: 08 Jan 2007
Posts: 97
Location: Philippines
pool
..


Last edited by pool on 17 Mar 2013, 12:09; edited 1 time in total
Post 18 Aug 2012, 20:07
View user's profile Send private message Visit poster's website Reply with quote
pool



Joined: 08 Jan 2007
Posts: 97
Location: Philippines
pool
..


Last edited by pool on 17 Mar 2013, 12:09; edited 1 time in total
Post 18 Aug 2012, 20:40
View user's profile Send private message Visit poster's website Reply with quote
Enko



Joined: 03 Apr 2007
Posts: 678
Location: Mar del Plata
Enko
Works fine for me on xp 32bit.
Code:
section ".data" data readable writeable
        prog db 'mspaint.exe',0
        param db '',0


section ".code" code readable writeable executable
start:

       invoke   WinExec, prog, param
       invoke   ExitProcess, 0
                                
    


or you can use the c runtime.
http://msdn.microsoft.com/en-us/library/431x4c1w(v=vs.80).aspx

you will need to import the function from mvcrt.dll and use cinvoke insted of invoke.
Code:
import msvcrt,\  
  _wexecl,'_wexecl',\
       _wexecle,'_wexecle',\
       _wexeclp,'_wexeclp',\
       _wexeclpe,'_wexeclpe',\
       _wexecv,'_wexecv',\
       _wexecve,'_wexecve',\
       _wexecvp,'_wexecvp',\
       _wexecvpe,'_wexecvpe',\ 
    
Post 18 Aug 2012, 21:02
View user's profile Send private message Reply with quote
pool



Joined: 08 Jan 2007
Posts: 97
Location: Philippines
pool
..


Last edited by pool on 17 Mar 2013, 12:09; edited 1 time in total
Post 18 Aug 2012, 21:33
View user's profile Send private message Visit poster's website Reply with quote
Enko



Joined: 03 Apr 2007
Posts: 678
Location: Mar del Plata
Enko
You need to put: ENTRY START after format PE GUI.
Code:
format PE GUI 4.0
entry start ;<<<<<<<<<<<<<<<<<<<<<<<<
include 'win32a.inc'

section ".data" data readable writeable 
prog db 'mspaint.exe',0 
param db '',0 


section ".code" code readable  executable
start: 

invoke WinExec, prog, param 
invoke ExitProcess, 0 

section '.idata' import data readable writeable 

library kernel32,'KERNEL32.DLL',\ 
user32,'USER32.DLL' 

include 'api\kernel32.inc'
include 'api\user32.inc' 
    

now it works
Post 18 Aug 2012, 22:04
View user's profile Send private message Reply with quote
pool



Joined: 08 Jan 2007
Posts: 97
Location: Philippines
pool
..


Last edited by pool on 17 Mar 2013, 12:09; edited 1 time in total
Post 18 Aug 2012, 23:25
View user's profile Send private message Visit poster's website Reply with quote
Goplat



Joined: 15 Sep 2006
Posts: 181
Goplat
Windows never kills a process just because the process that created it exited, regardless of the API used for creation. However, if the "parent" and "child" processes share a console window, then certain actions the user might take to kill the parent (pressing Ctrl-C/Ctrl-Break or closing the console window) would also affect the child.

If the child is not supposed to use the console, then it should be linked as a GUI application instead of a console application (in fasm: "format PE GUI"). If the child is supposed to use the console but you want to create it in its own console window, have the parent use the CREATE_NEW_CONSOLE flag with CreateProcess.

Enko wrote:
Code:
prog db 'mspaint.exe',0 
param db '',0 
[...]
invoke WinExec, prog, param 
invoke ExitProcess, 0 
    
The second parameter to WinExec is supposed to be an SW_ constant, not a pointer. This example only works because mspaint.exe apparently ignores its STARTUPINFO.wShowWindow value; other GUI programs like notepad.exe might end up having their window be invisible.
Post 19 Aug 2012, 19:06
View user's profile Send private message Reply with quote
pool



Joined: 08 Jan 2007
Posts: 97
Location: Philippines
pool
..


Last edited by pool on 17 Mar 2013, 12:09; edited 1 time in total
Post 19 Aug 2012, 23:40
View user's profile Send private message Visit poster's website Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
Additionally you can try

Code:
ShellExecuteA /ShellExecuteW
    
Post 20 Aug 2012, 22:40
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.