Important alert: (current site time 10/22/2014 2:03:20 AM EDT)
 

VB icon

^! A dos based Turbo "C" program to Lock / Unlock .EXE or .COM files with full source code

Email
Submitted on: 4/26/2002 9:08:08 AM
By: my name is Nitin Jindal (from Panchkula,Haryana)  
Level: Advanced
User Rating: By 14 Users
Compatibility: C, C++ (general)
Views: 35431
(About the author)
 
     Dos based turbo "C" program which Enable/Disable .EXE or .COM file execution. Please disable any memory resident Anti Virus Program(Shield.)as this program changes the physical header of the .EXE or .COM file in order to make permanent changes. No need to creat another encrypted file. Now nobody can copy/execute your secret program. VOTE ME PLEASE !!!!!!!!!
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
//**************************************
// Name: ^! A dos based Turbo "C" program to Lock / Unlock .EXE or .COM files with full source code
// Description:Dos based turbo "C" program which Enable/Disable 
.EXE or .COM file execution. Please disable any memory resident Anti Virus Program(Shield.)as this program changes the physical header of the .EXE or .COM file in order to make permanent changes. No need to creat another encrypted file.
Now nobody can copy/execute your secret program.
VOTE ME PLEASE !!!!!!!!!
// By: my nameis Nitin Jindal (from Panchkula,Haryana)
//
//This code is copyrighted and has// limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=3810&lngWId=3//for details.//**************************************

/* failpass.cpp written in turbo "C"
 Developed By: computer_bazzar@rediffmail.com
Lock/Unlock .EXE,.COM files....
This is a EXCHANGE WARE program...
This program is specially developed for www.planet-source-code.com user's only.
You can use,modify or redistribute this program FREE OF COST but u will
have to give me any another usefull source code in turbo "C" (in exchange....)
PLEASE VOTE FOR ME !!!!!
**************************************************/
#include <fcntl.h>
#include <io.h>
#include <dos.h>
#include <stdio.h>
#include <string.h>
#include <process.h>
unsigned char buffer[3];
FILE *fd;
int handle;
fail(char *);
void pass(char *);
main(int argc,char *argv[])
{
int n;
if(argc!=3)
{
printf("\nFailpass Utility v1.0 Email: chingpongin@yahoo.co.in");
printf("\nEnable/Disable .EXE or .COM execution");
printf("\nsyntex failpass fail <filename.extension>");
printf("\n		 or");
printf("\n	 failpass pass <filename.extension>");
exit(2);
}
strupr(argv[1]);
n=strcmp(argv[1],"FAIL");
if(n==0)
{
fail(argv[2]);
exit(2);
}
n=strcmp(argv[1],"PASS");
if(n==0)
{
pass(argv[2]);
exit(2);
}
return 0;
}
fail(char *fname)
{
_chmod(fname,1,FA_ARCH);
fd=fopen(fname,"rb+");
if(fd==NULL)
{
printf("\nCann't open %s\n\n",fname);
exit(2);
}
fseek(fd,0,SEEK_SET);
fread(buffer,2,1,fd);
if(buffer[0]==0xcd)
if(buffer[1]==0x20)
{
fclose(fd);
printf("\n%s already protected...\n\n",fname);
exit(2);
}
fseek(fd,0,SEEK_END);
fwrite(buffer,2,1,fd);
fseek(fd,0,SEEK_SET);
buffer[0]=0xcd; /* don't take any PANGA with this line */
buffer[1]=0x20; /* don't take any PANGA with this line */
fwrite(buffer,2,1,fd);
fclose(fd);
return 0;
}
void pass(char *fname)
{
int xyz;
fd=fopen(fname,"rb+");
if(fd==NULL)
{
fclose(fd);
printf("\nCannot open file %s\n\n",fname);
exit(2);
}
fseek(fd,0,SEEK_SET);
fread(buffer,2,1,fd);
if(buffer[0]!=0xcd)
if(buffer[1]!=0x20)
{
fclose(fd);
printf("\n%s is NOT protected....\n\n",fname);
exit(2);
}
fseek(fd,-2,SEEK_END);
fread(buffer,2,1,fd);
fseek(fd,0,SEEK_SET);
fwrite(buffer,2,1,fd);
fclose(fd);
handle=open(fname,O_RDWR);
chsize(handle,(filelength(handle))-2);
close(handle);
}
/*******************************/


Other 5 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

12/12/2002 12:08:09 PM

very good web site ,in this web site
i updet in new technical idia thanks
this site organization,
lastly

(If this comment was disrespectful, please report it.)

 
7/7/2004 5:05:07 AMSanchit Karve

Nice idea to include the INT 0x20 Assembly instruction to close an executable when it is started. But the CD 20 Machine Language Instructions will work for .COM Files only. A Solution to this is to use the following Assembly Instructions:
MOV AH,4Ch
INT 21h

These Instructions take up a few more bytes but it's worth it since it will work for both EXE and COM Files.
(If this comment was disrespectful, please report it.)

 
7/9/2004 6:00:46 PM

Hi!

I'm new to C++ but want to know how to use this piece of code in my APP to stop execution for any file when executed on Windows, then sending it to my APP to check it from some strings includede in it and then return it and execute it normally.. so which is the correct code?

Thanks..
(If this comment was disrespectful, please report it.)

 
9/9/2004 9:35:23 AM

thank you for vgood free lean

(If this comment was disrespectful, please report it.)

 
9/24/2004 5:38:17 AM

From this site we getting new ideas about the programming concepts.
(If this comment was disrespectful, please report it.)

 
6/29/2006 8:41:31 AMarun

very good
(If this comment was disrespectful, please report it.)

 
2/20/2007 6:24:25 AManoop_colis@yahoo.co.in

this is an source code
(If this comment was disrespectful, please report it.)

 
4/3/2007 10:51:23 PMchandan sharma

nice
(If this comment was disrespectful, please report it.)

 
5/1/2007 12:53:00 AMAtul

hi...
can u plz tell me..
from where i can find
and process.h
(If this comment was disrespectful, please report it.)

 
5/9/2008 9:00:04 AMMandar

YOu are too cleaver, bu i want to run the dos commands using C/C++....can u give me sam tips on that topic.I need them very badly,u can mail me
(If this comment was disrespectful, please report it.)

 
6/30/2008 10:21:44 PM

Very good. you made my day and relieved me from tension
(If this comment was disrespectful, please report it.)

 
2/28/2011 1:50:41 AMyogesh

it is a wonderful attempt
(If this comment was disrespectful, please report it.)

 
9/24/2014 7:12:32 AM

Thanks for this code

(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.