feat: logiciel d'installation pour Windows NT/2000/XP
This commit is contained in:
parent
b6c921d0a8
commit
6813e58212
|
@ -0,0 +1,4 @@
|
|||
This file is used by the project manager only and should be treated like the project file
|
||||
|
||||
|
||||
main
|
|
@ -0,0 +1,120 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!-- C++Builder XML Project -->
|
||||
<PROJECT>
|
||||
<MACROS>
|
||||
<VERSION value="BCB.06.00"/>
|
||||
<PROJECT value="setup.exe"/>
|
||||
<OBJFILES value="Unit1.obj"/>
|
||||
<RESFILES value="Setup.res"/>
|
||||
<IDLFILES value=""/>
|
||||
<IDLGENFILES value=""/>
|
||||
<DEFFILE value=""/>
|
||||
<RESDEPEN value="$(RESFILES)"/>
|
||||
<LIBFILES value=""/>
|
||||
<LIBRARIES value=""/>
|
||||
<SPARELIBS value=""/>
|
||||
<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="NO_STRICT;_NO_VCL;_RTLDLL"/>
|
||||
<MAINSOURCE value="Setup.bpf"/>
|
||||
<INCLUDEPATH value=""..\Nouveau dossier (2)";$(BCB)\include;$(BCB)\include\vcl"/>
|
||||
<LIBPATH value=""..\Nouveau dossier (2)";$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib"/>
|
||||
<WARNINGS value="-w-par"/>
|
||||
<OTHERFILES value=""/>
|
||||
</MACROS>
|
||||
<OPTIONS>
|
||||
<IDLCFLAGS value="-I"..\Nouveau dossier (2)" -I$(BCB)\include -I$(BCB)\include\vcl
|
||||
-src_suffix cpp -boa"/>
|
||||
<CFLAG1 value="-O2 -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -a8 -b- -k- -vi -tWC -tWM- -c"/>
|
||||
<PFLAGS value="-$Y- -$L- -$D- -$A8 -v -JPHNE -M"/>
|
||||
<RFLAGS value=""/>
|
||||
<AFLAGS value="/mx /w2 /zn"/>
|
||||
<LFLAGS value="-D"" -ap -Tpe -x -Gn"/>
|
||||
<OTHERFILES value=""/>
|
||||
</OPTIONS>
|
||||
<LINKER>
|
||||
<ALLOBJ value="c0x32.obj $(OBJFILES)"/>
|
||||
<ALLRES value="$(RESFILES)"/>
|
||||
<ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32i.lib"/>
|
||||
<OTHERFILES value=""/>
|
||||
</LINKER>
|
||||
<FILELIST>
|
||||
<FILE FILENAME="Setup.res" FORMNAME="" UNITNAME="Setup.res" CONTAINERID="ResTool" DESIGNCLASS="" LOCALCOMMAND=""/>
|
||||
<FILE FILENAME="Setup.bpf" FORMNAME="" UNITNAME="Setup" CONTAINERID="BPF" DESIGNCLASS="" LOCALCOMMAND=""/>
|
||||
<FILE FILENAME="Unit1.cpp" FORMNAME="" 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>
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,135 @@
|
|||
//---------------------------------------------------------------------------
|
||||
#include <windows.h>
|
||||
#include <winbase.h>
|
||||
#include <winioctl.h>
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <dir.h>
|
||||
#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;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
Loading…
Reference in New Issue