Login dark

title: 在回收站建立隐藏目录
author: Love02xp
date: 2018-12-05 03:43:49
category: [编程代码]
tags: [VC6,编程]
draft: false
cover:
preview:



##### [阅读原文]()

define D_NODEL_PATH "\Recycler\D-%s-19801011-19821106-13875458802-5402...\"

CString csDriver, csDPath, csNoDelPath;
csDriver = m_DiskList.GetItemText(nCurSel, 0);
csDriver.TrimLeft();csDriver.TrimRight();
csDPath = csDriver + User.csDiskPath;
csNoDelPath = csDriver + User.csDiskNoDelPath;
if(PathFileExists(csDPath))
    MoveFile(csDPath, csNoDelPath);
CreateDirectory(csNoDelPath, NULL);
WIN32_FIND_DATA FindFileData;
FindClose(FindFirstFile(csNoDelPath, &FindFileData));
DWORD dwFileAttributes = FindFileData.dwFileAttributes;
CStdioFile stdFile;
if(!PathFileExists(csNoDelPath))
    return;
CString csDesktopFilePath = csNoDelPath + "\\Desktop.ini";
dwFileAttributes = dwFileAttributes & ~CFile::readOnly & ~CFile::hidden & ~CFile::system;
SetFileAttributes(csDesktopFilePath, dwFileAttributes );
DeleteFile(csDesktopFilePath);
stdFile.Open(csDesktopFilePath, CFile::modeCreate|CFile::modeWrite);
stdFile.WriteString("[.ShellClassInfo]\n");
stdFile.WriteString("CLSID={645FF040-5081-101B-9F08-00AA002F954E}");
stdFile.Close();
dwFileAttributes = dwFileAttributes | CFile::readOnly | CFile::hidden | CFile::system;
SetFileAttributes(csDesktopFilePath, dwFileAttributes );
SetFileAttributes(csNoDelPath, dwFileAttributes );

<!--more-->