13 changed files
common | ||
JclMime.pas | ||
JclResources.pas | ||
JclSysInfo.pas | ||
include | ||
jedi | ||
jedi.inc | ||
crossplatform.inc | ||
jcl.inc | ||
jcld25win32.inc + | ||
jcld25win64.inc + | ||
unixonly.inc | ||
windowsonly.inc | ||
windows | ||
JclDebug.pas | ||
JclPeImage.pas | ||
JclTD32.pas | ||
Add comment 397 procedure MimeEncodeFullLines(const InputBuffer: TDynByteArray; InputOffset: SizeInt;
Add comment 398 const InputByteCount: SizeInt; out OutputBuffer: TDynByteArray; OutputOffset: SizeInt);
Add comment 399 var
Add comment 400 Minus B, InnerLimit, OuterLimit: SizeInt;
Add comment 401 Minus InIndex: SizeInt;
Add comment 402 Minus OutIndex: SizeInt;
Add comment 400 Plus B: SizeInt;
Add comment 401 Plus InnerLimit, OuterLimit: TJclAddr;
Add comment 402 Plus InIndex: TJclAddr;
Add comment 403 Plus OutIndex: TJclAddr;
Add comment 403 404 begin
Add comment 404 405 { Do we have enough input to encode a full line? }
Add comment 405 406 if InputByteCount < MIME_DECODED_LINE_BREAK then
Add comment 499 500 procedure MimeEncodeNoCRLF(const InputBuffer: TDynByteArray; InputOffset: SizeInt;
Add comment 500 501 const InputByteCount: SizeInt; out OutputBuffer: TDynByteArray; OutputOffset: SizeInt);
Add comment 501 502 var
Add comment 502 Minus B, InnerLimit, OuterLimit: SizeInt;
Add comment 503 Minus InIndex: SizeInt;
Add comment 504 Minus OutIndex: SizeInt;
Add comment 503 Plus B: SizeInt;
Add comment 504 Plus InnerLimit, OuterLimit: TJclAddr;
Add comment 505 Plus InIndex: TJclAddr;
Add comment 506 Plus OutIndex: TJclAddr;
Add comment 505 507 begin
Add comment 506 508 if InputByteCount = 0 then
Add comment 507 509 Exit;
Add comment 536 538 end;
Add comment 537 539
Add comment 538 540 { End of data & padding. }
Add comment 539 Minus case InputByteCount - OuterLimit of
Add comment 541 Plus case TJclAddr(InputByteCount) - OuterLimit of
Add comment 540 542 1:
Add comment 541 543 begin
Add comment 542 544 B := InputBuffer[InIndex + 0];
Add comment 566 568 procedure MimeEncodeNoCRLF(const InputBuffer; const InputByteCount: SizeInt; out OutputBuffer);
Add comment 567 569 var
Add comment 568 570 B: Cardinal;
Add comment 569 Minus InnerLimit, OuterLimit: SizeInt;
Add comment 571 Plus InnerLimit, OuterLimit: TJclAddr;
Add comment 570 572 InPtr: PByte3;
Add comment 571 573 OutPtr: PByte4;
Add comment 572 574 begin
Add comment 603 605 end;
Add comment 604 606
Add comment 605 607 { End of data & padding. }
Add comment 606 Minus case InputByteCount - OuterLimit of
Add comment 608 Plus case TJclAddr(InputByteCount) - OuterLimit of
Add comment 607 609 1:
Add comment 608 610 begin
Add comment 609 611 B := InPtr^.B1;
Add comment 661 663 var ByteBuffer: Cardinal; var ByteBufferSpace: Cardinal): SizeInt;
Add comment 662 664 var
Add comment 663 665 LByteBuffer, LByteBufferSpace, C: Cardinal;
Add comment 664 Minus InIndex, OuterLimit: SizeInt;
Add comment 665 Minus OutIndex: SizeInt;
Add comment 666 Plus InIndex, OuterLimit: TJclAddr;
Add comment 667 Plus OutIndex: TJclAddr;
Add comment 666 668 begin
Add comment 667 669 if InputByteCount > 0 then
Add comment 668 670 begin
Add comment 669 671 InIndex := InputOffset;
Add comment 670 Minus OuterLimit := InIndex + InputByteCount;
Add comment 672 Plus OuterLimit := InIndex + TJclAddr(InputByteCount);
Add comment 671 673 OutIndex := OutputOffset;
Add comment 672 674 LByteBuffer := ByteBuffer;
Add comment 673 675 LByteBufferSpace := ByteBufferSpace;
Add comment 697 699 end;
Add comment 698 700 ByteBuffer := LByteBuffer;
Add comment 699 701 ByteBufferSpace := LByteBufferSpace;
Add comment 700 Minus Result := OutIndex - OutputOffset;
Add comment 702 Plus Result := OutIndex - TJclAddr(OutputOffset);
Add comment 701 703 end
Add comment 702 704 else
Add comment 703 705 Result := 0;
Add comment 1129 RsCompressionSquashFSExtensions = '*.squashfs';
Add comment 1130 RsCompressionCramFSName = 'CramFS archive';
Add comment 1131 RsCompressionCramFSExtensions = '*.cramfs';
Add comment 1132 Plus RsCompressionExtName = 'Ext filesystem archive';
Add comment 1133 Plus RsCompressionExtExtensions = '*.ext;*.ext2;*.ext3;*.ext4;*.img';
Add comment 1134 Plus RsCompressionVMDKName = 'Virtual Machine Disk archive';
Add comment 1135 Plus RsCompressionVMDKExtensions = '*.vmdk';
Add comment 1136 Plus RsCompressionVDIName = 'Virtual Disk Image archive';
Add comment 1137 Plus RsCompressionVDIExtensions = '*.vdi';
Add comment 1138 Plus RsCompressionQcowName = 'QEMU Copy On Write archive';
Add comment 1139 Plus RsCompressionQcowExtensions = '*.qcow;*.qcow2;*.qcow2c';
Add comment 1140 Plus RsCompressionGPTName = 'GUID Partition Table archive';
Add comment 1141 Plus RsCompressionGPTExtensions = '*.gpt;*.mbr';
Add comment 1142 Plus RsCompressionRar5Name = 'RAR v5 archive';
Add comment 1143 Plus RsCompressionRar5Extensions = '*.rar;*.r00';
Add comment 1144 Plus RsCompressionIHexName = 'IHex archive';
Add comment 1145 Plus RsCompressionIHexExtensions = '*.ihex';
Add comment 1146 Plus RsCompressionHxsName = 'Help 2.0 archive';
Add comment 1147 Plus RsCompressionHxsExtensions = '*.hxs;*.hxi;*.hxr;*.hxq;*.hxw;*.lit';
Add comment 1132 1148 RsCompressionDuplicate = 'The file %s already exists in the archive';
Add comment 1133 1149 RsCompressionReplaceError = 'At least one compression volume could not be replaced after an archive out-of-place update';
Add comment 1134 1150
Add comment 237 function ModuleFromAddr(const Addr: Pointer): HMODULE;
Add comment 238 function IsSystemModule(const Module: HMODULE): Boolean;
Add comment 239
Add comment 240 Plus procedure BeginModuleFromAddrCache;
Add comment 241 Plus procedure EndModuleFromAddrCache;
Add comment 242 Plus function CachedModuleFromAddr(const Addr: Pointer): HMODULE;
Add comment 243 Plus
Add comment 240 244 function IsMainAppWindow(Wnd: THandle): Boolean;
Add comment 241 245 function IsWindowResponding(Wnd: THandle; Timeout: Integer): Boolean;
Add comment 242 246
Add comment 341 345 function GetWindowsVersionNumber: string;
Add comment 342 346 function GetWindowsServicePackVersion: Integer;
Add comment 343 347 function GetWindowsServicePackVersionString: string;
Add comment 348 Plus function GetWindows10ReleaseId: Integer;
Add comment 349 Plus function GetWindows10ReleaseName: String;
Add comment 350 Plus function GetWindows10ReleaseCodeName: String;
Add comment 351 Plus function GetWindows10ReleaseVersion: String;
Add comment 344 352 function GetOpenGLVersion(const Win: THandle; out Version, Vendor: AnsiString): Boolean;
Add comment 345 353 function GetNativeSystemInfo(var SystemInfo: TSystemInfo): Boolean;
Add comment 346 354 function GetProcessorArchitecture: TProcessorArchitecture;
Add comment 2406 2414
Add comment 2407 2415 {$IFDEF MSWINDOWS}
Add comment 2408 2416 function GetRegisteredCompany: string;
Add comment 2417 Plus var
Add comment 2418 Plus LastAccessMode: TJclRegWOW64Access;
Add comment 2409 2419 begin
Add comment 2410 2420 { TODO : check for MSDN documentation }
Add comment 2421 Plus LastAccessMode := RegGetWOW64AccessMode;
Add comment 2422 Plus try
Add comment 2423 Plus RegSetWOW64AccessMode(raNative);
Add comment 2411 2424 Result := RegReadStringDef(HKEY_LOCAL_MACHINE, REG_CURRENT_VERSION, 'RegisteredOrganization', '');
Add comment 2425 Plus finally
Add comment 2426 Plus RegSetWOW64AccessMode(LastAccessMode);
Add comment 2412 2427 end;
Add comment 2428 Plus end;
Add comment 2413 2429
Add comment 2414 2430 function GetRegisteredOwner: string;
Add comment 2431 Plus var
Add comment 2432 Plus LastAccessMode: TJclRegWOW64Access;
Add comment 2415 2433 begin
Add comment 2416 2434 { TODO : check for MSDN documentation }
Add comment 2435 Plus LastAccessMode := RegGetWOW64AccessMode;
Add comment 2436 Plus try
Add comment 2437 Plus RegSetWOW64AccessMode(raNative);
Add comment 2417 2438 Result := RegReadStringDef(HKEY_LOCAL_MACHINE, REG_CURRENT_VERSION, 'RegisteredOwner', '');
Add comment 2439 Plus finally
Add comment 2440 Plus RegSetWOW64AccessMode(LastAccessMode);
Add comment 2441 Plus end;
Add comment 2418 2442 end;
Add comment 2419 2443
Add comment 2420 2444 { TODO: Check supported platforms, maybe complete rewrite }
Add comment 2960 2984 var
Add comment 2961 2985 MI: TMemoryBasicInformation;
Add comment 2962 2986 begin
Add comment 2963 Minus MI.AllocationBase := nil;
Add comment 2964 Minus VirtualQuery(Addr, MI, SizeOf(MI));
Add comment 2965 Minus if MI.State <> MEM_COMMIT then
Add comment 2966 Minus Result := 0
Add comment 2987 Plus if (VirtualQuery(Addr, MI, SizeOf(MI)) = SizeOf(MI)) and (MI.State = MEM_COMMIT) then
Add comment 2988 Plus Result := HMODULE(MI.AllocationBase)
Add comment 2967 2989 else
Add comment 2968 Minus Result := HMODULE(MI.AllocationBase);
Add comment 2990 Plus Result := 0;
Add comment 2969 2991 end;
Add comment 2970 2992
Add comment 2971 2993 function IsSystemModule(const Module: HMODULE): Boolean;
Add comment 2985 3007 end;
Add comment 2986 3008 CurModule := CurModule.Next;
Add comment 2987 3009 end;
Add comment 3010 Plus end;
Add comment 3011 Plus end;
Add comment 3012 Plus
Add comment 3013 Plus
Add comment 3014 Plus // Cache for the slow VirtualQuery calls
Add comment 3015 Plus //
Add comment 3016 Plus // BeginModuleFromAddrCache;
Add comment 3017 Plus // try
Add comment 3018 Plus // Module := CachedModuleFromAddr(Address);
Add comment 3019 Plus // ...
Add comment 3020 Plus // finally
Add comment 3021 Plus // EndModuleFromAddrCache;
Add comment 3022 Plus // end;
Add comment 3023 Plus type
Add comment 3024 Plus PModuleAddrSize = ^TModuleAddrSize;
Add comment 3025 Plus TModuleAddrSize = record
Add comment 3026 Plus BaseAddress: TJclAddr;
Add comment 3027 Plus Size: SizeInt;
Add comment 3028 Plus Module: HMODULE;
Add comment 3029 Plus end;
Add comment 3030 Plus
Add comment 3031 Plus TModuleAddrSizeList = class(TList)
Add comment 3032 Plus public
Add comment 3033 Plus Counter: Integer;
Add comment 3034 Plus LastAccessIndex: Integer;
Add comment 2988 3035 end;
Add comment 3036 Plus
Add comment 3037 Plus // The main module (EXE) and the module that contains the JclSysInfo unit can be
Add comment 3038 Plus // cached once for all Begin/EndModuleFromAddrCache blocks.
Add comment 3039 Plus var
Add comment 3040 Plus MainModuleAddrSize, InstanceModuleAddrSize: TModuleAddrSize;
Add comment 3041 Plus
Add comment 3042 Plus threadvar
Add comment 3043 Plus ModuleAddrSize: TModuleAddrSizeList;
Add comment 3044 Plus
Add comment 3045 Plus procedure BeginModuleFromAddrCache;
Add comment 3046 Plus const
Add comment 3047 Plus ModuleCodeOffset = $1000;
Add comment 3048 Plus var
Add comment 3049 Plus List: TModuleAddrSizeList;
Add comment 3050 Plus MainModule: HMODULE;
Add comment 3051 Plus P: PModuleAddrSize;
Add comment 3052 Plus begin
Add comment 3053 Plus List := ModuleAddrSize;
Add comment 3054 Plus if List = nil then
Add comment 3055 Plus begin
Add comment 3056 Plus List := TModuleAddrSizeList.Create;
Add comment 3057 Plus List.Counter := 1;
Add comment 3058 Plus List.LastAccessIndex := -1;
Add comment 3059 Plus ModuleAddrSize := List;
Add comment 3060 Plus
Add comment 3061 Plus // Query the module addresses for the main module and JclSysInfo's module and
Add comment 3062 Plus // add them to the list.
Add comment 3063 Plus MainModule := 0;
Add comment 3064 Plus if MainModuleAddrSize.Module = 0 then
Add comment 3065 Plus begin
Add comment 3066 Plus MainModule := GetModuleHandle(nil);
Add comment 3067 Plus CachedModuleFromAddr(Pointer(MainModule + ModuleCodeOffset));
Add comment 3068 Plus if List.Count = 1 then
Add comment 3069 Plus begin
Add comment 3070 Plus // If JclSysInfo is in the main module then we can skip this
Add comment 3071 Plus if MainModule <> HInstance then
Add comment 3072 Plus begin
Add comment 3073 Plus CachedModuleFromAddr(Pointer(HInstance + ModuleCodeOffset));
Add comment 3074 Plus if List.Count = 2 then
Add comment 3075 Plus InstanceModuleAddrSize := PModuleAddrSize(List[1])^;
Add comment 3076 Plus end;
Add comment 3077 Plus MainModuleAddrSize := PModuleAddrSize(List[0])^;
Add comment 3078 Plus List.LastAccessIndex := -1;
Add comment 3079 Plus end;
Add comment 3080 Plus end;
Add comment 3081 Plus
Add comment 3082 Plus if (MainModule = 0) and (MainModuleAddrSize.Module <> 0) then
Add comment 3083 Plus begin
Add comment 3084 Plus New(P);
Add comment 3085 Plus P^ := MainModuleAddrSize;
Add comment 3086 Plus List.Add(P);
Add comment 3087 Plus if InstanceModuleAddrSize.Module <> 0 then
Add comment 3088 Plus begin
Add comment 3089 Plus New(P);
Add comment 3090 Plus P^ := InstanceModuleAddrSize;
Add comment 3091 Plus List.Add(P);
Add comment 3092 Plus end;
Add comment 3093 Plus end;
Add comment 3094 Plus end
Add comment 3095 Plus else
Add comment 3096 Plus Inc(List.Counter);
Add comment 3097 Plus end;
Add comment 3098 Plus
Add comment 3099 Plus procedure EndModuleFromAddrCache;
Add comment 3100 Plus var
Add comment 3101 Plus List: TModuleAddrSizeList;
Add comment 3102 Plus I: Integer;
Add comment 3103 Plus begin
Add comment 3104 Plus List := ModuleAddrSize;
Add comment 3105 Plus if List <> nil then
Add comment 3106 Plus begin
Add comment 3107 Plus Dec(List.Counter);
Add comment 3108 Plus if List.Counter = 0 then
Add comment 3109 Plus begin
Add comment 3110 Plus for I := 0 to List.Count - 1 do
Add comment 3111 Plus Dispose(PModuleAddrSize(List[I]));
Add comment 3112 Plus List.Free;
Add comment 3113 Plus ModuleAddrSize := nil;
Add comment 3114 Plus end;
Add comment 3115 Plus end;
Add comment 3116 Plus end;
Add comment 3117 Plus
Add comment 3118 Plus function CachedModuleFromAddr(const Addr: Pointer): HMODULE;
Add comment 3119 Plus var
Add comment 3120 Plus P: PModuleAddrSize;
Add comment 3121 Plus List: TModuleAddrSizeList;
Add comment 3122 Plus I, LastAccessIndex: Integer;
Add comment 3123 Plus MI: TMemoryBasicInformation;
Add comment 3124 Plus begin
Add comment 3125 Plus List := ModuleAddrSize;
Add comment 3126 Plus if List = nil then
Add comment 3127 Plus begin
Add comment 3128 Plus Result := ModuleFromAddr(Addr);
Add comment 3129 Plus Exit;
Add comment 2989 3130 end;
Add comment 2990 3131
Add comment 3132 Plus LastAccessIndex := List.LastAccessIndex;
Add comment 3133 Plus if LastAccessIndex <> -1 then
Add comment 3134 Plus begin
Add comment 3135 Plus P := List[LastAccessIndex];
Add comment 3136 Plus if (P.BaseAddress <= TJclAddr(Addr)) and
Add comment 3137 Plus (TJclAddr(Addr) < P.BaseAddress + TJclAddr(P.Size)) then
Add comment 3138 Plus begin
Add comment 3139 Plus Result := P.Module;
Add comment 3140 Plus Exit;
Add comment 3141 Plus end;
Add comment 3142 Plus end;
Add comment 3143 Plus
Add comment 3144 Plus for I := 0 to List.Count - 1 do
Add comment 3145 Plus begin
Add comment 3146 Plus P := List[I];
Add comment 3147 Plus if (P.BaseAddress <= TJclAddr(Addr)) and
Add comment 3148 Plus (TJclAddr(Addr) < P.BaseAddress + TJclAddr(P.Size)) then
Add comment 3149 Plus begin
Add comment 3150 Plus List.LastAccessIndex := I;
Add comment 3151 Plus Result := P.Module;
Add comment 3152 Plus Exit;
Add comment 3153 Plus end;
Add comment 3154 Plus end;
Add comment 3155 Plus
Add comment 3156 Plus if (VirtualQuery(Addr, MI, SizeOf(MI)) = SizeOf(MI)) and (MI.State = MEM_COMMIT) then
Add comment 3157 Plus begin
Add comment 3158 Plus New(P);
Add comment 3159 Plus P.Module := HMODULE(MI.AllocationBase);
Add comment 3160 Plus P.BaseAddress := TJclAddr(MI.BaseAddress);
Add comment 3161 Plus P.Size := MI.RegionSize;
Add comment 3162 Plus List.LastAccessIndex := List.Add(P);
Add comment 3163 Plus Result := HMODULE(MI.AllocationBase);
Add comment 3164 Plus end
Add comment 3165 Plus else
Add comment 3166 Plus Result := 0;
Add comment 3167 Plus end;
Add comment 3168 Plus
Add comment 2991 3169 // Reference: http://msdn.microsoft.com/library/periodic/period97/win321197.htm
Add comment 2992 3170 { TODO : wrong link }
Add comment 2993 3171
Add comment 3901 4079 // Starting with Windows 8.1, the GetVersion(Ex) API is deprecated and will detect the
Add comment 3902 4080 // application as Windows 8 (kernel version 6.2) until an application manifest is included
Add comment 3903 4081 // See https://msdn.microsoft.com/en-us/library/windows/desktop/dn302074.aspx
Add comment 3904 Minus if (Win32MajorVersion = 6) and (Win32MinorVersion = 2) then
Add comment 3905 Minus Result := strToInt(RegReadStringDef(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'CurrentBuildNumber', intToStr(Win32BuildNumber)))
Add comment 4082 Plus if ((Win32MajorVersion = 6) and (Win32MinorVersion = 2)) or (Win32MajorVersion = 10) then
Add comment 4083 Plus Result := StrToInt(RegReadStringDef(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'CurrentBuildNumber', IntToStr(Win32BuildNumber)))
Add comment 3906 4084 else
Add comment 3907 4085 Result := Win32BuildNumber;
Add comment 3908 4086 end;
Add comment 3909 4087
Add comment 3910 4088 function GetWindowsMajorVersionNumber: Integer;
Add comment 4089 Plus var
Add comment 4090 Plus Ver: string;
Add comment 3911 4091 begin
Add comment 3912 4092 // Starting with Windows 8.1, the GetVersion(Ex) API is deprecated and will detect the
Add comment 3913 4093 // application as Windows 8 (kernel version 6.2) until an application manifest is included
Add comment 3914 4094 // See https://msdn.microsoft.com/en-us/library/windows/desktop/dn302074.aspx
Add comment 3915 Minus if (Win32MajorVersion = 6) and (Win32MinorVersion = 2) then
Add comment 4095 Plus if ((Win32MajorVersion = 6) and (Win32MinorVersion = 2)) or (Win32MajorVersion = 10) then
Add comment 3916 4096 begin
Add comment 3917 4097 // CurrentMajorVersionNumber present in registry starting with Windows 10
Add comment 3918 4098 // If CurrentMajorVersionNumber not present in registry then use CurrentVersion
Add comment 3919 4099 Result := RegReadIntegerDef(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'CurrentMajorVersionNumber', -1);
Add comment 3920 4100 if Result = -1 then
Add comment 3921 Minus Result := strToInt(StrBefore('.', RegReadStringDef(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'CurrentVersion', intToStr(Win32MajorVersion) + '.' + intToStr(Win32MinorVersion))));
Add comment 4101 Plus begin
Add comment 4102 Plus Ver := RegReadStringDef(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'CurrentVersion', IntToStr(Win32MajorVersion) + '.' + IntToStr(Win32MinorVersion));
Add comment 4103 Plus Result := StrToIntDef(Copy(Ver, 1, Pos('.', Ver) - 1), 2); // don't use StrBefore because it uses StrCaseMap that may not be initialized yet
Add comment 4104 Plus end;
Add comment 3922 4105 end
Add comment 3923 4106 else
Add comment 3924 4107 Result := Win32MajorVersion;
Add comment 3925 4108 end;
Add comment 3926 4109
Add comment 3927 4110 function GetWindowsMinorVersionNumber: Integer;
Add comment 4111 Plus var
Add comment 4112 Plus Ver: string;
Add comment 3928 4113 begin
Add comment 3929 4114 // Starting with Windows 8.1, the GetVersion(Ex) API is deprecated and will detect the
Add comment 3930 4115 // application as Windows 8 (kernel version 6.2) until an application manifest is included
Add comment 3931 4116 // See https://msdn.microsoft.com/en-us/library/windows/desktop/dn302074.aspx
Add comment 3932 Minus if (Win32MajorVersion = 6) and (Win32MinorVersion = 2) then
Add comment 4117 Plus if ((Win32MajorVersion = 6) and (Win32MinorVersion = 2)) or (Win32MajorVersion = 10) then
Add comment 3933 4118 begin
Add comment 3934 4119 // CurrentMinorVersionNumber present in registry starting with Windows 10
Add comment 3935 4120 // If CurrentMinorVersionNumber not present then use CurrentVersion
Add comment 3936 4121 Result := RegReadIntegerDef(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'CurrentMinorVersionNumber', -1);
Add comment 3937 4122 if Result = -1 then
Add comment 3938 Minus Result := strToInt(StrAfter('.', RegReadStringDef(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'CurrentVersion', intToStr(Win32MajorVersion) + '.' + intToStr(Win32MinorVersion))));
Add comment 4123 Plus begin
Add comment 4124 Plus Ver := RegReadStringDef(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'CurrentVersion', IntToStr(Win32MajorVersion) + '.' + IntToStr(Win32MinorVersion));
Add comment 4125 Plus Result := StrToIntDef(Copy(Ver, Pos('.', Ver) + 1, Length(Ver)), 2); // don't use StrAfter because it uses StrCaseMap that may not be initialized yet
Add comment 4126 Plus end;
Add comment 3939 4127 end
Add comment 3940 4128 else
Add comment 3941 4129 Result := Win32MinorVersion;
Add comment 3944 4132 function GetWindowsVersionNumber: string;
Add comment 3945 4133 begin
Add comment 3946 4134 // Returns version number as MajorVersionNumber.MinorVersionNumber (string type)
Add comment 3947 Minus Result := intToStr(GetWindowsMajorVersionNumber) + '.' + intToStr(GetWindowsMinorVersionNumber);
Add comment 4135 Plus Result := Format('%d.%d', [GetWindowsMajorVersionNumber, GetWindowsMinorVersionNumber]);
Add comment 3948 4136 end;
Add comment 3949 4137
Add comment 3950 4138 function GetWindowsServicePackVersion: Integer;
Add comment 3979 4167 else
Add comment 3980 4168 Result := '';
Add comment 3981 4169 end;
Add comment 4170 Plus
Add comment 4171 Plus function GetWindows10ReleaseId: Integer;
Add comment 4172 Plus begin
Add comment 4173 Plus if IsWin10 then
Add comment 4174 Plus Result := StrToIntDef(RegReadStringDef(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'ReleaseId', '0'), -1)
Add comment 4175 Plus else
Add comment 4176 Plus Result := -1;
Add comment 4177 Plus end;
Add comment 4178 Plus
Add comment 4179 Plus function GetWindows10ReleaseName: String;
Add comment 4180 Plus begin
Add comment 4181 Plus if IsWin10 then
Add comment 4182 Plus begin
Add comment 4183 Plus case GetWindows10ReleaseId of
Add comment 4184 Plus 1507:
Add comment 4185 Plus Result := 'Windows 10';
Add comment 4186 Plus 1511:
Add comment 4187 Plus Result := 'Windows 10 November Update';
Add comment 4188 Plus 1607:
Add comment 4189 Plus Result := 'Windows 10 Anniversary Update';
Add comment 4190 Plus 1703:
Add comment 4191 Plus Result := 'Windows 10 Creators Update';
Add comment 4192 Plus 1709:
Add comment 4193 Plus Result := 'Windows 10 Fall Creators Update';
Add comment 4194 Plus 1803:
Add comment 4195 Plus Result := 'Windows 10 April 2018 Update';
Add comment 4196 Plus else
Add comment 4197 Plus Result := '';
Add comment 4198 Plus end;
Add comment 4199 Plus end
Add comment 4200 Plus else
Add comment 4201 Plus Result := '';
Add comment 4202 Plus end;
Add comment 3982 4203
Add comment 4204 Plus function GetWindows10ReleaseCodeName: String;
Add comment 4205 Plus begin
Add comment 4206 Plus if IsWin10 then
Add comment 4207 Plus begin
Add comment 4208 Plus case GetWindows10ReleaseId of
Add comment 4209 Plus 1507:
Add comment 4210 Plus Result := 'Threshold 1';
Add comment 4211 Plus 1511:
Add comment 4212 Plus Result := 'Threshold 2';
Add comment 4213 Plus 1607:
Add comment 4214 Plus Result := 'Redstone 1';
Add comment 4215 Plus 1703:
Add comment 4216 Plus Result := 'Redstone 2';
Add comment 4217 Plus 1709:
Add comment 4218 Plus Result := 'Redstone 3';
Add comment 4219 Plus 1803:
Add comment 4220 Plus Result := 'Redstone 4';
Add comment 4221 Plus else
Add comment 4222 Plus Result := '';
Add comment 4223 Plus end;
Add comment 4224 Plus end
Add comment 4225 Plus else
Add comment 4226 Plus Result := '';
Add comment 4227 Plus end;
Add comment 4228 Plus
Add comment 4229 Plus function GetWindows10ReleaseVersion: String;
Add comment 4230 Plus var
Add comment 4231 Plus WindowsReleaseId: Integer;
Add comment 4232 Plus begin
Add comment 4233 Plus if IsWin10 then
Add comment 4234 Plus begin
Add comment 4235 Plus WindowsReleaseId := GetWindows10ReleaseId;
Add comment 4236 Plus if WindowsReleaseId > 0 then
Add comment 4237 Plus Result := 'Windows 10 Version ' + IntToStr(WindowsReleaseId)
Add comment 4238 Plus else
Add comment 4239 Plus Result := '';
Add comment 4240 Plus end
Add comment 4241 Plus else
Add comment 4242 Plus Result := '';
Add comment 4243 Plus end;
Add comment 4244 Plus
Add comment 3983 4245 // Imports copied from OpenGL unit. Direct using of OpenGL unit might cause unexpected problems due
Add comment 3984 4246 // setting 8087CW in the intialization section
Add comment 3985 4247 {
Add comment 4204 4466 GetSystemInfo(SystemInfo);
Add comment 4205 4467 end;
Add comment 4206 4468
Add comment 4469 Plus var
Add comment 4470 Plus CachedGetProcessorArchitecture: DWORD = DWORD(-1);
Add comment 4471 Plus
Add comment 4207 4472 function GetProcessorArchitecture: TProcessorArchitecture;
Add comment 4208 4473 var
Add comment 4209 4474 ASystemInfo: TSystemInfo;
Add comment 4210 4475 begin
Add comment 4476 Plus if CachedGetProcessorArchitecture = DWORD(-1) then
Add comment 4477 Plus begin
Add comment 4211 4478 ASystemInfo.dwOemId := 0;
Add comment 4212 4479 GetNativeSystemInfo(ASystemInfo);
Add comment 4213 Minus case ASystemInfo.wProcessorArchitecture of
Add comment 4480 Plus CachedGetProcessorArchitecture := ASystemInfo.wProcessorArchitecture;
Add comment 4481 Plus end;
Add comment 4482 Plus case CachedGetProcessorArchitecture of
Add comment 4214 4483 PROCESSOR_ARCHITECTURE_INTEL:
Add comment 4215 4484 Result := pax8632;
Add comment 4216 4485 PROCESSOR_ARCHITECTURE_IA64:
Add comment 4223 4492 end;
Add comment 4224 4493
Add comment 4225 4494 function IsWindows64: Boolean;
Add comment 4226 Minus var
Add comment 4227 Minus ASystemInfo: TSystemInfo;
Add comment 4228 4495 begin
Add comment 4229 Minus ASystemInfo.dwOemId := 0;
Add comment 4230 Minus GetNativeSystemInfo(ASystemInfo);
Add comment 4231 Minus Result := ASystemInfo.wProcessorArchitecture in [PROCESSOR_ARCHITECTURE_IA64,PROCESSOR_ARCHITECTURE_AMD64];
Add comment 4496 Plus Result := GetProcessorArchitecture in [paIA64, pax8664];
Add comment 4232 4497 end;
Add comment 4233 4498
Add comment 4234 4499 function JclCheckWinVersion(Major, Minor: Integer): Boolean;