电子科技大学-计算机学院-计算机病毒作业-秦科教学班-编写程序搜索所有doc、dot文件电子科技大学-计算机学院-计算机病毒作业-秦科教学班-编写程序搜索所有doc、dot文件
// SearchForDoc.cpp : 定义控制台应用程序的入口点。 //
#include "stdafx.h"
#include
void find(char * lpPath)
{
char szFind[MAX_PATH], szFile[MAX_PATH];
WIN32_FIND_DATA FindFileData;
strcpy(szFind, lpPath);
strcat(szFind,...
电子科技大学-计算机学院-计算机病毒作业-秦科教学班-编写程序搜索所有doc、dot文件
// SearchForDoc.cpp : 定义控制台应用程序的入口点。 //
#include "stdafx.h"
#include
void find(char * lpPath)
{
char szFind[MAX_PATH], szFile[MAX_PATH];
WIN32_FIND_DATA FindFileData;
strcpy(szFind, lpPath);
strcat(szFind, "\\*.*");
HANDLE hFind = ::FindFirstFile(szFind, &FindFileData);
if (INVALID_HANDLE_VALUE == hFind)
return;
while (TRUE)
{
strcpy(szFile, lpPath);
strcat(szFile, "\\");
strcat(szFile, FindFileData.cFileName);
if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
if (FindFileData.cFileName[0] != '.')
{
find(szFile);
}
}
else
{
FILE* fp = fopen(szFile, "rb");
if (fp != NULL)
{
DWORD readBuffer[2];
if (fread(readBuffer, 4, 2, fp) == 2)
{
//printf("%x", readBuffer[0]);
//printf("%x\n", readBuffer[1]);
if ((readBuffer[0] == 0xE011CFD0) && (readBuffer[1] == 0xE11AB1A1))
{
printf("%60s : doc/dot\n", szFile);
}
else if ((readBuffer[0] == 0x04034B50) && (readBuffer[1] == 0x00060014))
{
printf("%60s : docx\n", szFile);
}
}
fclose(fp);
}
//printf("%s\n",FindFileData.dwFileAttributes);
//printf("%d\n",FindFileData.ftCreationTime.dwHighDateTime);
//printf("%d\n",FindFileData.ftCreationTime.dwLowDateTime);
}
if (!FindNextFile(hFind, &FindFileData))
break;
}
}
void main()
{
char filepath[MAX_PATH] = "F:";
find(filepath);
system("PAUSE");
}
本文档为【电子科技大学-计算机学院-计算机病毒作业-秦科教学班-编写程序搜索所有doc、dot文件】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。