[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Creating a TSR in Delphi

Posted on 2003-11-12
15
Medium Priority
?
744 Views
Last Modified: 2010-04-05
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
Comment
Question by:unfunf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 2
  • +1
15 Comments
 
LVL 26

Accepted Solution

by:
EddieShipman earned 252 total points
ID: 9737115
Is this for Windows? wndows does not run TSR's. Use a service instead.
0
 

Author Comment

by:unfunf
ID: 9737198
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
 
LVL 26

Expert Comment

by:EddieShipman
ID: 9737294
well if it is memory resident in windows, it is running...<bg>
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9738546
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
 
LVL 6

Assisted Solution

by:GloomyFriar
GloomyFriar earned 248 total points
ID: 9738611
0
 

Author Comment

by:unfunf
ID: 9743609
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
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9746864
Memory is allocated (by means of an operating system) in a process context.
GlobalAlloc is obsolete
0
 

Author Comment

by:unfunf
ID: 9747234
So it's just not possible in up to date versions of windows anymore?
0
 
LVL 3

Expert Comment

by:JDuncan
ID: 9749515
How about running a dos tsr in a delphi Console application
0
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9749999
>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
 

Author Comment

by:unfunf
ID: 9752087
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
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9753893
It's rather difficult to make all you've described.
And Delphi is not the best tool to such tasks.
How about MSVC?
0
 

Author Comment

by:unfunf
ID: 9755188
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question