• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 750
  • Last Modified:

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
0
unfunf
Asked:
unfunf
  • 5
  • 5
  • 2
  • +1
2 Solutions
 
Eddie ShipmanAll-around developerCommented:
Is this for Windows? wndows does not run TSR's. Use a service instead.
0
 
unfunfAuthor Commented:
Yes tis for windows... I want to simply make a process Memory resident so it does not have to rely on the exe being running. Maybe I was being confusing by calling it a TSR.
0
 
Eddie ShipmanAll-around developerCommented:
well if it is memory resident in windows, it is running...<bg>
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
GloomyFriarCommented:
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.
0
 
unfunfAuthor Commented:
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?
0
 
GloomyFriarCommented:
Memory is allocated (by means of an operating system) in a process context.
GlobalAlloc is obsolete
0
 
unfunfAuthor Commented:
So it's just not possible in up to date versions of windows anymore?
0
 
JDuncanCommented:
How about running a dos tsr in a delphi Console application
0
 
GloomyFriarCommented:
>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.
0
 
unfunfAuthor Commented:
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.
0
 
GloomyFriarCommented:
It's rather difficult to make all you've described.
And Delphi is not the best tool to such tasks.
How about MSVC?
0
 
unfunfAuthor Commented:
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.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 5
  • 5
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now