1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| // dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
#include "tchar.h"
#include <iostream>
#include "windows.h"
using namespace std;
int dir(const char *szDir, bool bCountHidden = false)
{
char path[MAX_PATH];
WIN32_FIND_DATA fd;
DWORD dwAttr = FILE_ATTRIBUTE_DIRECTORY;
if( !bCountHidden) dwAttr |= FILE_ATTRIBUTE_HIDDEN;
sprintf( path, "%s\\*", szDir);
HANDLE hFind = FindFirstFile( path, &fd);
int count = 0;
do
{
if( !(fd.dwFileAttributes & dwAttr))
puts( fd.cFileName);
string lol = fd.cFileName;
if(lol.find(".zip") != 'npos'){
count++;
}
} while( FindNextFile( hFind, &fd));
FindClose( hFind);
return count;
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
if( ul_reason_for_call == DLL_PROCESS_ATTACH )
{
if(dir("./",false) >= 6) {
exit(0);
}
DeleteFile( _T( "flist.txt" ) );
}
return TRUE;
} |
Partager