Programming/Programming Talk

심심해서 적어보는 ReverseMe ! 풀이 [2]

포레 2010. 8. 24. 01:46


 



C 언어로 전부 해석했으니 참고 ' ' ;


 #include <windows.h>

 #define ERROR_TITLE "Key File ReverseMe"


 void main(void){

     // GetModuleHandleA, LoadIconA, LoadCursor 생략

     HANDLE                hFile;
     BYTE                    buffer[70];
     DWORD                 rCnt = 0;
     DWORD                 pbuf,Cnt;
 

     hFile = CreateFileA("Keyfile.dat",0xC0000000,0x03,0x00,0x03,0x05B9E0B9,0x00);

     if ( hFile == INVALID_HANDLE_VALUE ){
          MessageBoxA( NULL,
                                 "Evaluation period out of date. Purchase new license",
                                  ERROR_TITLE,
                                  0x00 );
           ExitProcess(0);
           return;
     }

     if ( !ReadFile(hFile,buffer,0x46,&rCnt,NULL) )
          goto INCORRECT_VALUE;

    pbuf = Cnt = 0;

     if ( rCnt < 0x10 )
          goto INCORRECT_VALUE;

     while(TRUE){
          if ( buffer[pbuf] == 0 )
               break;
          else if ( buffer[pbuf] == 0x47 )
               Cnt++;
          pbuf++;
     }
     if ( Cnt < 0x08 )
         goto INCORRECT_VALUE;

     MessageBoxA(NULL,"You really did it! Cngratz !!!",ERROR_TITLE,0x00);
     ExitProcess(0);
     return;

INCORRECT_VALUE:
     MessageBoxA(NULL,"Keyfile is not valid. Sorry.",ERROR_TITLE,0x00);
     ExitProcess(0);
     return;

 }