C語言實現病毒源碼 當含有病毒部分的程序被執(zhí)行時,首先進入病毒程序。它在磁盤上找擴展名為C的匹配文件,如果找到,查找是否有被傳染過的標志“INFECTED”。如果有此標志,繼續(xù)找其它的C文件,直至全部檢查一遍。若沒有這個標志,則 (1)在未被感染的C程序頭部加入“INFECTED”已被傳染標志。 (2)讀取病毒文件的頭文件,將其插入到即將被感染的文件頭部。如果發(fā)現有重復則不插入。 (3)在主程序中插入“VIRUSES();”調用VIRUSES函數。尋找Printf、for、while、break語句,如果找到就在之前插入。 (4)在文件尾部插入VIRUSES_SUB子程序。 (5)在插入到將感染文件里面的VIRUSES_SUB子程序里面,必須把文件名改為當前自身的文件名,否則被傳染后的文件經過編譯、連接和運行后不能再繼續(xù)傳染。 (6)最后插入VIRUSES子程序。這個子程序里面調用了VIRUSES_SUB,執(zhí)行到這里返回執(zhí)行結果信息。
上傳時間: 2013-12-24
上傳用戶:縹緲
//獲得當前的模式 oldmode = vga_getcurrentmode[] //初始化 vga_init[] //判斷是否支持該模式 if[vga_hasmode[mode]] vga_setmode[mode] else { Printf["No such mode\n"] exit[1] } //取得信息 width = vga_getxdim[] height = vga_getydim[] colors = vga_getcolors[] //繪圖 for[i=0 i<colors i++]{ vga_setcolor[i] vga_drawline[0, i, width-1, i] }
標簽: vga_getcurrentmode vga_init oldmode vga_ha
上傳時間: 2014-12-19
上傳用戶:maizezhen
//獲得當前的模式 oldmode = vga_getcurrentmode[] //初始化 vga_init[] //判斷是否支持該模式 if[vga_hasmode[mode]] vga_setmode[mode] else { Printf["No such mode\n"] exit[1] } //獲得當前的模式 mode = vga_getcurrentmode[] info = vga_getmodeinfo[mode]
標簽: vga_getcurrentmode vga_init oldmode vga_ha
上傳時間: 2017-03-24
上傳用戶:ecooo
srand[getpid[]] /* initialize some of the memory */ memset[heightmap, 0, MAPSIZE*MAPSIZE] memset[vpage, 0, RENDERWIDTH * RENDERHEIGHT] Printf["Creating dx d fractal terrain\n", MAPSIZE, MAPSIZE] heightmap[0] = [rand[] 128] + 64 // initialize starting point on map CreateFractalMap[0, 0, MAPSIZE, MAPSIZE] Printf["Smoothing terrain\n"] for [i = 0 i < 5 i++] SmoothMap[] MakeColorMap[]
標簽: MAPSIZE initialize heightmap getpid
上傳時間: 2014-01-04
上傳用戶:ainimao
srand[getpid[]] /* initialize some of the memory */ memset[heightmap, 0, MAPSIZE*MAPSIZE] memset[vpage, 0, RENDERWIDTH * RENDERHEIGHT] Printf["Creating dx d fractal terrain\n", MAPSIZE, MAPSIZE] heightmap[0] = [rand[] 128] + 64 // initialize starting point on map CreateFractalMap[0, 0, MAPSIZE, MAPSIZE] Printf["Smoothing terrain\n"] for [i = 0 i < 5 i++] SmoothMap[] MakeColorMap[]
標簽: MAPSIZE initialize heightmap getpid
上傳時間: 2013-12-25
上傳用戶:CSUSheep
//結構 struct fb_fix_screeninfo finfo struct fb_var_screeninfo vinfo //打開設備 fd = open["/dev/fb0", O_RDWR] if [!fd] { Printf["Cannot open framebuffer device.\n"] exit[1] } //取得固定信息 if [ioctl[fd, FBIOGET_FSCREENINFO, &finfo]] { Printf["Error reading fixed information.\n"] exit[1] } if [ioctl[fd, FBIOGET_VSCREENINFO, &vinfo]] { Printf["Error reading variable information.\n"] exit[1] }
標簽: struct fb_fix_screeninfo fb_var_screeninfo finfo
上傳時間: 2014-08-16
上傳用戶:gut1234567
移植uip-1.0到Atmega32 1)把 uip-1.0 的所有文件加入到工程,包括 uip 目錄的文件(除uip-split.c)、unix 目錄的文件、lib 目錄的文件; 2)修改 uip/uip-neighbor.c 文件的 void uip_neighbor_add(uip_ipaddr_t ipaddr, struct uip_neighbor_addr *addr) 函數,一般注釋掉 Printf 語句即可,或者改為你自己的串口格式化打印實現。 3)uip 目錄里的源文件除 uipopt.h 外一般都無需修改;uipopt.h 包含了 uip-conf.h ,所以大部分修改可以在 uip-conf.h 里進行。 uip-conf.h 里加入如下定義,可以減少編譯的警告: #define notdef 0 #define UIP_CONF_IPV6 0 #define UIP_ARCH_ADD32 0 #define UIP_ARCH_CHKSUM 0 #define UIP_NEIGHBOR_CONF_ADDRTYPE 0 4)移植工作主要是 定時器中斷程序 與 網絡驅動 的編寫
上傳時間: 2013-12-20
上傳用戶:csgcd001
client socket include <sys/types.h> include <sys/socket.h> include <stdio.h> include <netinet/in.h> include <arpa/inet.h> include <unistd.h> int main() { int sockfd int len struct sockaddr_in address int result char ch = A sockfd = socket(AF_INET, SOCK_STREAM, 0) address.sin_family = AF_INET address.sin_addr.s_addr = inet_addr("127.0.0.1") address.sin_port = 9734 len = sizeof(address) result = connect(sockfd, (struct sockaddr *)&address, len) if(result == -1) { perror("oops: client") exit(1) } write(sockfd, &ch, 1) read(sockfd, &ch, 1) Printf("char from server = c\n", ch) close(sockfd) exit(0) }
上傳時間: 2017-07-29
上傳用戶:wab1981
基于S3C2440移植的uC/OS-II最新源碼(V2.83),以及Flash、LCD、Nand Flash驅動和Printf庫。 使用ADS開發(fā)環(huán)境。
上傳時間: 2017-09-07
上傳用戶:colinal
兩個鏈表的交集 #include<stdio.h> #include<stdlib.h> typedef struct Node{ int data; struct Node *next; }Node; void initpointer(struct Node *p){ p=NULL; } int printlist(struct Node* head){ int flag=1; head=head->next; /* 因為標記1的地方你用了頭結點,所以第一個數據域無效,應該從下一個頭元結點開始 */ if(head==NULL) Printf("NULL\n"); else { while(head!=NULL) { if(flag==1) { Printf("%d",head->data); flag=0; } else { Printf(" %d",head->data); } head=head->next; } Printf("\n"); } return 0; } struct Node *creatlist(struct Node *head) { int n; struct Node *p1=(struct Node *)malloc(sizeof(struct Node)); p1->next=NULL; while(scanf("%d",&n),n!=-1) { struct Node *pnode=(struct Node *)malloc(sizeof(struct Node)); pnode->next=NULL; pnode->data=n; if(head==NULL) head=pnode; p1->next=pnode; p1=pnode; } return head; } struct Node *Intersect(struct Node *head1, struct Node *head2) { struct Node *p1=head1,*p2=head2;/*我這里沒有用頭指針和頭結點,這里是首元結點head1里面就是第一個數據,一定要理解什么事頭指針, 頭結點,和首元結點 具體你一定要看這個博客:http://blog.sina.com.cn/s/blog_71e7e6fb0101lipz.html*/ struct Node *head,*p,*q; head = (struct Node *)malloc(sizeof(struct Node)); head->next = NULL; p = head; while( (p1!=NULL)&&(p2!=NULL) ) { if (p1->data == p2->data) { q = (struct Node *)malloc(sizeof(struct Node)); q->data = p1->data; q->next = NULL; p->next = q;//我可以認為你這里用了頭結點,也就是說第一個數據域無效 **標記1** p = q; p1 = p1->next; p2 = p2->next; } else if (p1->data < p2->data) { p1 = p1->next; } else { p2 = p2->next; } } return head; } int main() { struct Node *head=NULL,*headt=NULL,*t; //initpointer(head);//這里的函數相當于head=NULL; // initpointer(headt);//上面已經寫了headt=NULL那么這里可以不用調用這個函數 head=creatlist(head); headt=creatlist(headt); t=Intersect(head,headt); printlist(t); }
標簽: c語言編程
上傳時間: 2015-04-27
上傳用戶:coco2017co