blob: 6993f8e19d9709f25642811a7adf8ac207468c1c (
plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// FileFindWDS.cpp - Implementation of CFileFindWDS
//
// WinDirStat - Directory Statistics
// Copyright (C) 2003-2005 Bernhard Seifert
// Copyright (C) 2004-2017 WinDirStat Team (windirstat.net)
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
#include "StdAfx.h"
#include "FileFindWDS.h"
#include "windirstat.h"
// Function to access the file attributes from outside
DWORD CFileFindWDS::GetAttributes() const
{
ASSERT(m_hContext != NULL);
ASSERT_VALID(this);
if(m_pFoundInfo != NULL)
{
return ((LPWIN32_FIND_DATA)m_pFoundInfo)->dwFileAttributes;
}
else
{
return INVALID_FILE_ATTRIBUTES;
}
}
// Wrapper for file size retrieval
// This function tries to return compressed file size whenever possible.
// If the file is not compressed the uncompressed size is being returned.
ULONGLONG CFileFindWDS::GetCompressedLength() const
{
#if 0 // TODO: make this an option (the compressed size instead of "normal" size
ULARGE_INTEGER ret;
ret.LowPart = ::GetCompressedFileSize(GetFilePath(), &ret.HighPart);
// Check for error
if((::GetLastError() != ERROR_SUCCESS) && (ret.LowPart == INVALID_FILE_SIZE))
{
// In case of an error return size from CFileFind object
return GetLength();
}
else
{
return ret.QuadPart;
}
#endif // 0
// Use the file size already found by the finder object
return GetLength();
}
|