mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-25 14:54:39 +02:00
Code enhancement for file checking
Add missing dwFileAttributes init to INVALID_FILE_ATTRIBUTES. Close #15820
This commit is contained in:
parent
8f0484caf3
commit
c021c86195
@ -1552,6 +1552,7 @@ Press the OK button to open the Find dialog or set focus on it.
|
|||||||
|
|
||||||
If you require the backward regex searching feature, consult the user manual for instructions on enabling it."/>
|
If you require the backward regex searching feature, consult the user manual for instructions on enabling it."/>
|
||||||
<PrintError title="0" message="Cannot start printer document."/><!-- Use title="0" to use Windows OS default translated "Error" title. -->
|
<PrintError title="0" message="Cannot start printer document."/><!-- Use title="0" to use Windows OS default translated "Error" title. -->
|
||||||
|
<FileToLoadSizeCheckFailed title="File to load size-check failed" message="Cannot obtain the file size before loading!"/>
|
||||||
</MessageBox>
|
</MessageBox>
|
||||||
<ClipboardHistory>
|
<ClipboardHistory>
|
||||||
<PanelTitle name="Clipboard History"/>
|
<PanelTitle name="Clipboard History"/>
|
||||||
|
@ -1550,6 +1550,7 @@ Press the OK button to open the Find dialog or set focus on it.
|
|||||||
|
|
||||||
If you require the backward regex searching feature, consult the user manual for instructions on enabling it."/>
|
If you require the backward regex searching feature, consult the user manual for instructions on enabling it."/>
|
||||||
<PrintError title="0" message="Cannot start printer document."/><!-- Use title="0" to use Windows OS default translated "Error" title. -->
|
<PrintError title="0" message="Cannot start printer document."/><!-- Use title="0" to use Windows OS default translated "Error" title. -->
|
||||||
|
<FileToLoadSizeCheckFailed title="File to load size-check failed" message="Cannot obtain the file size before loading!"/>
|
||||||
</MessageBox>
|
</MessageBox>
|
||||||
<ClipboardHistory>
|
<ClipboardHistory>
|
||||||
<PanelTitle name="Clipboard History"/>
|
<PanelTitle name="Clipboard History"/>
|
||||||
|
@ -1778,7 +1778,7 @@ struct GetDiskFreeSpaceParamResult
|
|||||||
{
|
{
|
||||||
std::wstring _dirPath;
|
std::wstring _dirPath;
|
||||||
ULARGE_INTEGER _freeBytesForUser {};
|
ULARGE_INTEGER _freeBytesForUser {};
|
||||||
DWORD _result = FALSE;
|
BOOL _result = FALSE;
|
||||||
bool _isTimeoutReached = true;
|
bool _isTimeoutReached = true;
|
||||||
|
|
||||||
GetDiskFreeSpaceParamResult(wstring dirPath) : _dirPath(dirPath) {};
|
GetDiskFreeSpaceParamResult(wstring dirPath) : _dirPath(dirPath) {};
|
||||||
@ -1792,7 +1792,7 @@ DWORD WINAPI getDiskFreeSpaceExWorker(void* data)
|
|||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
};
|
};
|
||||||
|
|
||||||
DWORD getDiskFreeSpaceWithTimeout(const wchar_t* dirPath, ULARGE_INTEGER* freeBytesForUser, DWORD milliSec2wait, bool* isTimeoutReached)
|
BOOL getDiskFreeSpaceWithTimeout(const wchar_t* dirPath, ULARGE_INTEGER* freeBytesForUser, DWORD milliSec2wait, bool* isTimeoutReached)
|
||||||
{
|
{
|
||||||
GetDiskFreeSpaceParamResult data(dirPath);
|
GetDiskFreeSpaceParamResult data(dirPath);
|
||||||
|
|
||||||
@ -1833,7 +1833,7 @@ struct GetAttrExParamResult
|
|||||||
{
|
{
|
||||||
wstring _filePath;
|
wstring _filePath;
|
||||||
WIN32_FILE_ATTRIBUTE_DATA _attributes{};
|
WIN32_FILE_ATTRIBUTE_DATA _attributes{};
|
||||||
DWORD _result = FALSE;
|
BOOL _result = FALSE;
|
||||||
bool _isTimeoutReached = true;
|
bool _isTimeoutReached = true;
|
||||||
|
|
||||||
GetAttrExParamResult(wstring filePath): _filePath(filePath) {
|
GetAttrExParamResult(wstring filePath): _filePath(filePath) {
|
||||||
@ -1844,12 +1844,12 @@ struct GetAttrExParamResult
|
|||||||
DWORD WINAPI getFileAttributesExWorker(void* data)
|
DWORD WINAPI getFileAttributesExWorker(void* data)
|
||||||
{
|
{
|
||||||
GetAttrExParamResult* inAndOut = static_cast<GetAttrExParamResult*>(data);
|
GetAttrExParamResult* inAndOut = static_cast<GetAttrExParamResult*>(data);
|
||||||
inAndOut->_result = ::GetFileAttributesEx(inAndOut->_filePath.c_str(), GetFileExInfoStandard, &(inAndOut->_attributes));
|
inAndOut->_result = ::GetFileAttributesExW(inAndOut->_filePath.c_str(), GetFileExInfoStandard, &(inAndOut->_attributes));
|
||||||
inAndOut->_isTimeoutReached = false;
|
inAndOut->_isTimeoutReached = false;
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
};
|
};
|
||||||
|
|
||||||
DWORD getFileAttributesExWithTimeout(const wchar_t* filePath, WIN32_FILE_ATTRIBUTE_DATA* fileAttr, DWORD milliSec2wait, bool* isTimeoutReached)
|
BOOL getFileAttributesExWithTimeout(const wchar_t* filePath, WIN32_FILE_ATTRIBUTE_DATA* fileAttr, DWORD milliSec2wait, bool* isTimeoutReached)
|
||||||
{
|
{
|
||||||
GetAttrExParamResult data(filePath);
|
GetAttrExParamResult data(filePath);
|
||||||
|
|
||||||
@ -1886,6 +1886,7 @@ DWORD getFileAttributesExWithTimeout(const wchar_t* filePath, WIN32_FILE_ATTRIBU
|
|||||||
bool doesFileExist(const wchar_t* filePath, DWORD milliSec2wait, bool* isTimeoutReached)
|
bool doesFileExist(const wchar_t* filePath, DWORD milliSec2wait, bool* isTimeoutReached)
|
||||||
{
|
{
|
||||||
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
||||||
|
attributes.dwFileAttributes = INVALID_FILE_ATTRIBUTES;
|
||||||
getFileAttributesExWithTimeout(filePath, &attributes, milliSec2wait, isTimeoutReached);
|
getFileAttributesExWithTimeout(filePath, &attributes, milliSec2wait, isTimeoutReached);
|
||||||
return (attributes.dwFileAttributes != INVALID_FILE_ATTRIBUTES && !(attributes.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
|
return (attributes.dwFileAttributes != INVALID_FILE_ATTRIBUTES && !(attributes.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
|
||||||
}
|
}
|
||||||
@ -1893,6 +1894,7 @@ bool doesFileExist(const wchar_t* filePath, DWORD milliSec2wait, bool* isTimeout
|
|||||||
bool doesDirectoryExist(const wchar_t* dirPath, DWORD milliSec2wait, bool* isTimeoutReached)
|
bool doesDirectoryExist(const wchar_t* dirPath, DWORD milliSec2wait, bool* isTimeoutReached)
|
||||||
{
|
{
|
||||||
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
||||||
|
attributes.dwFileAttributes = INVALID_FILE_ATTRIBUTES;
|
||||||
getFileAttributesExWithTimeout(dirPath, &attributes, milliSec2wait, isTimeoutReached);
|
getFileAttributesExWithTimeout(dirPath, &attributes, milliSec2wait, isTimeoutReached);
|
||||||
return (attributes.dwFileAttributes != INVALID_FILE_ATTRIBUTES && (attributes.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
|
return (attributes.dwFileAttributes != INVALID_FILE_ATTRIBUTES && (attributes.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
|
||||||
}
|
}
|
||||||
@ -1900,6 +1902,7 @@ bool doesDirectoryExist(const wchar_t* dirPath, DWORD milliSec2wait, bool* isTim
|
|||||||
bool doesPathExist(const wchar_t* path, DWORD milliSec2wait, bool* isTimeoutReached)
|
bool doesPathExist(const wchar_t* path, DWORD milliSec2wait, bool* isTimeoutReached)
|
||||||
{
|
{
|
||||||
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
||||||
|
attributes.dwFileAttributes = INVALID_FILE_ATTRIBUTES;
|
||||||
getFileAttributesExWithTimeout(path, &attributes, milliSec2wait, isTimeoutReached);
|
getFileAttributesExWithTimeout(path, &attributes, milliSec2wait, isTimeoutReached);
|
||||||
return (attributes.dwFileAttributes != INVALID_FILE_ATTRIBUTES);
|
return (attributes.dwFileAttributes != INVALID_FILE_ATTRIBUTES);
|
||||||
}
|
}
|
||||||
|
@ -283,8 +283,8 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
DWORD getDiskFreeSpaceWithTimeout(const wchar_t* dirPath, ULARGE_INTEGER* freeBytesForUser, DWORD milliSec2wait = 0, bool* isTimeoutReached = nullptr);
|
BOOL getDiskFreeSpaceWithTimeout(const wchar_t* dirPath, ULARGE_INTEGER* freeBytesForUser, DWORD milliSec2wait = 0, bool* isTimeoutReached = nullptr);
|
||||||
DWORD getFileAttributesExWithTimeout(const wchar_t* filePath, WIN32_FILE_ATTRIBUTE_DATA* fileAttr, DWORD milliSec2wait = 0, bool* isTimeoutReached = nullptr);
|
BOOL getFileAttributesExWithTimeout(const wchar_t* filePath, WIN32_FILE_ATTRIBUTE_DATA* fileAttr, DWORD milliSec2wait = 0, bool* isTimeoutReached = nullptr);
|
||||||
|
|
||||||
bool doesFileExist(const wchar_t* filePath, DWORD milliSec2wait = 0, bool* isTimeoutReached = nullptr);
|
bool doesFileExist(const wchar_t* filePath, DWORD milliSec2wait = 0, bool* isTimeoutReached = nullptr);
|
||||||
bool doesDirectoryExist(const wchar_t* dirPath, DWORD milliSec2wait = 0, bool* isTimeoutReached = nullptr);
|
bool doesDirectoryExist(const wchar_t* dirPath, DWORD milliSec2wait = 0, bool* isTimeoutReached = nullptr);
|
||||||
|
@ -31,6 +31,7 @@ Win32_IO_File::Win32_IO_File(const wchar_t *fname)
|
|||||||
_path = converter.to_bytes(fn);
|
_path = converter.to_bytes(fn);
|
||||||
|
|
||||||
WIN32_FILE_ATTRIBUTE_DATA attributes_original{};
|
WIN32_FILE_ATTRIBUTE_DATA attributes_original{};
|
||||||
|
attributes_original.dwFileAttributes = INVALID_FILE_ATTRIBUTES;
|
||||||
DWORD dispParam = CREATE_ALWAYS;
|
DWORD dispParam = CREATE_ALWAYS;
|
||||||
bool fileExists = false;
|
bool fileExists = false;
|
||||||
bool isTimeoutReached = false;
|
bool isTimeoutReached = false;
|
||||||
|
@ -1270,7 +1270,7 @@ bool NppParameters::load()
|
|||||||
if (doesFileExist(langs_xml_path.c_str()))
|
if (doesFileExist(langs_xml_path.c_str()))
|
||||||
{
|
{
|
||||||
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
||||||
|
attributes.dwFileAttributes = INVALID_FILE_ATTRIBUTES;
|
||||||
if (GetFileAttributesEx(langs_xml_path.c_str(), GetFileExInfoStandard, &attributes) != 0)
|
if (GetFileAttributesEx(langs_xml_path.c_str(), GetFileExInfoStandard, &attributes) != 0)
|
||||||
{
|
{
|
||||||
if (attributes.nFileSizeLow == 0 && attributes.nFileSizeHigh == 0)
|
if (attributes.nFileSizeLow == 0 && attributes.nFileSizeHigh == 0)
|
||||||
|
@ -142,7 +142,8 @@ void Buffer::updateTimeStamp()
|
|||||||
{
|
{
|
||||||
FILETIME timeStampLive {};
|
FILETIME timeStampLive {};
|
||||||
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
||||||
if (getFileAttributesExWithTimeout(_fullPathName.c_str(), &attributes) != FALSE)
|
attributes.dwFileAttributes = INVALID_FILE_ATTRIBUTES;
|
||||||
|
if (getFileAttributesExWithTimeout(_fullPathName.c_str(), &attributes))
|
||||||
{
|
{
|
||||||
timeStampLive = attributes.ftLastWriteTime;
|
timeStampLive = attributes.ftLastWriteTime;
|
||||||
}
|
}
|
||||||
@ -260,6 +261,7 @@ bool Buffer::checkFileState() // returns true if the status has been changed (it
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
||||||
|
attributes.dwFileAttributes = INVALID_FILE_ATTRIBUTES;
|
||||||
NppParameters& nppParam = NppParameters::getInstance();
|
NppParameters& nppParam = NppParameters::getInstance();
|
||||||
bool fileExists = doesFileExist(_fullPathName.c_str());
|
bool fileExists = doesFileExist(_fullPathName.c_str());
|
||||||
|
|
||||||
@ -311,7 +313,7 @@ bool Buffer::checkFileState() // returns true if the status has been changed (it
|
|||||||
isOK = true;
|
isOK = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (getFileAttributesExWithTimeout(_fullPathName.c_str(), &attributes) != FALSE)
|
else if (getFileAttributesExWithTimeout(_fullPathName.c_str(), &attributes))
|
||||||
{
|
{
|
||||||
int mask = 0; //status always 'changes', even if from modified to modified
|
int mask = 0; //status always 'changes', even if from modified to modified
|
||||||
bool isFileReadOnly = attributes.dwFileAttributes & FILE_ATTRIBUTE_READONLY;
|
bool isFileReadOnly = attributes.dwFileAttributes & FILE_ATTRIBUTE_READONLY;
|
||||||
@ -381,6 +383,7 @@ bool Buffer::checkFileState() // returns true if the status has been changed (it
|
|||||||
void Buffer::reload()
|
void Buffer::reload()
|
||||||
{
|
{
|
||||||
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
||||||
|
attributes.dwFileAttributes = INVALID_FILE_ATTRIBUTES;
|
||||||
if (GetFileAttributesEx(_fullPathName.c_str(), GetFileExInfoStandard, &attributes) != 0)
|
if (GetFileAttributesEx(_fullPathName.c_str(), GetFileExInfoStandard, &attributes) != 0)
|
||||||
{
|
{
|
||||||
_timeStamp = attributes.ftLastWriteTime;
|
_timeStamp = attributes.ftLastWriteTime;
|
||||||
@ -395,6 +398,7 @@ int64_t Buffer::getFileLength() const
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
||||||
|
attributes.dwFileAttributes = INVALID_FILE_ATTRIBUTES;
|
||||||
if (GetFileAttributesEx(_fullPathName.c_str(), GetFileExInfoStandard, &attributes) != 0)
|
if (GetFileAttributesEx(_fullPathName.c_str(), GetFileExInfoStandard, &attributes) != 0)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER size{};
|
LARGE_INTEGER size{};
|
||||||
@ -428,6 +432,7 @@ wstring Buffer::getTimeString(FILETIME rawtime) const
|
|||||||
wstring Buffer::getFileTime(fileTimeType ftt) const
|
wstring Buffer::getFileTime(fileTimeType ftt) const
|
||||||
{
|
{
|
||||||
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
||||||
|
attributes.dwFileAttributes = INVALID_FILE_ATTRIBUTES;
|
||||||
if (GetFileAttributesEx(_currentStatus == DOC_UNNAMED ? _backupFileName.c_str() : _fullPathName.c_str(), GetFileExInfoStandard, &attributes) != 0)
|
if (GetFileAttributesEx(_currentStatus == DOC_UNNAMED ? _backupFileName.c_str() : _fullPathName.c_str(), GetFileExInfoStandard, &attributes) != 0)
|
||||||
{
|
{
|
||||||
FILETIME rawtime;
|
FILETIME rawtime;
|
||||||
@ -710,7 +715,8 @@ BufferID FileManager::loadFile(const wchar_t* filename, Document doc, int encodi
|
|||||||
if (pPath)
|
if (pPath)
|
||||||
{
|
{
|
||||||
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
||||||
if (getFileAttributesExWithTimeout(pPath, &attributes) != FALSE)
|
attributes.dwFileAttributes = INVALID_FILE_ATTRIBUTES;
|
||||||
|
if (getFileAttributesExWithTimeout(pPath, &attributes))
|
||||||
{
|
{
|
||||||
LARGE_INTEGER size{};
|
LARGE_INTEGER size{};
|
||||||
size.LowPart = attributes.nFileSizeLow;
|
size.LowPart = attributes.nFileSizeLow;
|
||||||
@ -719,9 +725,21 @@ BufferID FileManager::loadFile(const wchar_t* filename, Document doc, int encodi
|
|||||||
fileSize = size.QuadPart;
|
fileSize = size.QuadPart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fileSize == -1)
|
||||||
|
{
|
||||||
|
// we cannot continue (or Scintilla will throw SC_STATUS_FAILURE in the loadFileData later)
|
||||||
|
NativeLangSpeaker* pNativeSpeaker = NppParameters::getInstance().getNativeLangSpeaker();
|
||||||
|
pNativeSpeaker->messageBox("FileToLoadSizeCheckFailed",
|
||||||
|
_pNotepadPlus->_pEditView->getHSelf(),
|
||||||
|
L"Cannot obtain the file size before loading!",
|
||||||
|
L"File to load size-check failed",
|
||||||
|
MB_OK | MB_APPLMODAL);
|
||||||
|
return BUFFER_INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
// * the auto-completion feature will be disabled for large files
|
// * the auto-completion feature will be disabled for large files
|
||||||
// * the session snapshotsand periodic backups feature will be disabled for large files
|
// * the session snapshots and periodic backups feature will be disabled for large files
|
||||||
// * the backups on save feature will be disabled for large files
|
// * the backups on save feature will be disabled for large files
|
||||||
const NppGUI& nppGui = NppParameters::getInstance().getNppGUI();
|
const NppGUI& nppGui = NppParameters::getInstance().getNppGUI();
|
||||||
bool isLargeFile = false;
|
bool isLargeFile = false;
|
||||||
@ -845,6 +863,7 @@ bool FileManager::reloadBuffer(BufferID id)
|
|||||||
//Get file size
|
//Get file size
|
||||||
int64_t fileSize = 0;
|
int64_t fileSize = 0;
|
||||||
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
||||||
|
attributes.dwFileAttributes = INVALID_FILE_ATTRIBUTES;
|
||||||
getFileAttributesExWithTimeout(buf->getFullPathName(), &attributes);
|
getFileAttributesExWithTimeout(buf->getFullPathName(), &attributes);
|
||||||
if (attributes.dwFileAttributes == INVALID_FILE_ATTRIBUTES)
|
if (attributes.dwFileAttributes == INVALID_FILE_ATTRIBUTES)
|
||||||
{
|
{
|
||||||
@ -1209,6 +1228,7 @@ SavingStatus FileManager::saveBuffer(BufferID id, const wchar_t* filename, bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
WIN32_FILE_ATTRIBUTE_DATA attributes{};
|
||||||
|
attributes.dwFileAttributes = INVALID_FILE_ATTRIBUTES;
|
||||||
getFileAttributesExWithTimeout(fullpath, &attributes);
|
getFileAttributesExWithTimeout(fullpath, &attributes);
|
||||||
if (attributes.dwFileAttributes != INVALID_FILE_ATTRIBUTES && !(attributes.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
|
if (attributes.dwFileAttributes != INVALID_FILE_ATTRIBUTES && !(attributes.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
|
||||||
{
|
{
|
||||||
|
@ -2,17 +2,21 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
BOOL CReadFileChanges::DetectChanges() {
|
BOOL CReadFileChanges::DetectChanges()
|
||||||
|
{
|
||||||
WIN32_FILE_ATTRIBUTE_DATA fInfo;
|
WIN32_FILE_ATTRIBUTE_DATA fInfo{};
|
||||||
|
fInfo.dwFileAttributes = INVALID_FILE_ATTRIBUTES;
|
||||||
BOOL rValue = FALSE;
|
BOOL rValue = FALSE;
|
||||||
|
|
||||||
::GetFileAttributesEx(_szFile, GetFileExInfoStandard, &fInfo);
|
::GetFileAttributesEx(_szFile, GetFileExInfoStandard, &fInfo);
|
||||||
|
|
||||||
if ((_dwNotifyFilter & FILE_NOTIFY_CHANGE_SIZE) && (fInfo.nFileSizeHigh != _lastFileInfo.nFileSizeHigh || fInfo.nFileSizeLow != _lastFileInfo.nFileSizeLow)) {
|
if ((_dwNotifyFilter & FILE_NOTIFY_CHANGE_SIZE) && (fInfo.nFileSizeHigh != _lastFileInfo.nFileSizeHigh || fInfo.nFileSizeLow != _lastFileInfo.nFileSizeLow))
|
||||||
|
{
|
||||||
rValue = TRUE;
|
rValue = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((_dwNotifyFilter & FILE_NOTIFY_CHANGE_LAST_WRITE) && (fInfo.ftLastWriteTime.dwHighDateTime != _lastFileInfo.ftLastWriteTime.dwHighDateTime || fInfo.ftLastWriteTime.dwLowDateTime != _lastFileInfo.ftLastWriteTime.dwLowDateTime)) {
|
if ((_dwNotifyFilter & FILE_NOTIFY_CHANGE_LAST_WRITE) && (fInfo.ftLastWriteTime.dwHighDateTime != _lastFileInfo.ftLastWriteTime.dwHighDateTime || fInfo.ftLastWriteTime.dwLowDateTime != _lastFileInfo.ftLastWriteTime.dwLowDateTime))
|
||||||
|
{
|
||||||
rValue = TRUE;
|
rValue = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,9 @@
|
|||||||
class CReadFileChanges
|
class CReadFileChanges
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CReadFileChanges() {};
|
CReadFileChanges() {
|
||||||
|
_lastFileInfo.dwFileAttributes = INVALID_FILE_ATTRIBUTES;
|
||||||
|
};
|
||||||
~CReadFileChanges() {};
|
~CReadFileChanges() {};
|
||||||
void AddFile(LPCTSTR szDirectory, DWORD dwNotifyFilter);
|
void AddFile(LPCTSTR szDirectory, DWORD dwNotifyFilter);
|
||||||
BOOL DetectChanges();
|
BOOL DetectChanges();
|
||||||
@ -24,6 +26,5 @@ private:
|
|||||||
LPCTSTR _szFile = nullptr;
|
LPCTSTR _szFile = nullptr;
|
||||||
DWORD _dwNotifyFilter = 0;
|
DWORD _dwNotifyFilter = 0;
|
||||||
WIN32_FILE_ATTRIBUTE_DATA _lastFileInfo = {};
|
WIN32_FILE_ATTRIBUTE_DATA _lastFileInfo = {};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user