View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0006701 | JEDI Code Library | General API | public | 2020-06-26 16:12 | 2023-11-11 19:29 |
Reporter | Mistral | Assigned To | ChristianWimmer | ||
Priority | normal | Severity | block | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | |||||
Target Version | Fixed in Version | Version 2.5 (Subversion repository/Daily zips) | |||
Summary | 0006701: TJclSCManager system error 87 (parameter incorrect) in Delphi 10.4 running on Windows 7 or Windows 2008 server | ||||
Description | I'm using TJclSCManager to manage Windows services. It works well until update to Delphi 10.4. If I run my program on an older SysOp (Windows 7 or Windows 2008 server) I get always a system error 87 (parameter incorrect) when TjsclManager.Refresh calls EnumServicesStatus. Running on Windows 10 or latest Windows Servers is all fine. After some debug I've discovered the cause of this error on a change in SERVICE_TYPE_ALL constant on Delphi unit Winapi.WinSvc: SERVICE_TYPE_ALL = (SERVICE_WIN32 or SERVICE_ADAPTER or SERVICE_DRIVER or SERVICE_INTERACTIVE_PROCESS or SERVICE_USER_SERVICE or SERVICE_USERSERVICE_INSTANCE or SERVICE_PKG_SERVICE); in previous Delphi 10.3 this constant was SERVICE_TYPE_ALL = (SERVICE_WIN32 or SERVICE_ADAPTER or SERVICE_DRIVER or SERVICE_INTERACTIVE_PROCESS); TjsclManager.Refresh calls the EnumServicesStatus api in this way: Ret := EnumServicesStatus(FHandle, SERVICE_TYPE_ALL , SERVICE_STATE_ALL, PEnumServiceStatus(PBuf){$IFNDEF FPC}{$IFNDEF RTL340_UP}^{$ENDIF}{$ENDIF}, BytesNeeded, BytesNeeded, ServicesReturned, ResumeHandle); this causes the problem in older sysop because as you can see here: https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-enumservicesstatusexa EnumServicesStatus allows only a few of the declared constants for the dwServiceType parameter. I solved changing JclSvcCtrl unit in this way: Ret := EnumServicesStatus(FHandle, SERVICE_WIN32 or SERVICE_ADAPTER or SERVICE_DRIVER or SERVICE_INTERACTIVE_PROCESS, SERVICE_STATE_ALL, PEnumServiceStatus(PBuf){$IFNDEF FPC}{$IFNDEF RTL340_UP}^{$ENDIF}{$ENDIF}, BytesNeeded, BytesNeeded, ServicesReturned, ResumeHandle); | ||||
Tags | No tags attached. | ||||
Fixed in GIT commit | cc8cc789119d24aaf4f50ebb224297d64d89553c | ||||
Fixed in SVN revision | |||||
IDE version | |||||
|
I too had the exact same issue. Big thanks to Mistral for reporting it! |
|
Note that my issue was occurring on Windows 2012 R2, so I have to question if it is relates to Windows 7 or 2008. In any case, the code provided by Mistral fixed the issue for me. Thanks again to Mistral for reporting it! |
|
Already fixed in git main branch. |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-06-26 16:12 | Mistral | New Issue | |
2020-06-26 16:12 | Mistral | Status | new => assigned |
2020-06-26 16:12 | Mistral | Assigned To | => ChristianWimmer |
2020-11-02 17:49 | markjforte | Note Added: 0021956 | |
2020-11-02 18:26 | markjforte | Note Added: 0021957 | |
2023-11-11 19:29 | AHUser | Project | JEDI API & WSC Library => JEDI Code Library |
2023-11-11 19:29 | AHUser | Status | assigned => resolved |
2023-11-11 19:29 | AHUser | Resolution | open => fixed |
2023-11-11 19:29 | AHUser | Fixed in Version | => Version 2.5 (Subversion repository/Daily zips) |
2023-11-11 19:29 | AHUser | Fixed in GIT commit | => cc8cc789119d24aaf4f50ebb224297d64d89553c |
2023-11-11 19:29 | AHUser | Note Added: 0022053 |