RTC Forums
November 21, 2024, 07:37:39 AM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Login
Register
RTC Forums
>
Subscription
>
Support
>
Delphi 11.2 OpenSCManager exception
Pages: [
1
]
« previous
next »
Print
Author
Topic: Delphi 11.2 OpenSCManager exception (Read 6154 times)
thomh
RTC License+
Posts: 17
Delphi 11.2 OpenSCManager exception
«
on:
December 16, 2022, 01:56:09 PM »
Hi,
In Delphi 11.2 Patch 1 compiling in 64bit debug mode, I get an exception in the rtcService unit in method IsServiceStarting on line 44: SvcMgr := OpenSCManager(nil, nil, SC_MANAGER_CONNECT) and on line 56: CloseServiceHandle(SvcMgr);
This is running on a Win11 VM with the latest updates.
Can you duplicate this?
Delphi 11.1 works.
// Thom
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: Delphi 11.2 OpenSCManager exception
«
Reply #1 on:
December 16, 2022, 02:10:51 PM »
OpenSCManager and CloseServiceHandle are both Delphi RTL functions, mapping directly to the Windows API.
I am still on Delphi 11.0 and Windows 10 with no plans to upgrade.
From what I've just read now, Delphi 11.2 has introduced big changes, which might break quite a few things.
Best Regards,
Danijel Tkalcec
Logged
thomh
RTC License+
Posts: 17
Re: Delphi 11.2 OpenSCManager exception
«
Reply #2 on:
December 16, 2022, 03:25:44 PM »
Thanks, Danijel.
So back to Delphi 11.1 until EMB fixes this.
// Thom
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: Delphi 11.2 OpenSCManager exception
«
Reply #3 on:
December 16, 2022, 11:23:45 PM »
Oh, wait. I've just noticed that OpenSCManager and OpenService functions return a THandle (32-bit on 32-bit platforms, 64-bit on 64-bit platforms), but Svc and SvcMgr variables (which store their return values) are declared as Integer (always 32-bit) in the IsServiceStarting function.
This is a bug. Svc and SvcMgs variables should be declared as THandle ...
function IsServiceStarting(const ServiceName:String): Boolean;
var
Svc: THandle; // changed from Integer
SvcMgr: THandle; // changed from Integer
ServSt: TServiceStatus;
I've committed this fix to GitHub.
Best Regards,
Danijel Tkalcec
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: Delphi 11.2 OpenSCManager exception
«
Reply #4 on:
December 17, 2022, 10:53:20 AM »
By the way ...
I did install Delphi 11.2 yesterday and found that all the exceptions caused by the new Linker in Delphi 11.2 can be avoided,
if you open
Project Options
/
Building
/
Delphi Compiler
/
Linking
and
remove
check-boxes from
"Support address space layout randomization (
ASRL
)" and from
"Support high-entropy 64-bit address space layout randomization (
ASLR
)".
These settings are per Project and per Target.
Even though I find these new linker options useful for debugging, I would still
recommend anyone who has a Project that needs to run in a Production environment
to DISABLE these two Linker options for their RELEASE / DEPLOYMENT builds.
Best Regards,
Danijel Tkalcec
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Dashboard
-----------------------------
=> General
=> 3rd-Party
=> Quick Start
-----------------------------
Subscription
-----------------------------
=> Support
Loading...