Page 1 of 1

StealAssembly.pb

Posted: Sun Dec 13, 2015 7:27 am
by Lunasole
A simple program to intercept PureBasic.asm file. For Windows.
1. Compile it as console app and name "fasm.exe"
2. Goto "compilers" folder, rename true fasm.exe to "fasm_true.exe"
3. Place compiled file to it's place

It will produce PureBasic.asm file on user desktop after every compilation

Code: Select all

EnableExplicit
	Import "kernel32.lib"
	  GetConsoleWindow()
	EndImport
ShowWindow_(GetConsoleWindow(), #SW_HIDE) ; hide this console window manually

Define TInt.i, Params.i = CountProgramParameters()
Define AsmParams.s
	For TInt = 0 To Params - 1
		AsmParams + ProgramParameter(TInt) + " "
	Next TInt

Define AsmFile.s = ProgramParameter(0) ; 1st param is .asm file inside temp folder
Define OutPath.s = GetHomeDirectory() + "desktop\" + AsmFile ; placing output to user desktop [windows]
	If FileSize(AsmFile) > 0 :	CopyFile(AsmFile, OutPath) : EndIf

Define FASM.i = RunProgram("fasm_true.exe", AsmParams, GetCurrentDirectory(),  #PB_Program_Open)
Define iRet.i = 1
	If FASM 
		WaitProgram (FASM)
		iRet = ProgramExitCode(FASM)
		CloseProgram(FASM)
	EndIf
End iRet

Re: StealAssembly.pb

Posted: Sun Dec 13, 2015 5:49 pm
by Tenaja
I have saved your code for future reference--thank you for sharing.

When I want the asm, it seems I always want to see it immediately. For those situations, use one of the many CommentedASM.pb files; a few are here:
http://www.purebasic.fr/english/viewtopic.php?t=30843