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; +} +//---------------------------------------------------------------------------