Skip to content

Commit

Permalink
include last fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Makhaon committed Jul 11, 2019
1 parent 7ffd812 commit 51986b3
Show file tree
Hide file tree
Showing 11 changed files with 448 additions and 106 deletions.
4 changes: 4 additions & 0 deletions jcl/experts/debug/converter/JclDebugIdeImpl.pas
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,10 @@ procedure TJclDebugExtension.DisplayResults;
begin
if FBuildError or (Length(FResultInfo) = 0) then
Exit;

if Assigned(Settings) and (Settings.LoadBool(JclDebugQuietSetting, false)) then
Exit;

with TJclDebugResultForm.Create(Application, Settings) do
try
for I := 0 to Length(FResultInfo) - 1 do
Expand Down
5 changes: 5 additions & 0 deletions jcl/source/common/JclBase.pas
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ ULARGE_INTEGER = record
TJclULargeInteger = ULARGE_INTEGER;
PJclULargeInteger = PULARGE_INTEGER;

{$IFNDEF COMPILER16_UP}
LONG = Longint;
{$EXTERNALSYM LONG}
{$ENDIF ~COMPILER16_UP}

// Dynamic Array support
type
TDynByteArray = array of Byte;
Expand Down
97 changes: 53 additions & 44 deletions jcl/source/common/JclFileUtils.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6970,42 +6970,44 @@ function PathListItemIndex(const List, Item: string): Integer;
// returns the name of the command line parameter at position index, which is
// separated by the given separator, if the first character of the name part
// is one of the AllowedPrefixCharacters, this character will be deleted.
function ParamName (Index : Integer; const Separator : string = '=';
const AllowedPrefixCharacters : string = '-/'; TrimName : Boolean = true) : string;
var s: string;
p: Integer;
function ParamName(Index: Integer; const Separator: string;
const AllowedPrefixCharacters: string; TrimName: Boolean): string;
var
S: string;
P: Integer;
begin
if (index > 0) and (index <= ParamCount) then
if (Index > 0) and (Index <= ParamCount) then
begin
s := ParamStr(index);
if Pos(Copy(s, 1, 1), AllowedPrefixCharacters) > 0 then
s := Copy (s, 2, Length(s)-1);
p := Pos(Separator, s);
if p > 0 then
s := Copy (s, 1, p-1);
S := ParamStr(Index);
if Pos(Copy(S, 1, 1), AllowedPrefixCharacters) > 0 then
S := Copy(S, 2, Length(S) - 1);
P := Pos(Separator, S);
if P > 0 then
S := Copy(S, 1, P - 1);
if TrimName then
s := Trim(s);
Result := s;
S := Trim(S);
Result := S;
end
else
Result := '';
end;

