Skip to content

Commit

Permalink
Merge pull request #115 from davideangeli/master
Browse files Browse the repository at this point in the history
Resolved issues 6701, 6734, 6745
  • Loading branch information
obones authored Jul 22, 2022
2 parents 3e26e55 + cc8cc78 commit 339c1fe
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions jcl/source/common/JclResources.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1959,6 +1959,7 @@ interface
RsOSVersionWin10 = 'Windows 10';
RsOSVersionWinServer2016 = 'Windows Server 2016';
RsOSVersionWinServer2019 = 'Windows Server 2019';
RsOSVersionWinServer2022 = 'Windows Server 2022';
RsOSVersionWinServer = 'Windows Server';
RsOSVersionWin11 = 'Windows 11';

Expand Down
11 changes: 9 additions & 2 deletions jcl/source/common/JclSysInfo.pas
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function GetShellProcessHandle: THandle;
wvWin2003, wvWinXP64, wvWin2003R2, wvWinVista, wvWinServer2008,
wvWin7, wvWinServer2008R2, wvWin8, wvWin8RT, wvWinServer2012,
wvWin81, wvWin81RT, wvWinServer2012R2, wvWin10, wvWinServer2016,
wvWinServer2019, wvWinServer, wvWin11);
wvWinServer2019, wvWinServer, wvWin11, wvWinServer2022);
TWindowsEdition =
(weUnknown, weWinXPHome, weWinXPPro, weWinXPHomeN, weWinXPProN, weWinXPHomeK,
weWinXPProK, weWinXPHomeKN, weWinXPProKN, weWinXPStarter, weWinXPMediaCenter,
Expand Down Expand Up @@ -308,6 +308,7 @@ function GetShellProcessHandle: THandle;
IsWin10: Boolean = False;
IsWinServer2016: Boolean = False;
IsWinServer2019: Boolean = False;
IsWinServer2022: Boolean = False;
IsWinServer: Boolean = False;
IsWin11: Boolean = False;

Expand Down Expand Up @@ -3588,7 +3589,7 @@ function GetWindowsVersion: TWindowsVersion;
Win32MinorVersionEx := 4 // Windows 10 (builds < 9926) and Windows Server 2016 (builds < 10074)
else
if Win32MajorVersionEx = 10 then
Win32MinorVersionEx := -1 // Windows 10 (builds >= 9926) and Windows Server 2016/2019 (builds >= 10074), set to -1 to escape case block
Win32MinorVersionEx := -1 // Windows 10 (builds >= 9926) and Windows Server 2016/2019/2022 (builds >= 10074), set to -1 to escape case block
else
Win32MinorVersionEx := Win32MinorVersion;
end;
Expand Down Expand Up @@ -3680,6 +3681,8 @@ function GetWindowsVersion: TWindowsVersion;
Result := wvWinServer2016;
1809:
Result := wvWinServer2019;
2009:
Result := wvWinServer2022;
else
Result := wvWinServer;
end;
Expand Down Expand Up @@ -4006,6 +4009,8 @@ function GetWindowsVersionString: string;
Result := LoadResString(@RsOSVersionWinServer2016);
wvWinServer2019:
Result := LoadResString(@RsOSVersionWinServer2019);
wvWinServer2022:
Result := LoadResString(@RsOSVersionWinServer2022);
wvWinServer:
Result := LoadResString(@RsOSVersionWinServer);
wvWin11:
Expand Down Expand Up @@ -6574,6 +6579,8 @@ procedure InitSysInfo;
IsWinServer2016 := True;
wvWinServer2019:
IsWinServer2019 := True;
wvWinServer2022:
IsWinServer2022 := True;
wvWinServer:
IsWinServer := True;
wvWin11:
Expand Down
8 changes: 4 additions & 4 deletions jcl/source/windows/JclSvcCtrl.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ procedure TJclSCManager.Refresh(const RefreshAll: Boolean);
repeat
ReallocMem(PBuf, BytesNeeded);
ServicesReturned := 0;
Ret := EnumServicesStatus(FHandle, SERVICE_TYPE_ALL, SERVICE_STATE_ALL,
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);
LastError := GetLastError;
Expand Down Expand Up @@ -1423,7 +1423,7 @@ class function TJclSCManager.ControlAccepted(const CtrlAccepted: DWORD): TJclSer
function GetServiceStatusByName(const AServer,AServiceName:string):TJclServiceState;
var
ServiceHandle,
SCMHandle: DWORD;
SCMHandle: SC_HANDLE;
SCMAccess,Access:DWORD;
ServiceStatus: TServiceStatus;
begin
Expand Down Expand Up @@ -1452,7 +1452,7 @@ function GetServiceStatusByName(const AServer,AServiceName:string):TJclServiceSt
function StartServiceByName(const AServer,AServiceName: String):Boolean;
var
ServiceHandle,
SCMHandle: DWORD;
SCMHandle: SC_HANDLE;
p: PChar;
begin
p:=nil;
Expand All @@ -1474,7 +1474,7 @@ function StartServiceByName(const AServer,AServiceName: String):Boolean;
function StopServiceByName(const AServer, AServiceName: String):Boolean;
var
ServiceHandle,
SCMHandle: DWORD;
SCMHandle: SC_HANDLE;
SS: _Service_Status;
begin
Result := False;
Expand Down

0 comments on commit 339c1fe

Please sign in to comment.