zoukankan      html  css  js  c++  java
  • 枚举磁盘 枚举目录 对目录进行操作

    void EnumSys(){
    for(char i='A';i<='Z';i++) 
      
      { 
      
      char x[20]={i,':'}; 
      
      UINT Type=GetDriveType(x); 
      
      if(Type==DRIVE_FIXED||Type==DRIVE_REMOVABLE)//取硬盘和移动磁盘 
      
      { 
      
      EnumDirectory(x);//进行感染 此函数下面介绍 
      
      } 
      
      } 
    }
    

      

    bool EnumDirectory(TCHAR *dirpath) 
     
     { 
     
     WIN32_FIND_DATA fd; 
     
     TCHAR szTempFileFind[MAX_PATH] = { 0 }; 
     
     bool bIsFinish = false; 
     
     ZeroMemory(&fd, sizeof(WIN32_FIND_DATA)); 
     
     wsprintf(szTempFileFind, "%s\\*.*", dirpath); 
     
     HANDLE hFind = FindFirstFile(szTempFileFind, &fd); 
     
     if (hFind == INVALID_HANDLE_VALUE) 
     
     { 
     
     return false; 
     
     } 
     
     while (!bIsFinish) 
     
     { 
     
     bIsFinish = (FindNextFile(hFind, &fd)) ? false : true; 
     
     if ((strcmp(fd.cFileName, ".") != 0) && (strcmp(fd.cFileName, "..") != 0)) 
     
     { 
     
     TCHAR szFoundFileName[MAX_PATH] = { 0 }; 
     
     strcpy(szFoundFileName, fd.cFileName); 
     
     if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) 
     
     { 
     
     TCHAR szTempDir[MAX_PATH] = { 0 }; 
     
     wsprintf(szTempDir, "%s\\%s", dirpath, szFoundFileName); 
     
     Sleep(10); 
     
     inject(szTempDir);//进行操作  此函数下面介绍 
     
     EnumDirectory(szTempDir);//递归调用 
     
     } 
     
     } 
     
     } 
     
     FindClose(hFind); 
     
     return 0; 
     
     } 
     
    
    void inject(char* path){
    
    }
     
    

      

  • 相关阅读:
    POJ2182Lost Cows
    BZOJ4003: [JLOI2015]城池攻占
    POJ1635Subway tree systems
    BZOJ1005: [HNOI2008]明明的烦恼
    POJ1182 NOI2001 食物链
    栈的链式实现
    栈的数组实现
    链表ADT的实现
    #ifndef的用法
    using namespace std
  • 原文地址:https://www.cnblogs.com/FCoding/p/2764254.html
Copyright © 2011-2022 走看看