// returns the value of the command line parameter at position index, which is
// separated by the given separator
function ParamValue (Index : Integer; const Separator : string = '='; TrimValue : Boolean = true) : string;
var s: string;
p: Integer;
function ParamValue(Index: Integer; const Separator: string; TrimValue: Boolean): string;
var
S: string;
P: Integer;
begin
if (index > 0) and (index <= ParamCount) then
if (Index > 0) and (Index <= ParamCount) then
begin
s := ParamStr(index);
p := Pos(Separator, s);
if p > 0 then
s := Copy (s, p+1, Length(s)-p);
S := ParamStr(Index);
P := Pos(Separator, S);
if P > 0 then
S := Copy(S, P + 1, Length(S) - P);
if TrimValue then
s := Trim(s);
Result := s;
S := Trim(S);
Result := S;
end
else
Result := '';
Expand All @@ -7015,21 +7017,25 @@ function ParamValue (Index : Integer; const Separator : string = '='; TrimValue
// and returns the value which is which by the given separator.
// CaseSensitive defines the search type. if the first character of the name part
// is one of the AllowedPrefixCharacters, this character will be deleted.
function ParamValue (const SearchName : string; const Separator : string = '=';
CaseSensitive : Boolean = False;
const AllowedPrefixCharacters : string = '-/'; TrimValue : Boolean = true) : string;
var pName : string;
i : Integer;
function ParamValue(const SearchName: string; const Separator: string;
CaseSensitive: Boolean; const AllowedPrefixCharacters: string;
TrimValue: Boolean): string;
var
Name: string;
SearchS: String;
I: Integer;
begin
Result := '';
for i := 1 to ParamCount do
SearchS := Trim(SearchName);

for I := 1 to ParamCount do
begin
pName := ParamName(i, Separator, AllowedPrefixCharacters, True);
if (CaseSensitive and (pName = Trim(SearchName))) or
(UpperCase(pName) = Trim(UpperCase(SearchName))) then
Name := ParamName(I, Separator, AllowedPrefixCharacters, True);
if (CaseSensitive and (Name = SearchS)) or
((not CaseSensitive) and (CompareText(Name, SearchS) = 0)) then
begin
Result := ParamValue (i, Separator, TrimValue);
exit;
Result := ParamValue(I, Separator, TrimValue);
Exit;
end;
end;
end;
Expand All @@ -7038,20 +7044,23 @@ function ParamValue (const SearchName : string; const Separator : string = '=';
// and returns the position index. if no separator is defined, the full paramstr is compared.
// CaseSensitive defines the search type. if the first character of the name part
// is one of the AllowedPrefixCharacters, this character will be deleted.
function ParamPos (const SearchName : string; const Separator : string = '=';
CaseSensitive : Boolean = False;
const AllowedPrefixCharacters : string = '-/'): Integer;
var pName : string;
i : Integer;
function ParamPos(const SearchName: string; const Separator: string;
CaseSensitive: Boolean; const AllowedPrefixCharacters: string): Integer;
var
Name: string;
SearchS: string;
I: Integer;
begin
Result := -1;
for i := 1 to ParamCount do
SearchS := Trim(SearchName);

for I := 1 to ParamCount do
begin
pName := ParamName(i, Separator, AllowedPrefixCharacters, True);
if (CaseSensitive and (pName = SearchName)) or
(UpperCase(pName) = UpperCase(SearchName)) then
Name := ParamName(I, Separator, AllowedPrefixCharacters, True);
if (CaseSensitive and (Name = SearchS)) or
((not CaseSensitive) and (CompareText(Name, SearchS) = 0)) then
begin
Result := i;
Result := I;
Exit;
end;
end;
Expand Down
6 changes: 4 additions & 2 deletions jcl/source/common/JclResources.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1958,6 +1958,8 @@ interface
RsOSVersionWinServer2012R2 = 'Windows Server 2012 R2';
RsOSVersionWin10 = 'Windows 10';
RsOSVersionWinServer2016 = 'Windows Server 2016';
RsOSVersionWinServer2019 = 'Windows Server 2019';
RsOSVersionWinServer = 'Windows Server';

RsEditionWinXPHome = 'Home Edition';
RsEditionWinXPPro = 'Professional';
Expand Down Expand Up @@ -2004,8 +2006,8 @@ interface
RsProductTypeEnterprise = 'Enterprise';
RsProductTypeWebEdition = 'Web Edition';

RsEOpenGLInfo = 'GetOpenGLVersion: %s failed';
RsENetWkstaGetInfo = 'NetWkstaGetInfo failed';
RsEOpenGLInfo = 'GetOpenGLVersion: %s failed';
RsENetWkstaGetInfo = 'NetWkstaGetInfo failed';

{$IFDEF MSWINDOWS}
RsSPInfo = 'SP%u';
Expand Down
6 changes: 5 additions & 1 deletion jcl/source/common/JclSynch.pas
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,11 @@ implementation
{$ELSE ~HAS_UNITSCOPE}
SysUtils,
{$ENDIF ~HAS_UNITSCOPE}
JclLogic, JclRegistry, JclResources,
JclLogic,
{$IFDEF MSWINDOWS}
JclRegistry,
{$ENDIF}
JclResources,
JclSysInfo, JclStrings;

const
Expand Down
65 changes: 58 additions & 7 deletions jcl/source/common/JclSysInfo.pas
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ function GetShellProcessHandle: THandle;
wvWinNT31, wvWinNT35, wvWinNT351, wvWinNT4, wvWin2000, wvWinXP,
wvWin2003, wvWinXP64, wvWin2003R2, wvWinVista, wvWinServer2008,
wvWin7, wvWinServer2008R2, wvWin8, wvWin8RT, wvWinServer2012,
wvWin81, wvWin81RT, wvWinServer2012R2, wvWin10, wvWinServer2016);
wvWin81, wvWin81RT, wvWinServer2012R2, wvWin10, wvWinServer2016,
wvWinServer2019, wvWinServer);
TWindowsEdition =
(weUnknown, weWinXPHome, weWinXPPro, weWinXPHomeN, weWinXPProN, weWinXPHomeK,
weWinXPProK, weWinXPHomeKN, weWinXPProKN, weWinXPStarter, weWinXPMediaCenter,
Expand Down Expand Up @@ -311,6 +312,8 @@ function GetShellProcessHandle: THandle;
IsWinServer2012R2: Boolean = False;
IsWin10: Boolean = False;
IsWinServer2016: Boolean = False;
IsWinServer2019: Boolean = False;
IsWinServer: Boolean = False;

const
PROCESSOR_ARCHITECTURE_INTEL = 0;
Expand Down Expand Up @@ -339,6 +342,8 @@ function GetWindows10ReleaseId: Integer;
function GetWindows10ReleaseName: String;
function GetWindows10ReleaseCodeName: String;
function GetWindows10ReleaseVersion: String;
function GetWindowsServerReleaseId: Integer;
function GetWindowsServerReleaseVersion: String;
function GetOpenGLVersion(const Win: THandle; out Version, Vendor: AnsiString): Boolean;
function GetNativeSystemInfo(var SystemInfo: TSystemInfo): Boolean;
function GetProcessorArchitecture: TProcessorArchitecture;
Expand Down Expand Up @@ -3473,7 +3478,7 @@ function GetWindowsVersion: TWindowsVersion;
TrimmedWin32CSDVersion: string;
SystemInfo: TSystemInfo;
OSVersionInfoEx: TOSVersionInfoEx;
Win32MajorVersionEx, Win32MinorVersionEx: integer;
Win32MajorVersionEx, Win32MinorVersionEx, WindowsReleaseId: integer;
ProductName: string;
const
SM_SERVERR2 = 89;
Expand Down Expand Up @@ -3560,7 +3565,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 (builds >= 10074), set to -1 to escape case block
Win32MinorVersionEx := -1 // Windows 10 (builds >= 9926) and Windows Server 2016/2019 (builds >= 10074), set to -1 to escape case block
else
Win32MinorVersionEx := Win32MinorVersion;
end;
Expand Down Expand Up @@ -3625,7 +3630,7 @@ function GetWindowsVersion: TWindowsVersion;
end;
end;

// This part will only be hit with Windows 10 and Windows Server 2016 (and newer) where an application manifest is not included
// This part will only be hit with Windows 10, Windows Server 2016 and beyond where an application manifest is not included
if (Win32MajorVersionEx >= 10) then
begin
case Win32MajorVersionEx of
Expand All @@ -3636,12 +3641,22 @@ function GetWindowsVersion: TWindowsVersion;
case Win32MinorVersionEx of
0:
begin
// Windows 10 (builds >= 9926) and Windows Server 2016 (builds >= 10074)
// Windows 10 (builds >= 9926), Windows Server 2016 (builds >= 10074) and beyond
OSVersionInfoEx.dwOSVersionInfoSize := SizeOf(OSVersionInfoEx);
if GetVersionEx(OSVersionInfoEx) and (OSVersionInfoEx.wProductType = VER_NT_WORKSTATION) then
Result := wvWin10
else
Result := wvWinServer2016;
begin
WindowsReleaseId := StrToIntDef(RegReadStringDef(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'ReleaseId', '0'), -1);
case WindowsReleaseId of
1607:
Result := wvWinServer2016;
1809:
Result := wvWinServer2019;
else
Result := wvWinServer;
end;
end;
end;
end;
end;
Expand Down Expand Up @@ -3964,6 +3979,10 @@ function GetWindowsVersionString: string;
Result := LoadResString(@RsOSVersionWin10);
wvWinServer2016:
Result := LoadResString(@RsOSVersionWinServer2016);
wvWinServer2019:
Result := LoadResString(@RsOSVersionWinServer2019);
wvWinServer:
Result := LoadResString(@RsOSVersionWinServer);
else
Result := '';
end;
Expand Down Expand Up @@ -4199,6 +4218,8 @@ function GetWindows10ReleaseName: String;
Result := 'Windows 10 April 2018 Update';
1809:
Result := 'Windows 10 October 2018 Update';
1903:
Result := 'Windows 10 May 2019 Update';
else
Result := 'Windows 10 ' + IntToStr(GetWindows10ReleaseId) + ' Update';
end;
Expand Down Expand Up @@ -4226,6 +4247,8 @@ function GetWindows10ReleaseCodeName: String;
Result := 'Redstone 4';
1809:
Result := 'Redstone 5';
1903:
Result := '19H1';
else
Result := '';
end;
Expand All @@ -4242,7 +4265,31 @@ function GetWindows10ReleaseVersion: String;
begin
WindowsReleaseId := GetWindows10ReleaseId;
if WindowsReleaseId > 0 then
Result := 'Windows 10 Version ' + IntToStr(WindowsReleaseId)
Result := 'Windows 10, version ' + IntToStr(WindowsReleaseId)
else
Result := '';
end
else
Result := '';
end;

function GetWindowsServerReleaseId: Integer;
begin
if IsWinServer then
Result := StrToIntDef(RegReadStringDef(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'ReleaseId', '0'), -1)
else
Result := -1;
end;

function GetWindowsServerReleaseVersion: String;
var
WindowsReleaseId: Integer;
begin
if IsWinServer then
begin
WindowsReleaseId := GetWindowsServerReleaseId;
if WindowsReleaseId > 0 then
Result := 'Windows Server, version ' + IntToStr(WindowsReleaseId)
else
Result := '';
end
Expand Down Expand Up @@ -6364,6 +6411,10 @@ procedure InitSysInfo;
IsWin10 := True;
wvWinServer2016:
IsWinServer2016 := True;
wvWinServer2019:
IsWinServer2019 := True;
wvWinServer:
IsWinServer := True;
end;
end;

Expand Down
Loading

0 comments on commit 51986b3

Please sign in to comment.