diff --git a/install/MAKEFILE b/install/MAKEFILE
new file mode 100644
index 0000000..3a8ee6a
--- /dev/null
+++ b/install/MAKEFILE
@@ -0,0 +1,20 @@
+asm= lzasm /z/t
+lnk= elink
+
+all: setup.com
+
+setup.com: setup.obj
+ $(lnk) setup.obj setup.com /c
+
+setup.obj:
+ $(asm) setup.asm
+
+clean:
+ del *.obj
+ del *.exe
+ del *.bak
+ del *.lib
+ del *.com
+ del *.bin
+ del *.sys
+ del *.err
\ No newline at end of file
diff --git a/install/setup.asm b/install/setup.asm
new file mode 100644
index 0000000..949cb11
--- /dev/null
+++ b/install/setup.asm
@@ -0,0 +1,164 @@
+model tiny,stdcall
+p486
+locals
+jumps
+codeseg
+option procalign:byte
+
+org 0100h
+
+ent equ 32h
+
+jmp copycos
+
+message db 0Dh,0Ah,'COS 2000 V1.3.1BetaFr programme d''installation',0Dh,0AH,'Inserez une disquette formatee et appuyez sur entre...',0Dh,0AH,'Attention le contenu de celle ci peut etre altere !!!',0Dh,0AH,'$'
+message2 db 0Dh,0AH,'Creation du secteur de demarrage...',0Dh,0Ah,'$'
+message3 db 0Dh,0AH,'Copie des fichiers systeme...',0Dh,0Ah,'$'
+errormsg db 0Dh,0AH,'Erreur d''installation, contactez moi a COS2000@MULTIMANIA.COM !',0Dh,0AH,'$'
+ok db 0Dh,0AH,'COS2000 a ete correctement installe, veuillez redemarrer votre PC',0Dh,0AH,'$'
+files db '*.*',0
+boot db 'boot.bin',0
+dat db 'data',0
+retu db 0Dh,0AH,'$'
+dta db 43 dup (0)
+
+copycos:
+ mov ah,9
+ mov dx,offset message
+ int 21h
+ xor ax,ax
+ int 16h
+ mov ah,4ah
+ mov bx,1000h
+ int 21h
+ jc error
+ mov ah,48h
+ mov bx,65536/16
+ int 21h
+ jc error
+ mov fs,ax
+ mov ah,3Bh
+ mov dx,offset dat
+ int 21h
+ jc error
+ mov ah,1Ah
+ mov dx,offset dta
+ int 21h
+ jc error
+ mov ah,4eh
+ xor cx,cx
+ mov dx,offset files
+ int 21h
+ jc error
+ mov ah,09
+ mov dx,offset message3
+ int 21h
+allfile:
+ mov [byte ptr offset dta+43],'$'
+ mov ah,9
+ mov dx,offset dta+30
+ int 21h
+ push dx
+ mov ah,09
+ mov dx,offset retu
+ int 21h
+ pop dx
+ mov ax,3D00h
+ int 21h
+ jc error
+ mov bx,ax
+ mov ax,4202h
+ xor cx,cx
+ xor dx,dx
+ int 21h
+ jc error
+ cmp dx,0
+ jne error
+ cmp ax,0
+ je error
+ mov bp,ax
+ mov ax,4200h
+ xor cx,cx
+ xor dx,dx
+ int 21h
+ jc error
+ push fs
+ pop ds
+ mov ah,3fh
+ mov cx,0FFFFh
+ xor dx,dx
+ int 21h
+ push cs
+ pop ds
+ jc error
+ mov ah,3eh
+ int 21h
+ jc error
+ mov ah,3ch
+ push cs
+ pop es
+ mov di,offset dta+30-3
+ mov [word ptr di],":a"
+ mov [byte ptr di+2],"\"
+ xor cx,cx
+ mov dx,di
+ int 21h
+ jc error
+ mov bx,ax
+ push fs
+ pop ds
+ xor dx,dx
+ mov ah,40h
+ mov cx,bp
+ int 21h
+ push cs
+ pop ds
+ jc error
+ mov ah,3eh
+ int 21h
+ jc error
+ mov ah,4fh
+ int 21h
+ jnc allfile
+ mov ah,09
+ mov dx,offset message2
+ int 21h
+ mov ax,3D00h
+ mov dx,offset boot
+ int 21h
+ jc error
+ push fs
+ pop ds
+ mov ah,3fh
+ mov cx,0FFFFh
+ xor dx,dx
+ int 21h
+ push cs
+ pop ds
+ jc error
+ mov ah,3eh
+ int 21h
+ jc error
+ push fs
+ pop es
+ mov ax,0301h
+ mov dx,0
+ mov cx,0001h
+ xor bx,bx
+ int 13h
+ mov ah,09
+ mov dx,offset ok
+ int 21h
+ xor ax,ax
+ int 16h
+ ret
+
+
+error:
+ mov ah,09
+ mov dx,offset errormsg
+ int 21h
+ xor ax,ax
+ int 16h
+ ret
+
diff --git a/install/setup.sh b/install/setup.sh
new file mode 100755
index 0000000..916c579
Binary files /dev/null and b/install/setup.sh differ
diff --git a/install/winNT gui/setup.bpr b/install/winNT gui/setup.bpr
new file mode 100644
index 0000000..035bc7b
--- /dev/null
+++ b/install/winNT gui/setup.bpr
@@ -0,0 +1,121 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1036
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[Debugging]
+DebugSourceDirs=$(BCB)\source\vcl
+
+[Parameters]
+RunParams=
+Launcher=
+UseLauncher=0
+DebugCWD=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteLauncher=
+RemoteCWD=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+
+[CORBA]
+AddServerUnit=1
+AddClientUnit=1
+PrecompiledHeaders=1
+
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+
+
\ No newline at end of file
diff --git a/install/winNT gui/setup.cpp b/install/winNT gui/setup.cpp
new file mode 100644
index 0000000..dec5b3e
--- /dev/null
+++ b/install/winNT gui/setup.cpp
@@ -0,0 +1,33 @@
+//---------------------------------------------------------------------------
+
+#include
+#pragma hdrstop
+//---------------------------------------------------------------------------
+USEFORM("Unit1.cpp", Form1);
+//---------------------------------------------------------------------------
+WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
+{
+ try
+ {
+ Application->Initialize();
+ Application->CreateForm(__classid(TForm1), &Form1);
+ Application->Run();
+ }
+ catch (Exception &exception)
+ {
+ Application->ShowException(&exception);
+ }
+ catch (...)
+ {
+ try
+ {
+ throw Exception("");
+ }
+ catch (Exception &exception)
+ {
+ Application->ShowException(&exception);
+ }
+ }
+ return 0;
+}
+//---------------------------------------------------------------------------
diff --git a/install/winNT gui/setup.res b/install/winNT gui/setup.res
new file mode 100644
index 0000000..53d1acc
Binary files /dev/null and b/install/winNT gui/setup.res differ
diff --git a/install/winNT gui/setup.tds b/install/winNT gui/setup.tds
new file mode 100644
index 0000000..d4db614
Binary files /dev/null and b/install/winNT gui/setup.tds differ
diff --git a/install/winNT gui/unit1.cpp b/install/winNT gui/unit1.cpp
new file mode 100644
index 0000000..2b3fc55
--- /dev/null
+++ b/install/winNT gui/unit1.cpp
@@ -0,0 +1,166 @@
+//---------------------------------------------------------------------------
+
+#include
+#include
+#include
+#include
+#include
+#pragma hdrstop
+
+#include "Unit1.h"
+//---------------------------------------------------------------------------
+#pragma package(smart_init)
+#pragma resource "*.dfm"
+TForm1 *Form1;
+HANDLE hDrive;
+DISK_GEOMETRY dg_flop_geom;
+AnsiString lecteur="b:";
+AnsiString device="\\\\.\\"+lecteur;
+//---------------------------------------------------------------------------
+__fastcall TForm1::TForm1(TComponent* Owner)
+ : TForm(Owner)
+{
+}
+//---------------------------------------------------------------------------
+char * GetLastErrorString(void)
+{
+ LPVOID lpMsgBuf;
+
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) &lpMsgBuf, 0, NULL);
+
+ return (char *)lpMsgBuf;
+}
+//---------------------------------------------------------------------------
+ShowMessages(AnsiString msg)
+{
+ Form1->Memo1->Lines->Add(msg);
+}
+//---------------------------------------------------------------------------
+void __fastcall TForm1::FormShow(TObject *Sender)
+{
+DWORD dwNotUsed;
+DWORD error=0;
+
+ hDrive = CreateFile(device.c_str(), GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL);
+ ShowMessages("Ouverture du peripherique "+lecteur);
+ if (hDrive == INVALID_HANDLE_VALUE) {
+ ShowMessages("Erreur : "+AnsiString(GetLastErrorString()));
+ error=1;
+ }
+ if(error!=1&&ShowMessages("Determination de la geometrie ")&&DeviceIoControl(hDrive, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL,0, &dg_flop_geom, sizeof(dg_flop_geom),&dwNotUsed, NULL) == FALSE) {
+ ShowMessages("Erreur : "+AnsiString(GetLastErrorString()));
+ error=1;
+ }
+ if(error!=1&&(dg_flop_geom.MediaType==FixedMedia||dg_flop_geom.MediaType==RemovableMedia||dg_flop_geom.MediaType==Unknown))
+ {
+ ShowMessages("Erreur : Ceci n'est pas une disquette !");
+ error=1;
+ }
+ if (error!=1&&ShowMessages("Positionnement sur le secteur 0")&&SetFilePointer(hDrive, 0, NULL, FILE_BEGIN) == -1) {
+ ShowMessages("Erreur : "+AnsiString(GetLastErrorString()));
+ error=1;
+ }
+ if (error!=1)
+ {
+ drive->Caption=lecteur.UpperCase();
+ track->Caption=IntToStr(dg_flop_geom.Cylinders.LowPart);
+ sector->Caption=IntToStr(dg_flop_geom.SectorsPerTrack);
+ size->Caption=IntToStr(dg_flop_geom.BytesPerSector);
+ head->Caption=IntToStr(dg_flop_geom.TracksPerCylinder);
+ allsize->Caption=IntToStr(dg_flop_geom.BytesPerSector*dg_flop_geom.Cylinders.LowPart*dg_flop_geom.SectorsPerTrack*dg_flop_geom.TracksPerCylinder);
+ allsector->Caption=IntToStr(dg_flop_geom.Cylinders.LowPart*dg_flop_geom.SectorsPerTrack*dg_flop_geom.TracksPerCylinder);
+ }
+ else
+ {
+ CloseHandle(hDrive);
+ }
+}
+//---------------------------------------------------------------------------
+void __fastcall TForm1::Button1Click(TObject *Sender)
+{
+ if (hDrive == NULL||dg_flop_geom.TracksPerCylinder>2||dg_flop_geom.TracksPerCylinder==0)
+
+ {
+ ShowMessages("Aucun support valide detecté !");
+ }
+ else
+ {
+ int fdboot;
+ DWORD error=0;
+ DWORD dwBsWritten;
+ char * buffer;
+ AnsiString bootfile="data/boot.bin";
+ ShowMessages("Allocation de mémoire ");
+ buffer = (char *)malloc(dg_flop_geom.BytesPerSector);
+ ShowMessages("Ouverture et installation du fichier de boot "+bootfile);
+ if ((fdboot = _rtl_open(bootfile.c_str(),O_RDONLY | O_BINARY)) == -1 )
+ {
+ ShowMessages("Erreur : Fichier de boot introuvable");
+ error=1;
+ }
+ if (error!=1&&_read(fdboot, buffer, dg_flop_geom.BytesPerSector)!= dg_flop_geom.BytesPerSector)
+ {
+ ShowMessages("Erreur : Fichier de boot de taille incorrecte !");
+ error=1;
+ }
+ if (error!=1&&WriteFile(hDrive, buffer, dg_flop_geom.BytesPerSector, &dwBsWritten, NULL) == 0)
+ {
+ ShowMessages("Ecriture impossible sur le secteur de boot !");
+ error=1;
+ }
+ _rtl_close(fdboot);
+ if (error!=1)
+ {
+ struct ffblk files;
+ int done;
+ int number=0;
+ ShowMessages("Détermination des fichiers a copier");
+ done = findfirst("data/*.*",&files,0);
+ while (!done)
+ {
+ number++;
+ done = findnext(&files);
+ }
+ install->Max=number;
+ install->Min=0;
+ install->Position=0;
+ ShowMessages("Copie des fichiers de cos2000");
+ done = findfirst("data/*.*",&files,0);
+ while (!done)
+ {
+ ShowMessages(AnsiString(files.ff_name).LowerCase());
+ if (!CopyFile((AnsiString("data/")+AnsiString(files.ff_name)).c_str(),(lecteur+"\\"+AnsiString(files.ff_name)).c_str(),false))
+ {
+ ShowMessages("Erreur : fichier impossible a copier"+AnsiString(GetLastErrorString()));
+ error=1;
+ break;
+ }
+ done = findnext(&files);
+ install->Position++;
+ }
+ if (!error)
+ {
+ ShowMessages("Installation terminée !");
+ Button2->Visible=false;
+ Button1->Visible=false;
+ Button3->Visible=true;
+ }
+ else
+ ShowMessages("Installation echoué !");
+ }
+ free(buffer);
+ }
+}
+//---------------------------------------------------------------------------
+void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
+{
+ CloseHandle(hDrive);
+}
+//---------------------------------------------------------------------------
+void __fastcall TForm1::Button3Click(TObject *Sender)
+{
+Close();
+}
+//---------------------------------------------------------------------------
diff --git a/install/winNT gui/unit1.ddp b/install/winNT gui/unit1.ddp
new file mode 100644
index 0000000..cdc0ee8
Binary files /dev/null and b/install/winNT gui/unit1.ddp differ
diff --git a/install/winNT gui/unit1.dfm b/install/winNT gui/unit1.dfm
new file mode 100644
index 0000000..b0445c3
--- /dev/null
+++ b/install/winNT gui/unit1.dfm
@@ -0,0 +1,184 @@
+object Form1: TForm1
+ Left = 418
+ Top = 273
+ Width = 599
+ Height = 371
+ Caption = 'Installation de COS2000'
+ Color = clBtnFace
+ Font.Charset = DEFAULT_CHARSET
+ Font.Color = clWindowText
+ Font.Height = -11
+ Font.Name = 'MS Sans Serif'
+ Font.Style = []
+ OldCreateOrder = False
+ Position = poScreenCenter
+ OnClose = FormClose
+ OnShow = FormShow
+ PixelsPerInch = 96
+ TextHeight = 13
+ object Button1: TButton
+ Left = 288
+ Top = 304
+ Width = 75
+ Height = 25
+ Caption = 'installer...'
+ TabOrder = 0
+ OnClick = Button1Click
+ end
+ object install: TProgressBar
+ Left = 16
+ Top = 264
+ Width = 553
+ Height = 25
+ Min = 0
+ Max = 100
+ TabOrder = 1
+ end
+ object Button2: TButton
+ Left = 208
+ Top = 304
+ Width = 75
+ Height = 25
+ Caption = 'support'
+ TabOrder = 2
+ OnClick = FormShow
+ end
+ object Memo1: TMemo
+ Left = 192
+ Top = 24
+ Width = 377
+ Height = 225
+ ReadOnly = True
+ TabOrder = 3
+ end
+ object GroupBox1: TGroupBox
+ Left = 16
+ Top = 120
+ Width = 161
+ Height = 129
+ Caption = 'G'#233'om'#233'trie'
+ Font.Charset = DEFAULT_CHARSET
+ Font.Color = clWindowText
+ Font.Height = -11
+ Font.Name = 'MS Sans Serif'
+ Font.Style = []
+ ParentFont = False
+ TabOrder = 4
+ object track: TLabel
+ Left = 96
+ Top = 60
+ Width = 31
+ Height = 13
+ Caption = 'Aucun'
+ end
+ object Label4: TLabel
+ Left = 24
+ Top = 60
+ Width = 34
+ Height = 13
+ Caption = 'Pistes :'
+ end
+ object Label5: TLabel
+ Left = 24
+ Top = 28
+ Width = 48
+ Height = 13
+ Caption = 'Secteurs :'
+ end
+ object sector: TLabel
+ Left = 96
+ Top = 28
+ Width = 31
+ Height = 13
+ Caption = 'Aucun'
+ end
+ object head: TLabel
+ Left = 96
+ Top = 44
+ Width = 31
+ Height = 13
+ Caption = 'Aucun'
+ end
+ object Label6: TLabel
+ Left = 24
+ Top = 44
+ Width = 33
+ Height = 13
+ Caption = 'Tetes :'
+ end
+ object Label8: TLabel
+ Left = 24
+ Top = 84
+ Width = 69
+ Height = 13
+ Caption = 'Taille secteur :'
+ end
+ object size: TLabel
+ Left = 96
+ Top = 84
+ Width = 31
+ Height = 13
+ Caption = 'Aucun'
+ end
+ end
+ object GroupBox2: TGroupBox
+ Left = 16
+ Top = 16
+ Width = 161
+ Height = 97
+ Caption = 'Support'
+ TabOrder = 5
+ object Label1: TLabel
+ Left = 24
+ Top = 24
+ Width = 42
+ Height = 13
+ Caption = 'Lecteur :'
+ end
+ object drive: TLabel
+ Left = 88
+ Top = 24
+ Width = 31
+ Height = 13
+ Caption = 'Aucun'
+ end
+ object Label2: TLabel
+ Left = 24
+ Top = 40
+ Width = 31
+ Height = 13
+ Caption = 'Taille :'
+ end
+ object allsize: TLabel
+ Left = 88
+ Top = 40
+ Width = 31
+ Height = 13
+ Caption = 'Aucun'
+ end
+ object Label3: TLabel
+ Left = 24
+ Top = 56
+ Width = 58
+ Height = 13
+ Caption = 'N'#176'secteurs :'
+ end
+ object allsector: TLabel
+ Left = 88
+ Top = 56
+ Width = 31
+ Height = 13
+ Caption = 'Aucun'
+ end
+ end
+ object Button3: TButton
+ Left = 248
+ Top = 304
+ Width = 75
+ Height = 25
+ Caption = 'Quitter'
+ TabOrder = 6
+ Visible = False
+ OnClick = Button3Click
+ end
+end
diff --git a/install/winNT gui/unit1.h b/install/winNT gui/unit1.h
new file mode 100644
index 0000000..6d0d3a7
--- /dev/null
+++ b/install/winNT gui/unit1.h
@@ -0,0 +1,47 @@
+//---------------------------------------------------------------------------
+
+#ifndef Unit1H
+#define Unit1H
+//---------------------------------------------------------------------------
+#include
+#include
+#include
+#include
+#include
+//---------------------------------------------------------------------------
+class TForm1 : public TForm
+{
+__published: // IDE-managed Components
+ TButton *Button1;
+ TProgressBar *install;
+ TButton *Button2;
+ TMemo *Memo1;
+ TGroupBox *GroupBox1;
+ TLabel *track;
+ TLabel *Label4;
+ TLabel *Label5;
+ TLabel *sector;
+ TLabel *head;
+ TLabel *Label6;
+ TLabel *Label8;
+ TLabel *size;
+ TGroupBox *GroupBox2;
+ TLabel *Label1;
+ TLabel *drive;
+ TLabel *Label2;
+ TLabel *allsize;
+ TLabel *Label3;
+ TLabel *allsector;
+ TButton *Button3;
+ void __fastcall FormShow(TObject *Sender);
+ void __fastcall Button1Click(TObject *Sender);
+ void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
+ void __fastcall Button3Click(TObject *Sender);
+private: // User declarations
+public: // User declarations
+ __fastcall TForm1(TComponent* Owner);
+};
+//---------------------------------------------------------------------------
+extern PACKAGE TForm1 *Form1;
+//---------------------------------------------------------------------------
+#endif
diff --git a/install/winNT/setup.bpf b/install/winNT/setup.bpf
new file mode 100644
index 0000000..6967230
--- /dev/null
+++ b/install/winNT/setup.bpf
@@ -0,0 +1,4 @@
+This file is used by the project manager only and should be treated like the project file
+
+
+main
\ No newline at end of file
diff --git a/install/winNT/setup.bpr b/install/winNT/setup.bpr
new file mode 100644
index 0000000..b67fc36
--- /dev/null
+++ b/install/winNT/setup.bpr
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1036
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[Debugging]
+DebugSourceDirs=$(BCB)\source\vcl
+
+[Parameters]
+RunParams=
+Launcher=
+UseLauncher=0
+DebugCWD=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteLauncher=
+RemoteCWD=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+
+[CORBA]
+AddServerUnit=1
+AddClientUnit=1
+PrecompiledHeaders=1
+
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+
+
\ No newline at end of file
diff --git a/install/winNT/setup.res b/install/winNT/setup.res
new file mode 100644
index 0000000..53d1acc
Binary files /dev/null and b/install/winNT/setup.res differ
diff --git a/install/winNT/setup.tds b/install/winNT/setup.tds
new file mode 100644
index 0000000..5ae5c8e
Binary files /dev/null and b/install/winNT/setup.tds differ
diff --git a/install/winNT/unit1.cpp b/install/winNT/unit1.cpp
new file mode 100644
index 0000000..8448703
--- /dev/null
+++ b/install/winNT/unit1.cpp
@@ -0,0 +1,135 @@
+//---------------------------------------------------------------------------
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#pragma hdrstop
+
+//---------------------------------------------------------------------------
+char * GetLastErrorString(void)
+{
+ LPVOID lpMsgBuf;
+
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) &lpMsgBuf, 0, NULL);
+
+ return (char *)lpMsgBuf;
+}
+
+
+#pragma argsused
+int main(int argc, char* argv[])
+{
+DWORD dwNotUsed;
+DWORD error=0;
+HANDLE hDrive;
+DISK_GEOMETRY dg_flop_geom;
+char lecteur[4]="a:\0";
+char device[7]="\\\\.\\a:\0";
+int fdboot;
+DWORD dwBsWritten;
+char * buffer;
+char bootfile[14]="data/boot.bin\0";
+struct ffblk files;
+int done;
+int number=0;
+char src[80];
+char dest[80];
+ printf("Installation de COS2000\nInserez une disquette et appuyer sur une touche...\n");
+ getchar();
+ hDrive = CreateFile(device, GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL);
+ printf("Ouverture du peripherique %s\n",lecteur);
+ if (hDrive == INVALID_HANDLE_VALUE) {
+ printf("Erreur : %s\n",GetLastErrorString());
+ error=1;
+ }
+ if(error!=1&&printf("Determination de la geometrie \n")&&DeviceIoControl(hDrive, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL,0, &dg_flop_geom, sizeof(dg_flop_geom),&dwNotUsed, NULL) == FALSE) {
+ printf("Erreur : %s\n",GetLastErrorString());
+ error=1;
+ }
+ if(error!=1&&(dg_flop_geom.MediaType==FixedMedia||dg_flop_geom.MediaType==RemovableMedia||dg_flop_geom.MediaType==Unknown))
+ {
+ printf("Erreur : Ceci n'est pas une disquette !\n");
+ error=1;
+ }
+ if (error!=1&&printf("Positionnement sur le secteur 0\n")&&SetFilePointer(hDrive, 0, NULL, FILE_BEGIN) == -1) {
+ printf("Erreur : %s\n",GetLastErrorString());
+ error=1;
+ }
+ if (error!=1)
+ {
+ printf("Pistes :%u Secteurs:%u Tetes:%u Taille:%u\n",dg_flop_geom.Cylinders.LowPart,dg_flop_geom.SectorsPerTrack,dg_flop_geom.TracksPerCylinder,dg_flop_geom.BytesPerSector);
+ }
+ else
+ {
+ CloseHandle(hDrive);
+ }
+ if (hDrive == NULL||dg_flop_geom.TracksPerCylinder>2||dg_flop_geom.TracksPerCylinder==0)
+ {
+ printf("Aucun support valide detecte !");
+ error=1;
+ }
+ if (error!=1)
+ {
+ printf("Allocation de memoire\n");
+ buffer = (char *)malloc(dg_flop_geom.BytesPerSector);
+ printf("Ouverture et installation du fichier de boot %s\n",bootfile);
+ }
+ if (error!=1&&(fdboot = _rtl_open(bootfile,O_RDONLY | O_BINARY)) == -1 )
+ {
+ printf("Erreur : Fichier de boot introuvable\n");
+ error=1;
+ }
+ if (error!=1&&_read(fdboot, buffer, dg_flop_geom.BytesPerSector)!= dg_flop_geom.BytesPerSector)
+ {
+ printf("Erreur : Fichier de boot de taille incorrecte !\n");
+ error=1;
+ }
+ if (error!=1&&WriteFile(hDrive, buffer, dg_flop_geom.BytesPerSector, &dwBsWritten, NULL) == 0)
+ {
+ printf("Ecriture impossible sur le secteur de boot !\n");
+ error=1;
+ }
+ if (error!=1)
+ {
+ _rtl_close(fdboot);
+ printf("Determination des fichiers a copier\n\n");
+ done = findfirst("data\\*.*",&files,0);
+ while (!done)
+ {
+ number++;
+ done = findnext(&files);
+ }
+ printf("Copie des fichiers de cos2000\n");
+ done = findfirst("data\\*.*",&files,0);
+ while (!done)
+ {
+ printf("%s\n",files.ff_name);
+ sprintf(src, "data\\%s",files.ff_name);
+ sprintf(dest, "%s\\%s",lecteur,files.ff_name);
+ if (!CopyFile(src,dest,false))
+ {
+ printf("Erreur : fichier impossible a copier %s\n",GetLastErrorString());
+ error=1;
+ break;
+ }
+ done = findnext(&files);
+ }
+ if (!error)
+ {
+ printf("Installation terminee !\nVeuillez redemarrer votre PC afin de charger le systeme");
+ }
+ else
+ {
+ printf("Installation echoué !");
+ }
+ free(buffer);
+ }
+ getchar();
+ return 0;
+}
+//---------------------------------------------------------------------------