feat: passage au format CE, offset a 0 Modification du format executable par defaut

BREAKING CHANGE: attention modification majeure du code
This commit is contained in:
Nicolas Hordé 2004-11-19 17:12:30 +00:00
parent beae20414c
commit d23d5db024
9 changed files with 554 additions and 4 deletions

View File

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

121
install/winNT gui/setup.bpr Normal file
View File

@ -0,0 +1,121 @@
<?xml version='1.0' encoding='utf-8' ?>
<!-- C++Builder XML Project -->
<PROJECT>
<MACROS>
<VERSION value="BCB.06.00"/>
<PROJECT value="setup.exe"/>
<OBJFILES value="setup.obj Unit1.obj"/>
<RESFILES value="setup.res"/>
<IDLFILES value=""/>
<IDLGENFILES value=""/>
<DEFFILE value=""/>
<RESDEPEN value="$(RESFILES) Unit1.dfm"/>
<LIBFILES value=""/>
<LIBRARIES value="rtl.lib vcl.lib"/>
<SPARELIBS value="vcl.lib rtl.lib"/>
<PACKAGES value="vcl.bpi rtl.bpi dbrtl.bpi adortl.bpi vcldb.bpi vclx.bpi bdertl.bpi
vcldbx.bpi ibxpress.bpi dsnap.bpi cds.bpi bdecds.bpi qrpt.bpi teeui.bpi
teedb.bpi tee.bpi dss.bpi teeqr.bpi visualclx.bpi visualdbclx.bpi
dsnapcrba.bpi dsnapcon.bpi bcbsmp.bpi vclie.bpi xmlrtl.bpi inet.bpi
inetdbbde.bpi inetdbxpress.bpi inetdb.bpi nmfast.bpi webdsnap.bpi
bcbie.bpi websnap.bpi soaprtl.bpi dclocx.bpi dbexpress.bpi dbxcds.bpi
indy.bpi bcb2kaxserver.bpi pop.bpi IcsBcb50.bpi bcbshlctrls.bpi"/>
<PATHCPP value=".;"/>
<PATHPAS value=".;"/>
<PATHRC value=".;"/>
<PATHASM value=".;"/>
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
<RELEASELIBPATH value="$(BCB)\lib\release"/>
<LINKER value="ilink32"/>
<USERDEFINES value=""/>
<SYSDEFINES value="_RTLDLL;NO_STRICT"/>
<MAINSOURCE value="setup.cpp"/>
<INCLUDEPATH value="E:\CBuilder6\Projects;&quot;C:\Documents and Settings\niko\Bureau\Nouveau dossier&quot;;$(BCB)\include;$(BCB)\include\vcl"/>
<LIBPATH value="E:\CBuilder6\Projects;&quot;C:\Documents and Settings\niko\Bureau\Nouveau dossier&quot;;$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib"/>
<WARNINGS value="-w-par"/>
<OTHERFILES value=""/>
</MACROS>
<OPTIONS>
<IDLCFLAGS value="-IE:\CBuilder6\Projects
-I&quot;C:\Documents and Settings\niko\Bureau\Nouveau dossier&quot; -I$(BCB)\include
-I$(BCB)\include\vcl -src_suffix cpp -boa"/>
<CFLAG1 value="-O2 -H=$(BCB)\lib\vcl60.csm -Hc -w- -Vx -Ve -X- -a8 -b- -k- -vi -c -tW -tWM"/>
<PFLAGS value="-$Y- -$L- -$D- -$A8 -v -JPHNE -M"/>
<RFLAGS value=""/>
<AFLAGS value="/mx /w2 /zn"/>
<LFLAGS value="-D&quot;&quot; -aa -Tpe -x -Gn"/>
<OTHERFILES value=""/>
</OPTIONS>
<LINKER>
<ALLOBJ value="c0w32.obj Memmgr.Lib sysinit.obj $(OBJFILES)"/>
<ALLRES value="$(RESFILES)"/>
<ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cp32mti.lib"/>
<OTHERFILES value=""/>
</LINKER>
<FILELIST>
<FILE FILENAME="setup.res" FORMNAME="" UNITNAME="setup.res" CONTAINERID="ResTool" DESIGNCLASS="" LOCALCOMMAND=""/>
<FILE FILENAME="setup.cpp" FORMNAME="" UNITNAME="setup" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
<FILE FILENAME="Unit1.cpp" FORMNAME="Form1" UNITNAME="Unit1" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
</FILELIST>
<BUILDTOOLS>
</BUILDTOOLS>
<IDEOPTIONS>
[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=
</IDEOPTIONS>
</PROJECT>

View File

@ -0,0 +1,33 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#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;
}
//---------------------------------------------------------------------------

BIN
install/winNT gui/setup.res Normal file

Binary file not shown.

BIN
install/winNT gui/setup.tds Normal file

Binary file not shown.

166
install/winNT gui/unit1.cpp Normal file
View File

@ -0,0 +1,166 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#include <winioctl.h>
#include <io.h>
#include <fcntl.h>
#include <dir.h>
#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();
}
//---------------------------------------------------------------------------

BIN
install/winNT gui/unit1.ddp Normal file

Binary file not shown.

184
install/winNT gui/unit1.dfm Normal file
View File

@ -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

47
install/winNT gui/unit1.h Normal file
View File

@ -0,0 +1,47 @@
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
//---------------------------------------------------------------------------
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