home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************
- * R_CL.C - Åα«úαá¼¼á ß¡∩Γ¿∩ ºáΘ¿Γδ ß Σá⌐½«ó, ºáΘ¿ΘÑ¡¡δσ »á¬ÑΓ«¼ *
- * COPYLOCK. *
- * äá¡¡á∩ »α«úαá¼¼á ¡á»¿ßá¡á ¡á ∩ºδ¬Ñ Æurbo C++. *
- * Åα¿ßΓ䬫ó«τ¡δ⌐ ¼Ñσá¡¿º¼ ºáΘ¿Γδ ºá¼Ñ¡∩ÑΓß∩ Σá⌐½«¼ *
- * DMP.BIN *
- * çá»π߬: R_CL <¿¼∩ ºáΘ¿ΘÑ¡¡«ú« Σá⌐½á> *
- * 04.10.91. ÇóΓ«α 䫽ú¿¡ Ç.à. *
- ************************************************************************/
-
- #include <dos.h>
- #include <io.h>
- #include <alloc.h>
- #include <fcntl.h>
-
- int fd1,fd2;
-
- main ( int argc, char *argv[] )
-
- {
- char buf1[0x20];
- char far *buf2;
- int cc,err(int i_o, char *fil_nam);
- unsigned cs,ip,*p,fp;
-
- if ( argc !=2 )
- {
- printf ( " ìÑóÑα¡«Ñ ¬«½¿τÑßΓó« »áαá¼ÑΓα«ó!\n" ) ;
- return -3 ;
- }
-
- if ( ( fd1 = _open ( argv[1], O_RDWR )) == -1 )
- {
- printf ( " öá⌐½ %s ¡Ñ ¡á⌐ñÑ¡ !\n", argv[1] ) ;
- return -4 ;
- }
-
- if ( ( fd2 = _open ( "dmp.bin", O_RDONLY )) == -1 )
- {
- printf ( "öá⌐½ DMP.BIN ¡Ñ ¡á⌐ñÑ¡ !\n" ) ;
- _close ( fd1 ) ; return -5 ;
- }
-
- if ( _read ( fd1, buf1, 0x20 ) == -1 )
- return err ( 1, argv[1] ) ;
-
- if ( *buf1 == 0xe9 ) fp = 1 ;
- else if ( *buf1 == 0x4d && buf1[1] == 0x5a ) fp = 0 ;
- else goto notcpylck ;
-
- if ( fp ) { p = (unsigned *)(buf1 + 1) ;
- cs = 0 ; ip = *p + 3 ;
- }
- else { p = (unsigned *)(buf1 + 8) ;
- cs = p[0] + p[7] ; ip = p[6] ;
- }
-
- lseek ( fd1, ((long)cs<<4)+ip-0x20, 0 ) ;
- if ( _read ( fd1, buf1, 9 ) == -1 )
- return err ( 1, argv[1] ) ;
-
- if ( (*buf1 != 0x52 || *buf1 != 0x4c) && buf1[8] != 0x16 )
- {
- notcpylck:
- printf ( " ÄτÑ¡∞ ªá½∞, ¡« φΓá ºáΘ¿Γá ¼¡Ñ ¡Ñ »« ºπíá¼.\n" ) ;
- cc = 0 ; goto clos ;
- }
-
- if ( (buf2 = farmalloc ( 0x1290 )) == 0 )
- { printf ( "ìÑñ«ßΓáΓ«τ¡« »á¼∩Γ¿!\n" ) ;
- cc = 0 ; goto clos ; }
-
- if ( _read ( fd2, buf2, 0x1290 ) == -1 )
- { cc = -1 ; goto clos ; }
-
- lseek ( fd1, ((long)cs<<4)+ip, 0 ) ;
-
- if ( _write ( fd1, buf2, 0x1290 ) == -1 )
- { farfree ( buf2 ) ; return err ( 2, argv[1] ) ; }
-
- cc = 1 ;
- clos:
- farfree ( buf2 ) ;
- _close ( fd1 ) ;
- _close ( fd2 ) ;
- return cc ;
- }
-
- /******************************/ int err /*********************************/
-
- ( int rw, char *f )
-
- {
- char msg[][6] = { "τΓÑ¡¿∩","ºá»¿ß¿"};
-
- printf ("ÄΦ¿í¬á %s ó Σá⌐½Ñ %s !\n", msg[rw-1], f ) ;
- _close ( fd1 ) ; _close ( fd2 ) ;
-
- return -rw ;
- }