Wingage

Status
Niet open voor verdere reacties.

captain

Gebruiker
Lid geworden
23 feb 2001
Berichten
803
deze sectie is veels te stil, vandaar het pas-bestandje van een progje dat ik in januari 1999 in Delphi 2.0 maakte om

'Windows wordt gestart'

te veranderen in iets leukers :) ik herinner me dat de originele versie een hele mooie in cirkels 'weg-fadende' blauwkleur had. mmm dat was mooi ja. en ook de code bleek grappig en uitstekend bruikbaar als demo-materiaal. maar goed straks ga ik weer spontaan een gedicht opdreunen.

WAARSCHUWING:
zoals ie nu is staat ie klaar om te worden toegepast op windows 98 versie 4.10.2222
GEBRUIK 'M NIET OP EEN ANDERE (SUB)VERSIE VAN WINDOWS of de gevolgen zijn weerzinwekkend :(

geen idee hoe je hier inspringingen in je code houdt, dus denk die er maar ff bij.

tot slot: waan je in 1999.
en let dus niet op m'n 'engels'!
-------------------------------------------------------------------
{
Wingage demo
written in January 1999
by Captain


warning:
take care using the right os!
}


unit Wgage;

interface

uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, ExtCtrls;

type
TForm1 = class(TForm)
Image1: TImage;
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;


{ This interesting demo (2 main procedures almost reverse to each other)
can be extended with a part of code that sets Logo=0 in read-only
MSDOS.SYS. Besides, very more important, the Windows version has to be
checked before any action, because IO.SYS file differs in each edition! I
would like other editions to be added, and after detection by reading
COMMAND.COM or WINVER.EXE or the Windows register (or?? - explore!
maybe the length of IO.SYS itself?!) it could be published on the form
itself (table below).
Furthermore CR/LF options could be built in, i.e. by an ASCII combination
like '//' (without quotes) or by a function key combination.
Sentence extension with spaces is an equal must. Anyhow:

Wingage! :)) }


{
IO.SYS Windows edition table (CIOMPARE.TXT)
========================================================================
length IO.SYS start address length
in bytes Wingage Wingage
Windows decimal text text

95 4.00.950 (version A) 0x367AC=223148d 0x F31A=62234d 0x1A=26d
95 4.00.1111 (version B) 0x34734=214836d 0x10961=67937d 0x27=39d
98 4.10.2222 0x364B6=222390d 0x10ACF=68303d 0x2A=42d
======================================================================== }


TIOTable = array[$0..$41] of byte;

TIOFile = file of byte;

var
Form1: TForm1;
IOTable: TIOTable;
IOFile: TIOFile;
FilePoint: LongInt;
MuteString: string[42];
Attrib: word;
Drive: string;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
Drive := InputBox('Wingage', 'Please enter your system drive:' ,'C');
while Length(Drive) <> 1 do
begin
Application.MessageBox('One letter please !', 'Error',
mb_Ok + mb_IconStop);
Drive := InputBox('Wingage', 'Please enter your system drive:', 'C')
end;
MuteString := '';
{$I-}
try
Attrib := FileGetAttr(Drive + ':\IO.SYS');
FileSetAttr(Drive + ':\IO.SYS', 0);
AssignFile(IOFile, Drive + ':\IO.SYS');
Reset(IOFile); { required }
for FilePoint := $10ACF to $10AF8 do
begin
Seek(IOFile, FilePoint);
Read(IOFile, IOTable[FilePoint - $10ACF]);
MuteString := MuteString + Chr(IOTable[FilePoint - $10ACF]);
end;
CloseFile(IOFile);
FileSetAttr(Drive + ':\IO.SYS', Attrib)
except
Application.MessageBox('Failed to read from IO.SYS !', 'Error',
mb_Ok + mb_IconStop)
end;
{$I+}
Edit1.Text := MuteString
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
MuteString := Edit1.Text;
{$I-}
try
Attrib := FileGetAttr(Drive + ':\IO.SYS');
FileSetAttr(Drive + ':\IO.SYS', 0);
AssignFile(IOFile, Drive + ':\IO.SYS');
Reset(IOFile); { required }
for FilePoint := $10ACF to $10AF8 do
begin
IOTable[FilePoint - $10ACF] := Ord(MuteString[FilePoint - $10ACE{!}]);
Seek(IOFile, FilePoint);
Write(IOFile, IOTable[FilePoint - $10ACF])
end;
CloseFile(IOFile);
FileSetAttr(Drive + ':\IO.SYS', Attrib)
except
Application.MessageBox('Failed to write to IO.SYS !', 'Error',
mb_Ok + mb_IconStop)
end;
{$I+}
Close
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Close
end;

