diff --git a/commande/commande.asm b/commande/commande.asm index f0dfdc3..1383691 100644 --- a/commande/commande.asm +++ b/commande/commande.asm @@ -3,7 +3,7 @@ smart .code -org 0100h +org 0h include ..\include\fat.h include ..\include\mem.h @@ -21,7 +21,6 @@ start: mov ah,21 mov cl,7 int 47h - mov ah,3 int 48h mov ax,0002 @@ -397,7 +396,7 @@ int 47h ret errorrefreshing db 'Impossible de lire le support',0 -extcom db '.COM',0 +extcom db '.CE ',0 Code_Mem: mov si,offset msgs @@ -622,7 +621,7 @@ Help_Mem db 0 derror db 'Erreur de Syntaxe !',0 Error_Syntax db 'La commande ou l''executable n''existe pas ! F1 pour ',0 prompt db '>',0 -msg db 'Interpreteur de commande COS V1.8',0 +msg db 'Interpreteur de commande COS V1.9',0 include str0.asm 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