Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

c±àÒë¹ý³Ì

±àÒëµÄ¸ÅÄ±àÒë³ÌÐò¶ÁÈ¡Ô´³ÌÐò£¨×Ö·ûÁ÷£©£¬¶ÔÖ®½øÐдʷ¨ºÍÓï·¨µÄ·ÖÎö£¬½«¸ß¼¶ÓïÑÔÖ¸Áîת»»Îª¹¦ÄܵÈЧµÄ»ã±à´úÂ룬ÔÙÓÉ»ã±à³ÌÐòת»»Îª»úÆ÷ÓïÑÔ£¬²¢ÇÒ°´ÕÕ²Ù×÷ϵͳ¶Ô¿ÉÖ´ÐÐÎļþ¸ñʽµÄÒªÇóÁ´½ÓÉú³É¿ÉÖ´ÐгÌÐò¡£
    ±àÒëµÄÍêÕû¹ý³Ì£ºCÔ´³ÌÐò£­£­>Ô¤±àÒë´¦Àí(.c)£­£­>±àÒë¡¢ÓÅ»¯³ÌÐò£¨.s¡¢.asm£©£­£­>»ã±à³ÌÐò(.obj¡¢.o¡¢.a¡¢.ko)£­£­>Á´½Ó³ÌÐò£¨.exe¡¢.elf¡¢.axfµÈ£©
1. ±àÒëÔ¤´¦Àí
    ¶ÁÈ¡cÔ´³ÌÐò£¬¶ÔÆäÖеÄαָÁÒÔ#¿ªÍ·µÄÖ¸ÁºÍÌØÊâ·ûºÅ½øÐд¦Àí
αָÁîÖ÷Òª°üÀ¨ÒÔÏÂËĸö·½Ã棺
£¨1£©ºê¶¨ÒåÖ¸ÁÈç#define Name TokenString£¬#undefµÈ¡£
¶ÔÓÚÇ°Ò»¸öαָÁԤ±àÒëËùÒª×öµÄÊǽ«³ÌÐòÖеÄËùÓÐNameÓÃTokenStringÌæ»»£¬µ«×÷Ϊ×Ö·û´®³£Á¿µÄ NameÔò²»±»Ìæ»»¡£¶ÔÓÚºóÕߣ¬Ôò½«È¡Ïû¶Ôij¸öºêµÄ¶¨Ò壬ʹÒÔºó¸Ã´®µÄ³öÏÖ²»ÔÙ±»Ìæ»»¡£
£¨2£©Ìõ¼þ±àÒëÖ¸ÁÈç#ifdef£¬#ifndef£¬#else£¬#elif£¬#endifµÈ¡£
ÕâЩαָÁîµÄÒýÈëʹµÃ³ÌÐòÔ±¿ÉÒÔͨ¹ý¶¨Ò岻ͬµÄºêÀ´¾ö¶¨±àÒë³ÌÐò¶ÔÄÄЩ´úÂë½øÐд¦Àí¡£Ô¤±àÒë³ÌÐò½«¸ù¾ÝÓйصÄÎļþ£¬½«ÄÇЩ²»±ØÒªµÄ´úÂë¹ýÂ˵ô
£¨3£© Í·Îļþ°üº¬Ö¸ÁÈç#include "FileName"»òÕß#include FileName>µÈ¡£
ÔÚÍ·ÎļþÖÐÒ»°ãÓÃαָÁî#define¶¨ÒåÁË´óÁ¿µÄºê£¨×î³£¼ûµÄÊÇ×Ö·û³£Á¿£©£¬Í¬Ê±°üº¬Óи÷ÖÖÍⲿ·ûºÅµÄÉùÃ÷¡£
    ²ÉÓÃÍ·ÎļþµÄÄ¿µÄÖ÷ÒªÊÇΪÁËʹijЩ¶¨Òå¿ÉÒÔ¹©¶à¸ö²»Í¬µÄCÔ´³ÌÐòʹÓá£ÒòΪÔÚÐèÒªÓõ½ÕâЩ¶¨ÒåµÄCÔ´³ÌÐòÖУ¬Ö»Ðè¼ÓÉÏÒ»Ìõ#includeÓï¾ä¼´¿É£¬¶ø²»±ØÔÙÔÚ´ËÎļþÖн«ÕâЩ¶¨ÒåÖظ´Ò»±é¡£Ô¤±àÒë³ÌÐò½«°ÑÍ·ÎļþÖеĶ¨Òåͳͳ¶¼¼ÓÈëµ½ËüËù²úÉúµÄÊä³öÎļþÖУ¬ÒÔ¹©±àÒë³ÌÐò¶ÔÖ®½øÐд¦Àí¡£
    °üº¬µ½cÔ´³ÌÐòÖеÄÍ·Îļþ¿ÉÒÔÊÇϵͳÌṩµÄ£¬ÕâЩͷÎļþÒ»°ã±»·ÅÔÚ/usr/includeĿ¼Ï¡£ÔÚ³ÌÐòÖÐ#includeËüÃÇҪʹÓüâÀ¨ºÅ£¨ >£©¡£ÁíÍ⿪·¢ÈËÔ±Ò²¿ÉÒÔ¶¨Òå×Ô¼ºµÄÍ·Îļþ£¬ÕâЩÎļþÒ»°ãÓëcÔ´³ÌÐò·ÅÔÚͬһĿ¼Ï£¬´ËʱÔÚ#includeÖÐÒªÓÃË«ÒýºÅ£¨""£©¡£