end.
 
Geplaatst door captain
Code:
-------------------------------------------------------------------
{
Wingage demo
written in January 1999
by Captain


warning:
take care using the right os!
}


unit Wgage;

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Image1: TImage;
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;


{ This interesting demo (2 main procedures almost reverse to each other)
  can be extended with a part of code that sets Logo=0 in read-only
  MSDOS.SYS. Besides, very more important, the Windows version has to be
  checked before any action, because IO.SYS file differs in each edition! I
  would like other editions to be added, and after detection by reading
  COMMAND.COM or WINVER.EXE or the Windows register (or?? - explore!
  maybe the length of IO.SYS itself?!) it could be published on the form
  itself (table below).
  Furthermore CR/LF options could be built in, i.e. by an ASCII combination
  like '//' (without quotes) or by a function key combination.
  Sentence extension with spaces is an equal must. Anyhow:

  Wingage! :)) }


{
IO.SYS Windows edition table (CIOMPARE.TXT)
========================================================================
			 length IO.SYS       	start address	length
			 in bytes	        Wingage		Wingage
Windows			 decimal		text		text

95 4.00.950 (version A)	 0x367AC=223148d	0x F31A=62234d	0x1A=26d
95 4.00.1111 (version B) 0x34734=214836d	0x10961=67937d	0x27=39d
98 4.10.2222		 0x364B6=222390d	0x10ACF=68303d	0x2A=42d
========================================================================  }


  TIOTable = array[$0..$41] of byte;

  TIOFile = file of byte;

var
  Form1: TForm1;
  IOTable: TIOTable;
  IOFile: TIOFile;
  FilePoint: LongInt;
  MuteString: string[42];
  Attrib: word;
  Drive: string;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Drive := InputBox('Wingage', 'Please enter your system drive:' ,'C');
  while Length(Drive) <> 1 do
  begin
    Application.MessageBox('One letter please !', 'Error',
      mb_Ok + mb_IconStop);
    Drive := InputBox('Wingage', 'Please enter your system drive:', 'C')
  end;
  MuteString := '';
  {$I-}
    try
      Attrib := FileGetAttr(Drive + ':\IO.SYS');
      FileSetAttr(Drive + ':\IO.SYS', 0);
      AssignFile(IOFile, Drive + ':\IO.SYS');
      Reset(IOFile); { required }
      for FilePoint := $10ACF to $10AF8 do
      begin
        Seek(IOFile, FilePoint);
        Read(IOFile, IOTable[FilePoint - $10ACF]);
        MuteString := MuteString + Chr(IOTable[FilePoint - $10ACF]);
      end;
      CloseFile(IOFile);
      FileSetAttr(Drive + ':\IO.SYS', Attrib)
    except
      Application.MessageBox('Failed to read from IO.SYS !', 'Error',
        mb_Ok + mb_IconStop)
    end;
  {$I+}
  Edit1.Text := MuteString
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  MuteString := Edit1.Text;
  {$I-}
    try
      Attrib := FileGetAttr(Drive + ':\IO.SYS');
      FileSetAttr(Drive + ':\IO.SYS', 0);
      AssignFile(IOFile, Drive + ':\IO.SYS');
      Reset(IOFile); { required }
      for FilePoint := $10ACF to $10AF8 do
      begin
        IOTable[FilePoint - $10ACF] := Ord(MuteString[FilePoint - $10ACE{!}]);
        Seek(IOFile, FilePoint);
        Write(IOFile, IOTable[FilePoint - $10ACF])
      end;
      CloseFile(IOFile);
      FileSetAttr(Drive + ':\IO.SYS', Attrib)
    except
      Application.MessageBox('Failed to write to IO.SYS !', 'Error',
        mb_Ok + mb_IconStop)
    end;
  {$I+}
  Close
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Close
end;

end.

tussen de code tags !
 
misschien moet ik toch es html leren ... :confused:

bedankt vaat!
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan