evilknight 发表于 2009-10-6 21:43:02

[原]生成一个节的可执行文件

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

#pragma comment(linker, "/SECTION:.MicroQ,ERWXS")
#pragma comment(linker, "/MERGE:.data=.MicroQ")
#pragma comment(linker, "/MERGE:.idata=.MicroQ")
#pragma comment(linker, "/MERGE:.text=.MicroQ")
#pragma comment(linker, "/MERGE:.rdata=.MicroQ")
//#pragma comment(linker, "/align:0x200")

#pragma data_seg(".MicroQ")
char szPasswd[] = "EvilKnight" ;
#pragma data_seg()

#pragma code_seg(".text")
int main(void)
{
    char szInput = {0} ;
    int i = 0;
    for (; i< 3; ++i)
    {
      memset(szInput, 0, sizeof(char) * 64) ;
      gets(szInput) ;
      if (strcmp(szPasswd, szInput) == 0)
      {
            printf("The password is success!\n") ;
            return 0 ;
      }
      else
      {
            printf("Password Error, again type the password please\n") ;
      }
      system("pause") ;
    }
    return 0 ;
}
#pragma code_seg()
#define _X86
#ifdef _X86
#pragma message("_X86 macro activated!")
#endif

[ 本帖最后由 evilknight 于 2009-10-7 00:57 编辑 ]
页: [1]
查看完整版本: [原]生成一个节的可执行文件