Posted by Raymond de R. on May 23, 19101 at 03:15:59:
Hi there!
Ive got a big problem here. Some student wrote a program in TP 7.0 and it used to run fine under Windows 95/98, but now most of the machines are running Win2K. what the program does:
It scans the LOCAL drives for (illegal) software and stores this in a file. This file (and also the program) is located in a dir. called Software. This dir. is located on a Novell Server.
When a machine is scanned for the first time, it stores all the executables in a file and sorts them. A copy of this file is made and is stored in a sub dir. called programs (in the dir software). When a user reboots the system and logs on, on the same day the program notice that the date of the file is the same as the current date, so it will not preform the scan again.
The next (or any other) day the program scans again. if the file in the Software dir. is the same size as the older file in the Programs dir. it will not copy the newer file, because there's a big chance that the contence will be the same. but now for my problem.
This is the THEORY behind the program but it doesn't work anymore.
- when executed locally: OK
- when executed on the server: WRONG!!! runtime
error 005
- when executed on the server IN TP 7.0 : OK (strange)
the first time it scanns everything goes OK, but when a new scan is preformed on another day, it can not rewrite the file in the software map.
here a piece of the code:
{***************************************************************************}
{* Process Logical Drives of Current Station *}
{***************************************************************************}
procedure ProcesDisk(Station: string);
var
FileToOpen : Text;
DirCnt : byte;
Drive : Char;
Newfile,Oldfile : file;
begin
{*** Read All EXE, COM and OVL From Logical Drives ***}
WriteLn;
WriteLn('Station: ',Station);
WriteLn;
Assign(FileToOpen,Station+'.pl');
Rewrite(FileToOpen);{ <<===== here's where things go wrong: runtime error 005 }
Writeln(FileToOpen,' '+GetEnv('logfn'));
for Drive := 'C' to 'E' do
If localdisk(Drive) then ScanDisk(Drive+':\', FileToOpen);
Close(FileToOpen);
{*** Sort On file First then Directory Name ***}
Write(' ':79,#13);
Write('Sorting the files.');
{*** Use Dos Command Sort ***}
Exec(GetEnv('COMSPEC'),'/C sort <'+Station+'.pl > '+Station+'.srt');
Write('.'#13);
{*** Use Dos Command Sort ***}
Exec(GetEnv('COMSPEC'),'/C copy '+Station+'.srt '+Station+'.pl >nul');
Assign(FileToOpen,Station+'.srt');
Erase(FileToOpen);
Assign(Newfile,Station+'.pl');
Reset(Newfile);
{*** Determine if The Machine'S Software Has Changed Since Last Scan ***}
Ookverwijderen:=False;
if not Newmachine then
{*** if Machine Wasn'T Scanned Before ***}
begin
Assign(Oldfile,'programs\'+Station+'.pl');
Reset(Oldfile);
if Filesize(Newfile)=Filesize(Oldfile) then
{*** if Old Size of All Sorted Files Is The Same with Last Scanned
file, then There Are Probably No Changes in The Computer'S
Software. ***}
Ookverwijderen:=True;
Close(Oldfile);
Erase(Oldfile);
end;
Close(Newfile);
{*** Update Datebase in Directory Programms ***}
Exec(GetEnv('comspec'),'/c copy '+Station+'.pl programs\'+Station+'.pl > nul');
if Ookverwijderen and not(Vlaggetje) then
Erase(Newfile);
Write(' ':79,#13);
WriteLn('Done.')
end;
please help me out...
Raymond