我的问题是:为什么我的输出给了我“recycle.bin”文件,而这一切都没有,就像它不会是那里的任何文件(“C:\ *”/“D:\ * “) 在我调用FindNextFile()后,我得到错误18(目录中没有更多文件),问题是,这是错误的
bool data_confersion(PWIN32_FIND_DATAW pFileData, P_SINGLE_FILE pFile){
//file sieze determining
pFile->filesize = pFileData->nFileSizeLow;
((int*)&pFile->filesize)[1] = pFileData->nFileSizeHigh;
pFile->attributes = pFileData->dwFileAttributes;
pFile->name = new WCHAR[MAX_PATH];
for(int i=0; i<MAX_PATH; i++){
pFile->name[i] = pFileData->cFileName[i];
}
if(FileTimeToSystemTime(&pFileData->ftCreationTime, &pFile->CreationTime) ||
FileTimeToSystemTime(&pFileData->ftLastAccessTime, &pFile->LastAccessTime) ||
FileTimeToSystemTime(&pFileData->ftLastWriteTime, &pFile->LastWriteTime))
return false;
return true;
}
bool FILESYSTEM::updateFolderContent(P_DRIVE _d){
LPTSTR t = new wchar_t[128];
int i=0;
P_SINGLE_FILE p_t_file;
bool b_found = false;
int i_filesCount = 0;
for(; _d->logicalDrives[i]!=L'\0'; i++)
t[i]=_d->logicalDrives[i];
t[i]=L'*';
t[i+1]=0;
LPVOID v;
WIN32_FIND_DATAW p;
Wow64DisableWow64FsRedirection(&v);
HANDLE hFind = FindFirstFile(t, &p);
//SCANING FOR NEXT FILES
do{
//LOOP CHECKING IF FILE IS SAVED IN DATA BASE
i_filesCount++;
for(int i=0; i<_d->content.size; i++){
p_t_file = _d->content[i];
for(int j=0; p_t_file->name[i]!=0; i++){
if(p_t_file->name[i]!=p.cFileName[i])
b_found = true;
}
}
if(!b_found){
p_t_file = new SINGLE_FILE;
_d->content.push(p_t_file);
data_confersion(&p , p_t_file);
}
b_found = false;
}while(FindNextFile(hFind, &p));
int err = GetLastError();
if(!FindClose(hFind)){
err = GetLastError();
}
if(i_filesCount < _d->content.size){
for(int i=0; i<_d->content.size; i++){
p_t_file = _d->content[i];
if(INVALID_FILE_ATTRIBUTES == GetFileAttributes(p_t_file->name)){
int err = GetLastError();
_d->content.pop(i);
i--;
}
}
}
Wow64RevertWow64FsRedirection(v);
return true;
}
答案 0 :(得分:0)
您的t
字符串很可能是错误的。它基本上是logicalDrives
(复数),附加了一个*
。这不太可能是正确的。