£¨4£©ÌØÊâ·ûºÅ£¬Ô¤±àÒë³ÌÐò¿ÉÒÔʶ±ðһЩÌØÊâµÄ·ûºÅ¡£
ÀýÈçÔÚÔ´³ÌÐòÖгöÏÖµÄLINE±êʶ½«±»½âÊÍΪµ±Ç°Ðкţ¨Ê®½øÖÆÊý£©£¬FILEÔò±»½âÊÍΪµ±Ç°±»±àÒëµÄCÔ´³ÌÐòµÄÃû³Æ¡£Ô¤±àÒë³ÌÐò¶ÔÓÚÔÚÔ´³ÌÐòÖгöÏÖµÄÕâЩ´®½«ÓúÏÊʵÄÖµ½øÐÐÌæ»»¡£
   Ô¤±àÒë³ÌÐòËùÍê³ÉµÄ»ù±¾ÉÏÊǶÔÔ´³ÌÐòµÄ“Ìæ´ú”¹¤×÷¡£¾­¹ý´ËÖÖÌæ´ú£¬Éú³ÉÒ»¸öûÓк궨Ò塢ûÓÐÌõ¼þ±àÒëÖ¸ÁûÓÐÌØÊâ·ûºÅµÄÊä³öÎļþ¡£Õâ¸öÎļþµÄº¬ÒåͬûÓо­¹ýÔ¤´¦ÀíµÄÔ´Î


Ïà¹ØÎĵµ£º

[ת]C/C++ HOOK API£¨Ô­ÀíÉîÈëÆÊÎöÖ® LoadLibraryA£©

9Ô¶¼¿ì½áÊøÁË£¬Ö®Ç°Ò»Ö±Ã¦µ½Ð´×Ô¼ºµÄ¶«Î÷¼ÓÉÏÉÏ°à¡£»ù±¾Ã»ÓÐʱ¼äÑо¿Ï»ã±àºÍC C++·½ÃæµÄ¸ÐÐËȤµÄ¶«Î÷¡£ÔÙÔõô˵Â9Ô»¹ÊǵÃдһƪÈö£¬ÒÔºóÿÔÂÖÁÉÙһƪ°É¡£¸ø×Ô¼º¶¨ÁË£¬Ï£Íû´ó¼Ò¼à¶½¡£ºÙºÙ£¡
ÕâƪÎÄÕ¾ÍÀ´Ì¸Ì¸Æ½³£ºÜ³£¼ûµÄHOOK¼¼Êõ£¬ÕâÀïÄØ¡£Ð´µÃ±È½Ï¼òµ¥£¬·½·¨ºÜ¶à¡£Ö»½²Ô­Àí£¡Ï£Íû´óÄñÃDZðÍÂÎÒ¿ÚË®¹þ - -¡£ºÃ£¡ÇÐÈëÕ ......

linux ÏÂc ³ÌÐò ¶Î´íÎó ·ÖÎö

fopen("/var/spool/cron/tmp","w+");
/////////////////////////////////////////
££i nclude <sys/types.h>
££i nclude <sys/stat.h>
££i nclude <fcntl.h>
££i nclude <unistd.h>
££i nclude <stdio.h>
££i nclude <string.h>
££i nclude <stdlib.h>
int main(){
in ......

CλÔËËã

12.1       λÔËËã·û£ÃÓïÑÔÌṩÁËÁùÖÖλÔËËã·û£º
    &          °´Î»Óë
    |          °´Î»»ò
    ^     &nb ......

LINUXϽøÐÐCÓïÑÔ±à³Ì

Ô´³ÌÐò±àÒë  

MakefileµÄ±àд  

³ÌÐò¿âµÄÁ´½Ó  

³ÌÐòµÄµ÷ÊÔ  

Í·ÎļþºÍϵͳÇóÖú  


1.Ô´³ÌÐòµÄ±àÒë  

ÔÚLinuxÏÂÃæ,Èç¹ûÒª±àÒëÒ»¸öCÓïÑÔÔ´³ÌÐò,ÎÒÃÇҪʹÓÃGNUµÄgcc±àÒëÆ÷.   ÏÂÃæÎÒÃÇÒÔÒ»¸öʵÀýÀ´ËµÃ÷ÈçºÎʹÓÃgcc±àÒëÆ÷.  
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