Hi, how is the system function done? Atm I am doing it like this:

invoke ShellExecute, NULL, addr szopen, addr cmdexe, addr szparams, NULL, SW_SHOW

But it requires the program to know the persons homedrive. Is there a system(); function that can be used in assembly? If so, what library does it require? and what are it's parameters.

My code would preform faster if it did not have to get the users homedrive, so is there a system(); function like the one their is in C++, that can be used in mASM?

In you masm32 folder there is an include folder with the .inc files and also there is a lib folder with the libraries. To call system all you need to do is include msvcrt.inc and msvcrt.lib

.586
.model flat,stdcall

include  \masm32\include\msvcrt.inc
includelib \masm32\lib\msvcrt.lib

system PROTO C, :PTR BYTE
.data
command BYTE "ipconfig",0


.code
main PROC
invoke system, ADDR command
exit
main ENDP
end  main

Make sure you create a proto for each C function you wan to call.

Hi, how is the system function done? Atm I am doing it like this:

invoke ShellExecute, NULL, addr szopen, addr cmdexe, addr szparams, NULL, SW_SHOW

But it requires the program to know the persons homedrive. Is there a system(); function that can be used in assembly? If so, what library does it require? and what are it's parameters.

My code would preform faster if it did not have to get the users homedrive, so is there a system(); function like the one their is in C++, that can be used in mASM?

This article has been dead for over six months. Start a new discussion instead.