home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************************/
- /* Program : UNSYS.C Creation Date: 08-12-1987 */
- /* Modified: 08-12-1987 */
- /* Author : Richard P. Hendricks Last Modified: 02-19-1988 */
- /* Compiler: Turbo C, Version 1.0 Adapted from Lattice C Version 3.0 */
- /* 02/05/87...02/05/87 */
- /* Function: Remove the System Files from a disk, IBMDOS.COM, IBMBIO.COM and */
- /* COMMAND.COM. IBMDOS.COM and IBMBIO.COM are Hidden-System files */
- /* so these attributes must be removed before the file can be */
- /* deleted. */
- /* - Version 1.0 Original Release 08/12/1987 */
- /* - Version 1.1 - Corrected OK/Failed Messages 02/19/1988 */
- /* to reflect that processing was */
- /* successful or not */
- /* - Commented on _chmod() function */
- /* - Used __DATE__ pre-define */
- /******************************************************************************/
- #include <stdio.h>
- #include <stat.h>
- #include <io.h>
- #include <dos.h>
-
- #define FUNC_SET_ACCESS_MODE 1
-
- main()
- {
- printf("UNSYS Version 1.1 Date: %s\n", __DATE__ );
- printf("Function: Removes the System files that are placed on a drive through\n");
- printf(" the FORMAT d:/S or SYS d: commands.\n\n");
-
- /******************************************************************************\
- ** _CHMOD() attempts to change the file attribute to the one designated. If **
- ** successful then it returns a 0 status. If it fails then it returns a -1 **
- ** and toggles the attribute. Example: file is hidden, _chmod( ..FA_HIDDEN ) **
- ** will fail and the file will be un-hidden. **
- \******************************************************************************/
-
- printf("Removing IBMBIO.COM..unhide file..");
- if( _chmod("IBMBIO.COM",FUNC_SET_ACCESS_MODE,FA_HIDDEN) != 0 )
- {
- printf("OK");
- }
- else
- {
- printf("failed");
- }
- printf("..remove system flag..");
- if( _chmod("IBMBIO.COM",FUNC_SET_ACCESS_MODE,FA_SYSTEM) != 0 )
- {
- printf("OK");
- }
- else
- {
- printf("failed");
- }
- printf("..delete file..");
- if( unlink("IBMBIO.COM") == 0 )
- {
- printf("OK\n");
- }
- else
- {
- printf("failed\n");
- }
-
- printf("Removing IBMDOS.COM..unhide file..");
- if( _chmod("IBMDOS.COM",FUNC_SET_ACCESS_MODE,FA_HIDDEN) != 0 )
- {
- printf("OK");
- }
- else
- {
- printf("failed");
- }
- printf("..remove system flag..");
- if( _chmod("IBMDOS.COM",FUNC_SET_ACCESS_MODE,FA_SYSTEM) != 0 )
- {
- printf("OK");
- }
- else
- {
- printf("failed");
- }
- printf("..delete file..");
- if( unlink("IBMDOS.COM") == 0 )
- {
- printf("OK\n");
- }
- else
- {
- printf("failed\n");
- }
-
- printf("Removing COMMAND.COM.delete file..");
- if( unlink("COMMAND.COM") == 0 )
- {
- printf("OK\n");
- }
- else
- {
- printf("failed\n");
- }
- }
- /* end-of-file UNSYS.C end-of-file */