All the bells & whistles are off on my WinXP - it's quite tuned up. :)
Posted on 2002-01-07 01:14:42 by bitRAKE
I'll the pretty stuff isn't running on my xp either... There must be a radasm xp conflict then, but i still get a significant slowdown.

Posted on 2002-01-07 01:30:30 by Asm_Freak
Here is what I use in RadASM to assemble and link. If someone can find out what I am doing wrong I would be very happy. I for shure can't see anything wrong.

Posted on 2002-01-07 03:55:11 by KetilO
You don't use hTread/hProcess, so close them right away after
the CreateProcess call (well, that's what I've been tought). hProcess
*can* be useful, as you can WaitForSingleObject on it to wait until
the application terminatees.

I think the real problem with your code is TerminateProcess.
While TP "should" clean up resources used by the application, there
seems to be some problems with DLLs?

And why are you using TerminateProcess in the first place, the
application *should* terminate by itself?
Posted on 2002-01-07 04:41:17 by f0dder
Ketilo, the thing that seems stgrange to me is that you are killing the Process before you are killing the thread.

Shouldn't that be the other way around?

Almost seems like the resources for that thread would be lost if its Process was killed before the threads resources were first freed?
Posted on 2002-01-07 06:23:14 by Rockinronstar
The kernel thingamajig should take care of a lot of stuff itself...
but I'd still only use TerminateProcess if there's no other way around it.
Posted on 2002-01-07 06:58:57 by f0dder
there seems to be some problems with DLLs?

That is correct, TerminateProcess does not notify dlls that they are being detached, therefore they do not get the chance to clear up any open resources or handles they may have.

Ketil0, you should use ExitProcess() inside the process that you are trying to kill, you can kick it off by sending a message to the process. This is a far cleaner way to kill it than TerminateProcess, it allows the dlls to unhook themselves.
Posted on 2002-01-07 07:23:37 by sluggy
Thanks all

I will try it out. Maybe I even will be able to run batch files on Win98.

Posted on 2002-01-07 07:50:24 by KetilO
Hi all

Finaly got rid of all memory leak proglems in RadASM. Oh happy day. Thanks all for your help. I could not have managed it without your help. :alright:

RadASM 1.0.8 to be released soon.

Posted on 2002-01-07 16:56:54 by KetilO
right on. The best editor just got better!!!!
Posted on 2002-01-07 18:16:04 by Rockinronstar
Ketilo, care to tell us what did the trick? =).
Posted on 2002-01-07 19:23:07 by f0dder
Here is what I did:

OutPutMake proc lpCommandLine:DWORD

LOCAL outbuffer[1024]:byte

mov sat.nLength,sizeof SECURITY_ATTRIBUTES
mov sat.lpSecurityDescriptor,NULL
mov sat.bInheritHandle,TRUE
invoke CreatePipe,addr hRead,addr hWrite,addr sat,NULL
.if eax==NULL
invoke MessageBox,hWnd,addr CreatePipeError,addr AppName,MB_ICONERROR+MB_OK
mov startupinfo.cb,sizeof STARTUPINFO
invoke GetStartupInfo,addr startupinfo
mov eax,hWrite
mov startupinfo.hStdOutput,eax
mov startupinfo.hStdError,eax
mov startupinfo.wShowWindow,SW_HIDE
; Create process
invoke CreateProcess,NULL,addr outbuffer,NULL,NULL,TRUE,NULL,NULL,NULL,addr startupinfo,addr pinfo
.if eax==NULL
invoke CloseHandle,hRead
invoke CloseHandle,hWrite
invoke lstrcpy,addr buffer,addr CreateProcessError
invoke lstrcat,addr buffer,addr outbuffer
invoke MessageBox,hWnd,addr buffer,addr AppName,MB_ICONERROR+MB_OK
invoke CloseHandle,pinfo.hProcess
invoke CloseHandle,pinfo.hThread
invoke CloseHandle,hWrite
invoke RtlZeroMemory,addr outbuffer,1024
.while TRUE
invoke ReadFile,hRead,addr outbuffer,1023,addr bytesRead,NULL
.if eax==NULL
invoke SendMessage,hOut,EM_SETSEL,-1,0
invoke SendMessage,hOut,EM_REPLACESEL,FALSE,addr outbuffer
invoke CloseHandle,hRead

OutPutMake endp

There was also a missing ReleaseDC when drawing tool window captions. This ate memory when you moved a window over RadASM's window. Could not have fixed these bugs without your help. Thanks.

Posted on 2002-01-08 02:32:25 by KetilO