0
Under Assembly(using FASM assembler), I would like to create a . bat file and then run it.
I can create the file normally using the functions contained in msvcrt.dll. I close the file and try to run using system, but nothing occurs(not even an error message)
The file is created correctly. Code section of the program:
main:
push mode ; w
push fileN ; run.bat
call [fopen]
pop [fileP] ; pego o endereço do stream do arquivo e jogo em fileP
push [fileP] ; coloco novamente o valor na pilha, para o fwrite
push eax
mov eax, 85 ; número de valores para escrever
push eax
mov eax, 1 ; tamanho em bytes de cada valor
push eax
push dataB ; conteúdo do arquivo batch
call [fwrite] ; -> até aqui tudo ok
push [fileP] ; endereço stream do arquivo
call [fclose] ; Creio que funcione corretamente
push pExec ; string contento os comandos pada executar
call [system] ; executado corretamente, mas não executa o .bat
call [exit]
I assumed that I might not be closing the file properly, or that at runtime the file would still not be closed (by system delay)
I tried using system to use timeout anyway nothing happened. (except the execution of timeout)
I thought about using Sleep, but do not know how to use in ASM. (I also tried to delay with a loop, same result.)
Would anyone know the error?
A few more details: I’m riding for 32bit, the S.O. is Windows 7 64 bit.