File: winsysut.pp

package info (click to toggle)
fpc 1.9.4-5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 63,532 kB
  • ctags: 93,677
  • sloc: pascal: 675,850; makefile: 219,089; xml: 9,242; perl: 7,703; yacc: 3,074; ansic: 2,275; lex: 711; sh: 406; asm: 71; csh: 34; sed: 33; cpp: 26; tcl: 7
file content (88 lines) | stat: -rw-r--r-- 2,108 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
{
    $Id: winsysut.pp,v 1.1 2004/02/08 11:00:18 michael Exp $
    This file is part of the Free Pascal run time library.
    Copyright (c) 2003 by the Free Pascal development team

    Windows specific versions of Borland SysUtils routines.
    
    See the file COPYING.FPC, included in this distribution,
    for details about the copyright.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 **********************************************************************}
{$mode objfpc}
unit winsysut;

Interface

Uses Windows,SysUtils;

const  
  Win32Platform     : Integer = 0;
  Win32MajorVersion : Integer = 0;
  Win32MinorVersion : Integer = 0;
  Win32BuildNumber  : Integer = 0;
                          
  Win32CSDVersion   : string = '';
 
function CheckWin32Version(Major,Minor : Integer ): Boolean;
function CheckWin32Version(Major : Integer): Boolean;
Function Win32Check(RetVal: BOOL): BOOL; 
Procedure RaiseLastWin32Error; 

Implementation

procedure RaiseLastWin32Error;

begin
  RaiseLastOSError;
end;

Function Win32Check(RetVal: BOOL): BOOL; 

begin
  if Not RetVal then 
    RaiseLastOSError;
  Result := RetVal;
end;

procedure InitVersion;

var
  Info: TOSVersionInfo;
  
begin
  Info.dwOSVersionInfoSize := SizeOf(Info);
  if GetVersionEx(Info) then
    with Info do
      begin
      Win32Platform:=dwPlatformId;
      Win32MajorVersion:=dwMajorVersion;
      Win32MinorVersion:=dwMinorVersion;
      if (Win32Platform=VER_PLATFORM_WIN32_WINDOWS) then
        Win32BuildNumber:=dwBuildNumber and $FFFF
      else
        Win32BuildNumber := dwBuildNumber;
      Win32CSDVersion := StrPas(szCSDVersion);
      end;
end;

function CheckWin32Version(Major : Integer): Boolean;

begin
  Result:=CheckWin32Version(Major,0)
end;

function CheckWin32Version(Major,Minor: Integer): Boolean;

begin
  Result := (Win32MajorVersion>Major) or
            ((Win32MajorVersion=Major) and (Win32MinorVersion>=Minor));
end;

Initialization
  InitVersion;
end.