⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stripexe.cpp

📁 写了一个很简单的内核!只是在屏幕上打印“hello,world”但分析此代码
💻 CPP
字号:
/**********************************
 *
 * STRIPEXE
 * ========
 * Strips the header of an exe file. Creates two files
 * One the stripped exe and the other the header file.
 *
 * by Vivek Mohan
 * mail me : mailvivek27@sify.com
 * visit my home : http://www.geocities.com/cppresources/
 *
 **********************************/

# include <stdlib.h>
# include <conio.h>
# include <stdio.h>

void main(int argc,char *argv[])
{
	if(argc<=2)
	{ printf("Usage :.. <sourcefile(.exe)> <strippedfilename> <headerfile>");
	  exit(0);
	}

	/* The File Handles */

	FILE *srcFile , *dstFile , *hdrFile;

	printf("Opening source file %s",argv[1]);

	if((srcFile = fopen(argv[1],"rb"))==NULL)
	{ printf("\nfatal-error: file (%s) not found. exiting..",argv[1]);
	  exit(1);
	}

	printf("\nCreating destination files %s.bin and header.bin",argv[1]);

	if((dstFile = fopen(argv[2],"wb"))==NULL)
	{ printf("\nfatal-error: output file (%s) could not be created. exiting..",argv[1]);
	  exit(1);
	}

	if((hdrFile = fopen(argv[3],"wb"))==NULL)
	{ printf("\nfatal-error : header output could not be created.");
	  exit(1);
	}

	printf("\nStripping EXE header..");

	char* buffer = new char[512];

	fread (buffer,512,sizeof(char),srcFile);
	fwrite(buffer,sizeof(char),512,hdrFile);


	fclose(hdrFile);

	printf("\nWriting rest of the binary to %s",argv[2]);

	while(!feof(srcFile))
	{ fputc(fgetc(srcFile),dstFile); }

	printf("\nDone.");

	fclose(dstFile);
	fclose(srcFile);

	EXIT_SUCCESS;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -