Thread View: borland.public.cppbuilder.nativeapi
9 messages
9 total messages
Started by Mark Jacobs
Thu, 22 Nov 2007 14:57
How do I translate this Delphi code to BCB5?
Author: Mark Jacobs
Date: Thu, 22 Nov 2007 14:57
Date: Thu, 22 Nov 2007 14:57
25 lines
1575 bytes
1575 bytes
How do I translate this Delphi code to BCB5?
Listing 1:
function RegisterServiceProcess (ProcessID,RType:DWord):DWord;
stdcall;external 'KERNEL32.DLL';
Listing 2:
procedure TForm1.FormCreate(Sender: TObject);
begin
RegisterServiceProcess(GetCurrentProcessID,1);
end;
Listing 3:
procedure TForm1.FormDestroy(Sender: TObject);
begin
RegisterServiceProcess(GetCurrentProcessID,0);
end;
--
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk
Re: How do I translate this Delphi code to BCB5?
Author: Remy Lebeau (TeamB)
Date: Thu, 22 Nov 2007 20:37
Date: Thu, 22 Nov 2007 20:37
31 lines
1882 bytes
1882 bytes
"Mark Jacobs" <http://www.jacobsm.com/mjmsg.htm?BorlandNG> wrote in message
news:474598cd@newsgroups.borland.com...
> How do I translate this Delphi code to BCB5?
RegisterServiceProcess() is not declared in any header file, and is not
linked to by kernel32.lib, so you have to use dynamic loading via
GetProcAddress() to use it, ie:
typedef DWORD (WINAPI *LPFN_RSP)(DWORD, DWORD);
LPFN_RSP lpRegisterServiceProcess = NULL;
__fastcall TForm1::TForm1(TComponent *Owner)
: TForm(Owner)
{
lpRegisterServiceProcess = (LPFN_RSP)
GetProcAddress(GetModuleHandle("KERNEL32"), "RegisterServiceProcess");
if( lpRegisterServiceProcess )
lpRegisterServiceProcess(GetCurrentProcessId(), 1);
}
__fastcall TForm1::~TForm1()
{
if( lpRegisterServiceProcess )
lpRegisterServiceProcess(GetCurrentProcessId(), 0);
}
Gambit
Re: How do I translate this Delphi code to BCB5?
Author: Mark Jacobs
Date: Fri, 23 Nov 2007 09:31
Date: Fri, 23 Nov 2007 09:31
12 lines
1635 bytes
1635 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message news:4745e86c$1@newsgroups.borland.com... > RegisterServiceProcess() is not declared in any header file, and is not > linked to by kernel32.lib, so you have to use dynamic loading via > GetProcAddress() to use it, ie: Thanks, the code compiles and runs. However, it certainly does not hide the process from Task Manager's Running Processes List. -- Mark Jacobs DK Computing http://www.dkcomputing.co.uk
Re: How do I translate this Delphi code to BCB5?
Author: Asger Joergensen
Date: Fri, 23 Nov 2007 09:41
Date: Fri, 23 Nov 2007 09:41
12 lines
1174 bytes
1174 bytes
Hi says: > Thanks, the code compiles and runs. However, it certainly does not hide the > process from Task Manager's Running Processes List. Why on earth do You want that ? Unless You have something bad in mind. Kind regards Asger
Re: How do I translate this Delphi code to BCB5?
Author: Mark Jacobs
Date: Fri, 23 Nov 2007 12:44
Date: Fri, 23 Nov 2007 12:44
20 lines
1943 bytes
1943 bytes
"Asger Joergensen" <junk@Asger-P.dk> wrote in message news:MPG.21b0bea992666f1e989903@newsgroups.borland.com... > says: >> Thanks, the code compiles and runs. However, it certainly does not hide the >> process from Task Manager's Running Processes List. > > Why on earth do You want that ? > Unless You have something bad in mind. It's for a security application that monitors for and pre-empts untoward changes to the registry and system files on a Windows system. It can currently be terminated through Task Manager. If I could prevent that, it would be slightly more secure! Anyway, more info at http://www.jacobsm.com/mjsoft.htm#rgwtchr Regards, -- Mark Jacobs DK Computing http://www.dkcomputing.co.uk
Re: How do I translate this Delphi code to BCB5?
Author: Remy Lebeau (TeamB)
Date: Fri, 23 Nov 2007 19:00
Date: Fri, 23 Nov 2007 19:00
12 lines
1368 bytes
1368 bytes
"Mark Jacobs" <http://www.jacobsm.com/mjmsg.htm?BorlandNG> wrote in message news:47469df8$1@newsgroups.borland.com... > However, it certainly does not hide the process from > Task Manager's Running Processes List. You did not say which OS you are running your app on. RegisterServiceProcess() is only available on Win9x/ME. Gambit
Re: How do I translate this Delphi code to BCB5?
Author: Mark Jacobs
Date: Sat, 24 Nov 2007 01:42
Date: Sat, 24 Nov 2007 01:42
17 lines
1634 bytes
1634 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message news:47472332$1@newsgroups.borland.com... > > "Mark Jacobs" <http://www.jacobsm.com/mjmsg.htm?BorlandNG> wrote in > message > news:47469df8$1@newsgroups.borland.com... > >> However, it certainly does not hide the process from >> Task Manager's Running Processes List. > > You did not say which OS you are running your app on. > RegisterServiceProcess() is only available on Win9x/ME. I am running XP, and the code came from a very old Delphi tip. -- Mark Jacobs http://jacobsm.com
Re: How do I translate this Delphi code to BCB5?
Author: Remy Lebeau (TeamB)
Date: Mon, 26 Nov 2007 17:42
Date: Mon, 26 Nov 2007 17:42
15 lines
1376 bytes
1376 bytes
"Mark Jacobs" <www.jacobsm.com/mjmsg.htm?Borland Newsgroup> wrote in message news:474780fc@newsgroups.borland.com... > I am running XP Then you cannot use that code, as RegisterServiceProcess() does not exist on XP. > the code came from a very old Delphi tip. It was a tip for a much older OS. Gambit
Re: How do I translate this Delphi code to BCB5?
Author: Remy Lebeau (TeamB)
Date: Mon, 26 Nov 2007 17:44
Date: Mon, 26 Nov 2007 17:44
14 lines
1558 bytes
1558 bytes
"Mark Jacobs" <http://www.jacobsm.com/mjmsg.htm?BorlandNG> wrote in message news:4746cb39$1@newsgroups.borland.com... > It's for a security application that monitors for and pre-empts > untoward changes to the registry and system files on a Windows > system. It can currently be terminated through Task Manager. > If I could prevent that, it would be slightly more secure! If the app is run under a system account, then only admins will be able to terminate it. Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads