~ubuntu-branches/ubuntu/gutsy/vnc4/gutsy

« back to all changes in this revision

Viewing changes to unix/xc/extras/FreeType/pascal/test/gdrv_os2.inc

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2006-05-15 20:35:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515203517-l4lre1ku942mn26k
Tags: 4.1.1+X4.3.0-10
* Correction of critical security issue. Thanks to Martin Kogler
  <e9925248@student.tuwien.ac.at> that informed me about the issue,
  and provided the patch.
  This flaw was originally found by Steve Wiseman of intelliadmin.com.
* Applied patch from Javier Kohen <jkohen@users.sourceforge.net> that
  inform the user that only 8 first characters of the password will
  actually be used when typing more than 8 characters, closes:
  #355619.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
  {$IFDEF DYNAMIC_VERSION}
 
3
    {$Dynamic System}
 
4
    {$L VPRTL.LIB}
 
5
  {$ENDIF}
 
6
 
 
7
 
 
8
  type
 
9
    Ptr16Rec = record
 
10
      Ofs,Sel: SmallWord;
 
11
    end;
 
12
 
 
13
  var
 
14
    OrgMode   : VioModeInfo;
 
15
    VioBufOfs : Longint;
 
16
    Status    : SmallWord;
 
17
 
 
18
  { BIOS Video Mode
 
19
#13 }
 
20
 
 
21
  const
 
22
    VioMode_640x480x16 : VioModeInfo =
 
23
     ( cb:     SizeOf(VioModeInfo);
 
24
       fbType: vgmt_Other + vgmt_Graphics;
 
25
       Color:  colors_16;
 
26
       Col:    80;
 
27
       Row:    35;
 
28
       HRes:   640;
 
29
       VRes:   480
 
30
     );
 
31
 
 
32
    VioMode_320x200x256 : VioModeInfo =
 
33
     ( cb:     SizeOf(VioModeInfo);
 
34
       fbType: vgmt_Other + vgmt_Graphics;
 
35
       Color:  colors_256;
 
36
       Col:    40;
 
37
       Row:    25;
 
38
       HRes:   320;
 
39
       VRes:   200
 
40
     );
 
41
 
 
42
    VioBuf: VioPhysBuf =
 
43
     ( pBuf: Ptr($A0000);
 
44
       cb:   64*1024
 
45
     );
 
46
 
 
47
  { Restores screen to the original state }
 
48
 
 
49
  function Driver_Restore_Mode: boolean;
 
50
  begin
 
51
    VioSetMode(OrgMode, 0);
 
52
    Driver_Restore_Mode := True;
 
53
  end;
 
54
 
 
55
  function Driver_Set_Graphics( mode : Int )
 
56
 : boolean;
 
57
  var
 
58
    rc : Int;
 
59
  begin
 
60
    Driver_Set_Graphics := False;
 
61
 
 
62
    { Save original video mode }
 
63
    OrgMode.cb := SizeOf(VioModeInfo);
 
64
    VioGetMode(OrgMode, 0);
 
65
 
 
66
    case Mode of
 
67
 
 
68
      Graphics_Mode_Mono : begin
 
69
           rc := VioSetMode( VioMode_640x480x16, 0 );
 
70
                             Vio_ScanLineWidth := 80;
 
71
                             Vio_Width         := 640;
 
72
                             Vio_Height        := 480;
 
73
                           end;
 
74
 
 
75
      Graphics_Mode_Gray : begin
 
76
                             rc := VioSetMode( VioMode_320x200x256, 0 );
 
77
                             Vio_ScanLineWidth := 320;
 
78
                             Vio_Width         := 320;
 
79
                             Vio_Height        := 200;
 
80
 
 
81
                             (* default gray palette takes the gray levels *)
 
82
                             (* the standard VGA 256 colors mode           *)
 
83
 
 
84
                             gray_palette[0] := 0;
 
85
                             gray_palette[1] := 23;
 
86
                             gray_palette[2] := 27;
 
87
                             gray_palette[3] := 29;
 
88
                             gray_palette[4] := 31;
 
89
                           end;
 
90
    else
 
91
      rc := -1;
 
92
    end;
 
93
 
 
94
    { Set VGA 640x400x16
 
95
 video mode }
 
96
    if rc <> 0 then exit;
 
97
 
 
98
    { Get selector for physical video buffer }
 
99
    if VioGetPhysBuf(VioBuf, 0) <> 0 then exit;
 
100
 
 
101
    { Make flat pointer that points to the physical video buffer}
 
102
    Ptr16Rec(VioBufOfs).Ofs := 0;
 
103
    Ptr16Rec(VioBufOfs).Sel := VioBuf.Sel;
 
104
    SelToFlat(Pointer(VioBufOfs));
 
105
 
 
106
    { Clear the screen. Unlike function 0 of the BIOS INT 10h }
 
107
    { VioSetMode doesn't clear the screen.                    }
 
108
    FillChar(Pointer(VioBufOfs)^,64*1024,0);
 
109
    Vio := PVioScreenBuffer(VioBufOfs);
 
110
 
 
111
    Driver_Set_Graphics := True;
 
112
  end;
 
113
 
 
114
 
 
115
  procedure Driver_Display_Bitmap; assembler;
 
116
  asm
 
117
    push esi
 
118
    push edi
 
119
    push ebx
 
120
    push ecx
 
121
 
 
122
    mov esi,[Buff]
 
123
 
 
124
    mov ecx,[Vio_ScanLineWidth]
 
125
    mov ebx,[Col]
 
126
    mov eax,[Line]
 
127
 
 
128
    dec eax
 
129
    mul ecx
 
130
 
 
131
    mov edi,[VioBufOfs]
 
132
    add edi,eax
 
133
 
 
134
    mov edx,[line]
 
135
    add ebx,[Vio_ScanLineWidth]
 
136
   @1:
 
137
    mov ecx,[col]
 
138
    rep movsb
 
139
    sub edi,ebx
 
140
    dec edx
 
141
    jnz @1
 
142
 
 
143
    pop ecx
 
144
    pop ebx
 
145
    pop edi
 
146
    pop esi
 
147
  end;
 
148