home *** CD-ROM | disk | FTP | other *** search
- News on the TSPAS package by Timo Salmi in reverse order
- ========================================================
-
- University of Vaasa, Finland, MIPS R2030 workstation garbo.uwasa.fi
- has a large collection of PD and shareware PC programs available by
- anonymous ftp and mail server. The file /pc/ts/0news-ts contains
- news about the TS-programs in the /pc/ts directory (in reverse
- order). This text, which you now have, is an extract from the
- 0news-ts file and the UseNet news.
- ...................................................................
- Prof. Timo Salmi
- Moderating at garbo.uwasa.fi anonymous ftp archives 128.214.87.1
- School of Business Studies, University of Vaasa, SF-65101, Finland
- Internet: ts@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfun
- ...................................................................
-
- ┌────────────────────────────────────────────────────────────────┐
- │ Appeal: Let me take up a request for those of you who may have │
- │ found my programs or units useful. As I am not asking for a │
- │ registration fee for the PD versions, would you do me a │
- │ reciprocal favor by uploading at least some of my packages to, │
- │ say eg one local bulletin board (BBS), and thus contribute to │
- │ disseminating the *latest* versions of these packages. And, │
- │ if you distribute these packages, would you PLEASE distribute │
- │ an entire package, not individual programs from within any │
- │ package. This is a request that all of us share who write PD │
- │ programs. │
- └────────────────────────────────────────────────────────────────┘
-
- Sun 27-Oct-91: I have updated my Turbo Pascal units collection to be
- garbo.uwasa.fi:/pc/ts/tspa2440.arc
- garbo.uwasa.fi:/pc/ts/tspa2450.arc
- garbo.uwasa.fi:/pc/ts/tspa2455.arc
- garbo.uwasa.fi:/pc/ts/tspa2460.arc
- by adding the following routines
- ISANSIFN Has ansi.sys a a similar driver been loaded
- BTEWRDFN Combine two bytes into a single word, inverse of Hi & Lo
- WRDLNGFN Combine two words into a longint
- HIWORDFN The high-order (hi) word of the longint argument
- LOWORDFN The low-order (lo) word of the longint argument
-
- Sun 21-Jul-91: I have updated my Turbo Pascal units collection to be
- /pc/ts/tspa24##.arc (where ## = 40, 50, 55, and 60).
- Turbo Pascal 5.0 (and later) introduced some routines which are
- not present in version 4.0. My Turbo Pascal units collection (the
- 4.0 version) includes a TSTPU45 unit which introduces some of the
- missing routines also to TP 4.0. I have added FExpand (Expand a file
- name into a fully qualified file name) to this unit.
- Occasionally you will want to be able to tell where the standard
- input to your program comes from. Does it come in the normal way
- from the keyboard, or does it come from redirection. Likewise, you
- may wish your program to know whether its standard output goes to
- the screen, or is it redirected to a file or through a pipe. The
- new boolean functions in the TSUNTH.TPU unit will give this
- information:
- PIPEDIFN Is the standard input from redirection
- PIPEDOFN Is the standard output redirected
- PIPEDNFN Is the standard output redirected to nul
- Other new routines in the TSUNTH unit include:
- BOOTDRFN Get boot device name (MsDos 4.0+)
- DATEFMFN Country-dependent date format (MsDos 3.0+)
- NRCYLFN Number of cylinders on a drive if media present (MsDos 3.2+)
- TIMEFMFN Country-dependent time format (MsDos 3.0+)
- Z2ASZFN Convert an Asciiz string into an ordinary ascii string
-
- Tue 8-Jan-91: My Turbo Pascal units collection is now available also
- for Turbo Pascal 6.0. It is /pc/ts/tspa2360.arc, and is in no other
- way different from tspa2340.arc, tspa2350.arc, and tspa2355.arc
- except that the units are for 6.0. As you know, Turbo Pascal units
- are not compatible across versions.
-
- Sat 5-Jan-91: I have upgraded my Turbo Pascal units collection at
- uwasa.fi archives by making several changes. Most importantly I have
- divided the package into three parallel packages:
- tspa2340.arc for Turbo Pascal 4.0 version
- tspa2350.arc for Turbo Pascal 5.0 version
- tspa2355.arc for Turbo Pascal 5.5 version
- Thus you'll only need the package concurring with the Turbo Pascal
- version you use yourself. With the exception of the differences
- inherent to the different releases of Turbo Pascal, the packages are
- the same.
- I am expecting Turbo Pascal 6.0, but it has not arrived yet.
- I have added a new unit TSERR.TPU which turn on the verbal
- run-time error messages. It is very easy to use. Just include
- uses TSERR;
- at the beginning of your main program and you'll have verbal
- run-time error messages besides the original, cryptic error codes.
- I have done some cleaning of the old units by omitting some of
- the older routines which have a more efficient later replacement. In
- particular this concerns the functions for converting values from
- one base to another.
- There are also new routines:
- PARSENFN Number of substrings in a string (resembles ParamCount)
- PARSERFN Get substrings from a string (resembles ParamStr)
- FATSFN Get number of file allocation tables, not XTs
- INTERLFN Get interleave coefficient of a harddisk, not XTs
- LASTDRFN Get last drive of the system, softcoded, not XTs
- and the generic power function POWERGFN has been rewritten.
-
- Wed 8-Aug-90: I have updated my Turbo Pascal (4.0, 5.0, 5.5) units
- collection to be version (/pc/ts/)tspas22.arc.
- There are several functions which Tubro Pascal 5.0 and 5.5 have,
- but TP 4.0 does not. I have added a new unit tsunt45.tpu which
- includes some of these functions such as EnvCount, EnvStr, GetEnv,
- and ParamStr0 (giving the name of the program).
- The unit tsunti.tpu can be used to put information into the .exe
- file and perform selftests of the .exe. This unit is now also
- available for TP 4.0.
- Turbo Pascal ReadKey lacks the ability to read special keys such
- as RightShift, LeftShift, RightCtrl, and so on. Functions to detect
- pressing these keys have been added.
- Turbo Pascal ReadKey also lacks the ability to cope with the full
- enhanced keyboard potential. This means that TP ReadKey does not
- detect pressing F11 or F12, and that it cannot distinguish between
- the numeric keyboard cursor keys and the grey cursor keys. I have
- added a RDENKEFN function which has these abilities.
-
- Wed 1-Aug-90: I have updated my Turbo Pascal (4.0, 5.0, 5.5) units
- collection to be version (/pc/ts/)tspas21.arc.
- Turbo Pascal version 4.0 does not have the DosVersion function
- available in versions 5.0 and 5.5. I have written this function for
- version 4.0. Furthermore the lack of this function caused errors in
- TP 4.0 versions of my last two units. This has been put right.
- I have included a new unit (tsunti.tpu) for putting information
- into the .exe file, and retrieving the information (not for TP 4.0).
- The routines include a method for calculating the direct checksum
- for a file (eg for virus checking). This is not as trivial as it may
- sound at first sight, because in calculating the checksum, the
- checksum constant within the program must be skipped. (Else a change
- in the checksum constant would alter the checksum resulting in a
- "vicous circle"). Also, the method must be fast enough.
- I have also included a fast a date and filesize checking method
- for detecting if the .exe has been pacthed or its size altered. (Of
- course, the checksum method is much more difficult to defeat, but it
- is more complicated and not as fast). Here I have made an exception
- and included the source code. It is in the selftest.pas file within
- tspas21.arc.
-
- Mon 23-Jul-90: I have updated my Turbo Pascal (4.0, 5.0, 5.5) units
- collection to be version (/pc/ts/)tspas20.arc.
- One problem area that has intrigued me for some time is finding a
- technique for storing information within an executable file and
- updating that information. I've looked into it and written a couple
- of relevant procedures. USECOUNT keeps track of how many times the
- program has been run and stores the result within the .exe file.
- BRANDEXE is a more general, but also a more complicated procedure
- for .exe file handling. As an example I have a demonstration how to
- tell the previous time when the program was run.
- The function checking the on-line status of the printer
- (prnonlfn) has been rewritten to work without Turbo Pascal's Crt
- unit. And an alternative printer on-line status function, LTPONLFN,
- has been added. This one should be more robust, because it actually
- tries to send a carriage return to the printer, and observes the
- resultant success of the operation to define the on-line status. Of
- course this is achieved by {$I-} {$I+} IOResult testing, but the
- real trick here is make to system respond immediately rather than in
- the default response time of up to one minute. A new procedure
- PRTSCR sends the current screen to the printer. The new routines
- GETPRTFN and SETPRT get and set respectively the number of printer
- default retry times before a timeout.
- TICKSFN is a simple complement to the TIMERFN already in the
- collection. TICKSFN gives the number of clock ticks (there are 18.2
- per second) since midnight.
- A new LASTDMFN returns the number of days in a given month and
- year. DATEOKFN tells whether a date is a valid, existing date.
- ZELLERFN lets you compare which of the two dates is earlier,
- calculate the number of days between two dates etc.
- A new FIXEDFN returns whether a drive is a fixed disk or not.
- MATHCOFN returns if a math coprocessor is present. RS232FN returns
- the number of serial ports. PARPORFN returns the number of parallel
- ports. COUNTRFN returns the country code. CHIPFN returns the type of
- the processor chip.
- There are new keyboard routines. SCRLONFN gets the current
- ScrollLock status. CAPS, NUMLOCK, and SCRLOCK respectively set the
- CapsLock, NumLock and ScrollLock on, or off. They take the desired
- status as a boolean argument.
- CLS sets 25*80 text mode and clears the screen and CLS40 does
- likewise for 25*40. Crt is not required.
- So far none of the routines in the TSPAS collection have included
- any inline code. Starting from tspas20.arc this no longer holds. I
- have tried to understand some assembler and have included also
- inline code. Be warned that I cannot give any guarantees that the
- inline coded routines won't cause confusion. Where inline code has
- been used, I have stated so. The first function to utilize this is
- LOWCASFN which is the exact opposite of Turbo Pascal's own UpCase
- function.
- WARMBOOT simulating alt-clr-del, and COLDBOOT reboot with memory
- tests are new, inline routines.
- A couple of routines have been moved from one unit to another.
-
- Newsgroups: comp.lang.pascal
- From: ts@chyde.uwasa.fi (Timo Salmi)
- Subject: Redirecting writes to the printer
- Organization: University of Vaasa
- Date: Sun, 22 Jul 90 03:58:00 GMT
- (*
- About half a year ago several posters wanted to find a way to direct
- all output to the printer. (To enable a documentation of students'
- programming tasks.) For some reason nobody of us then found a simple
- working solution, which is outrageously elementary, after fact.
- There are, of course, alternative solutions, the most complicated
- being writing a new device driver. An intermediate (easier) solution
- is to juggle with certain TP predefined constants. I have two
- procedures USECON and USEPRN (in /pc/ts/tspas19.arc tpu collection)
- which when placed anywhere within the program will change the output
- device. But below is an example the the easiest alternative needing
- no accessories.
- *)
- program HowToRedirectAllOutputEasilyToThePrinter;
- {$DEFINE printit}
- begin
- {$IFDEF printit}
- assign (output, 'prn');
- rewrite (output);
- {$ENDIF}
- :
- writeln ('From Timo Salmi: Hello world, and whatever else');
- :
- {$IFDEF printit}
- close (output);
- {$ENDIF}
- end. (* thus endeth the escapade *)
-
- Thu 14-Jun-90: I have updated my Turbo Pascal (4.0, 5.0, 5.5) units
- collection to be version (/pc/ts/)tspas19.arc. The function INDRIVFN
- in tsuntg.tpu tests whether a device is present in a drive. If you
- defined an invalid drive (such as '1'), a run time error occurred in
- my earlier versions. - Tsunta.tpu has a new function HIGHTFN, which
- gives the height of the screen by resolution (25, 43 or 50). -
- Tsuntf.tpu has a third enhanced readln with line editing, recall,
- insert toggle, and clean break potential. - Tsunth.tpu includes a
- new function ISDIRFNto test whether a name is a directory. -
- COPYFILE procedure copies a file from within a Turbo Pascal program
- and returns a success status code. I have seen postings in the
- (InterNet) news about problems with copying files in Turbo Pascal,
- but I hope that this one should do the trick. - OPENEDFN function
- indicates whether a text file has already been closed within the
- program, or if it is still open. This is particularly convenient for
- procedures aborting your program. - Tsuntd includes a new procedure
- called AUDIO. It is an enhanced version of Turbo Pascal's own sound
- procedure. It takes frequency and duration as parameters, and it
- does not need the presence of the interfering Crt unit. Audio was
- written in collaboration with Ari Hovila (ajh@chyde.uwasa.fi). - And
- since I am often asked the question, sorry, no, dear fellow users,
- the sources are not available, only the units and their documented
- interfaces.
-
- Sun 25-Feb-90: I have gotten repeated requests from the users for a
- Turbo Pascal 5.5 version of my Turbo Pascal units collection. I now
- have finally got the 5.5 compiler, courtesy of University of Vaasa,
- because it was felt here that this international interaction is
- important enough to warrant the expense. (As I have told many of the
- users who have contacted me in this matter, I am not yet interested
- in OOP myself). Hence I am in a position to oblige. The new version
- is called tspas18.arc. There is only one new function in the
- collection this time. The main point was providing the TP 5.5
- versions of the units. Thus there are now three versions of each
- unit in this new release: TP 4.0, 5.5, and 5.5. - It is true that
- Borland has made excellent products for the PC community, but the
- incompatibility between the TPUs of the different Turbo Pascal
- versions has many of us users disgruntled.
-
- Wed 6-Dec-89: Updated the Turbo Pascal 5.0 (and 4.0) units
- collection to be version /pc/ts/tspas17. The new procedures include
- WHEREXFN and WHEREYFN which locate the cursor position without the
- Crt unit. As you will recall Crt unit includes a WhereX and a WhereY
- function. The reason I have prepared alternatives to Crt functions
- and procedures in this, and the earlier releases, is because with
- some incompatible PCs the Crt unit causes problems, and redirection
- requires special measures with the Crt. - KEYPREFN is a replacement
- of KeyPressed and READKEFN for ReadKey. - CLUSIZFN gives the cluster
- size on a device. ALLSIZFN gives the true total size allocated to a
- file instead of the size shown on ordinary directory listings. -
- INKEYFN is a Basic-like timed input.
-
- Tue 28-Nov-89: Some time ago there was a lively discussion in the
- InterNet news group comp.lang.pascal how to redirect all write and
- writeln statements to the printer without having to change the
- statements. I now have a solution to that problem for Turbo Pascal
- 4.0 and 5.0. The procedures USEPRN and USECON are part of update
- /pc/ts/tspas16.arc of my Turbo Pascal 5.0 and 4.0 units collection.
- The new procedures/functions also include WEEKNRFN function in the
- TSUNTE unit. It gives the weeknumber for a given date. REVCOLOR in
- TSUNTC reverses (toggles) text colors. And there are many other new
- routines making up a new unit TSUNTG.
-
- Thu 26-Oct-89: I have a private mailing list for emailing these
- update news. Especially, if you have my programs downloadable at
- your site or your BBS you are welcome to ask for inclusion on this
- list.
-
- Wed 18-Oct-89: Released update /pc/ts/tspas15.arc of my Turbo Pascal
- 5.0 and 4.0 units collection. New procedures/functions include BINFN
- in TSUNTB for fast conversion of decimal words to binary and HEXFN
- for fast conversion to hexadecimal. LBIN and LHEX convert long
- integers fast to binary and hexadecimal respectively. POWERLFN
- raises a longint to a power, fast. BORDER in TSUNTE changes the
- border color for CGA or VGA. All the rest of the procedures and
- functions remain unchanged.
-
- Tue 26-Sep-89: Released update /pc/ts/tspas14.arc of the Turbo
- Pascal 5.0 and 4.0 units collection. The package contains units from
- tsunta.tpu to tsuntf.tpu. Tsunte.tpu contains a new function
- cmdlnfn, which gives the entire command line in a program call. The
- input line-editing procedure edreadln in tsuntf.tpu now has a recall
- option (CursorUp) and the insert key toggle. I have preserved an
- edrdln procedure for line-editing without recall and insert. Tsuntd
- has new ParamCount and ParamStr like functions for obtaining
- substrings from a string.
-
- Sat 19-Aug-89: Released update /pc/ts/tspas13.arc of my Turbo Pascal
- units. I have rewritten the cursor-size routines in a more general
- fashion and rearranged the units.
- One of the weaknesses of the readln statement in (Turbo) Pascal
- is that it does not allow editing the input-string while giving the
- input from the keyboard. I decided to do something about this, and
- wrote an edreadln procedure, which allows to use of LeftCursor,
- RightCursor, BackSpace, Del, Home, End, and Esc. Of course such
- routines are very common in input from popup windows. Edreadln is,
- however, more of a readln-type procedure with normal scrolling
- capabilities, than a fixed position window routine. This routine is
- included in the new release.
-
- Wed 2-Aug-89: I have released un updated version of the Turbo Pascal
- units collection tspas12.arc. There are new string routines and
- detection of the monitor (mono/color) type.
-
-
- =======================================================================
- Messages from UseNet news
- =======================================================================
-
- From ts Sat Jul 28 09:25:43 1990
- Subject: Re: Program selftesting and viruses
- To: 16012_3045@uwovax.uwo.ca (Paul Gomme)
- Date: Sat, 28 Jul 90 9:25:43 EET DST
- In-Reply-To: <0649102756@uwovax.uwo.ca>; from "Paul Gomme" at Jul 27, 90 6:19 pm
- X-Mailer: ELM [version 2.2 PL16]
- Status: OR
-
- > > Programmers: Help fighting viruses and patching.
- > >
- > >Viruses and unauthorized patching are problems which should be
- > >fought against by the PC community. This program demonstrates a
- > >simple and a reasonably general, fast selftest to detect whether the
- > >program has caught a virus, or if it has been amateurishly patched.
- > >The code is easily incorporated in any Turbo Pascal source code. The
- > >idea is to check whether the file date and size have been altered.
- > >Most .exe viruses work by appending their code to the .exe file
- > >altering the file size. Trivial patching changes the file date.
- > >Either of these is detected by selftest.
- >
- > While the idea may have some merits, the execution is flawed.
- ^^^^^^
- No Paul, not flawed. Rather not foolproof, nor is meant to be.
-
- > First, it is a minor matter to obtain the creation date of a file.
- > Consequently, it is a relatively simple matter to apply a patch
- > which doesn't alter the file size, and restore the original creation
- > date. Your technique is subject to such an "attack".
-
- Certainly. The whole philosophy behind is to have a simple method
- which staves off any crude attempts. The problem with the more
- elaborate selfchecks (such as embedded checksums) is that they are
- difficult to implement.
-
- > Second, there are often good reasons to patch a file. Some of these
- > reasons are cosmetic in nature. Some programs even encourage user
- > patching.
-
- Also true, and then such patching should take care of the date. Or
- the selftest should have a relevant modification or omission of the
- date test.
-
- > From a more philosophical point of view, I wonder if protection
- > schemes don't in part encourage those who write viruses. Surely
- > part of the "thrill" is to avoid detection.
-
- Maybe. It can be looked at as a kind of a game. Nevertheless,
- consider the popularity eg McAfee's virus control programs have
- gained. Throwing one's hands up in the air is not a good solution.
-
- All the best, Timo
-
- =======================================================================
-
- From ts Tue Jul 31 12:07:13 1990
- Return-Path: <ts>
- Received: by uwasa.fi (4.1/(hh)29May89)
- id AA08907; Tue, 31 Jul 90 12:07:12 +0300
- From: Timo Salmi LASK <ts>
- Message-Id: <9007310907.AA08907@uwasa.fi>
- Subject: selftest
- To: ts (Timo Salmi LASK)
- Date: Tue, 31 Jul 90 12:07:11 EET DST
- X-Mailer: ELM [version 2.2 PL16]
- Status: O
-
- Newsgroups: comp.lang.pascal
- Path: uwasa.fi!ts
- From: ts@uwasa.fi (Timo Salmi LASK)
- Subject: Re: Program selftesting and viruses
- Message-ID: <1990Jul31.085732.8728@uwasa.fi>
- Organization: University of Vaasa
- References: <1990Jul27.182520.12051@uwasa.fi> <1875@krafla.rhi.hi.is>
- Date: Tue, 31 Jul 90 08:57:32 GMT
-
- In article <1875@krafla.rhi.hi.is> frisk@rhi.hi.is (Fridrik Skulason) writes:
- >This program works in most cases - however, it is not effective against some
- >of the latest viruses, which fool it by making the program appear unchanged,
- >after the virus is in control.
-
- This is certainly true, and the purpose of the code is to easily
- weed out elementary cases, which are the most frequent anyway. One
- of the points was to make the code simple to understand and include.
- The other alternative is to imbed a checksum in the .exe file. But
- the code is much more complicated, because the checksum (either
- direct or crc) constant itself within the program must be skipped
- when recalculating the checksum. Another problem is that the
- checksum must be calculated fast. Else it renders the host program
- useless. I have the code also for calculating and checking the
- direct checksum of an .exe file in addition to size & date check.
- This should be fairly effective. This will be included in the
- upcoming update of my Turbo Pascal units tspas21.arc.
-