unfunf
asked on
Creating a TSR in Delphi
Hello. I have been trying for quite some time now to create a TSR (Termiante and Stay Resident) program in Delphi, without using ASM.
I assume HeapCreate and HeapAlloc are required; however, I am not sure how to implement them correctly and keep my program in memory even after my exe has exited.
Any help would be greately appreciated [Just a simple example of a Delphi TSR would suffice, so I understand how it works], and I will be sure to award the points accordingly.
Thank you,
-unfunf
I assume HeapCreate and HeapAlloc are required; however, I am not sure how to implement them correctly and keep my program in memory even after my exe has exited.
Any help would be greately appreciated [Just a simple example of a Delphi TSR would suffice, so I understand how it works], and I will be sure to award the points accordingly.
Thank you,
-unfunf
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
well if it is memory resident in windows, it is running...<bg>
I can't understand what you want to make.
TSRs was used in DOS for making "pseudo multitasking"
Windows have native multitasking.
As EddieShipman said, use a service or explain more detailed, what do you want.
TSRs was used in DOS for making "pseudo multitasking"
Windows have native multitasking.
As EddieShipman said, use a service or explain more detailed, what do you want.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I mean more along the lines of allocating actual functions in memory.
For example... To inject code into a process (in WinNT, for win9x stuff I need to use x functions by EliRt) you can use VirtualAllocEx and CreateRemoteThread to execute @ address, and such. I want to do that same thing; however, I want to do it in windows memory itself.. not the private memory of a process. Could I use the hGlobal handle from GlobalAlloc?
For example... To inject code into a process (in WinNT, for win9x stuff I need to use x functions by EliRt) you can use VirtualAllocEx and CreateRemoteThread to execute @ address, and such. I want to do that same thing; however, I want to do it in windows memory itself.. not the private memory of a process. Could I use the hGlobal handle from GlobalAlloc?
Memory is allocated (by means of an operating system) in a process context.
GlobalAlloc is obsolete
GlobalAlloc is obsolete
ASKER
So it's just not possible in up to date versions of windows anymore?
How about running a dos tsr in a delphi Console application
>So it's just not possible in up to date versions of windows anymore?
Yes. Any process have it's own heap. And GlobalAlloc == LocalAlloc.
Nevertheless could you explain your purposes and may be I'll can help you.
Yes. Any process have it's own heap. And GlobalAlloc == LocalAlloc.
Nevertheless could you explain your purposes and may be I'll can help you.
ASKER
I wanted to make a type of "test" antivirus for myself, that does not rely on definitions, but on actions to stop that I specify. I wanted to figure out a way to globally hook some apis without having to inject a dll system wide. I also wanted to make it harder for a virus to just end my process (some viruses attempt to end processes by other means, not exe name), since my process is residing in memory and not shown by any process list (it would have to be taken out of memory). Asm programs can do these things pretty easily (not sure if that is true in the more current versions of windows); however, it would take wayyyy to long to code a good asm program. I use delphi because i simply dont have the patience to sit down and figure out asm (which I do not understand very well) then write 30kb of source just to do something that would take maybe 5-7kb in delphi .dpr. Plus I can keep the delphi exe size pretty low (at least under 30 kb).
I just need an alternative to having my actual exe stay up, and keeping my code out of a DLL file.
I just need an alternative to having my actual exe stay up, and keeping my code out of a DLL file.
It's rather difficult to make all you've described.
And Delphi is not the best tool to such tasks.
How about MSVC?
And Delphi is not the best tool to such tasks.
How about MSVC?
ASKER
The only language I have a lot of experience in is delphi. So, I would probably not be able to do it (unless someone helped me a lot I suppose) with msvc.
ASKER