1
0

Implement EventLevel

This commit is contained in:
Scott E. Graves
2017-04-05 12:31:39 -05:00
parent 03f93c087c
commit 444c137203
3 changed files with 29 additions and 15 deletions

View File

@@ -154,6 +154,7 @@ class SIADRIVE_DOKAN_EXPORTABLE DokanCreateFile :
{ {
public: public:
DokanCreateFile(const SString& filePath, const DWORD& fileAttributesAndFlags, const DWORD& creationDisposition, const ACCESS_MASK& genericDesiredAccess, const NTSTATUS& returnStatus) : DokanCreateFile(const SString& filePath, const DWORD& fileAttributesAndFlags, const DWORD& creationDisposition, const ACCESS_MASK& genericDesiredAccess, const NTSTATUS& returnStatus) :
CEvent(EventLevel::Debug),
_filePath(filePath), _filePath(filePath),
_fileAttributesAndFlags(fileAttributesAndFlags), _fileAttributesAndFlags(fileAttributesAndFlags),
_creationDisposition(creationDisposition), _creationDisposition(creationDisposition),
@@ -197,6 +198,7 @@ class SIADRIVE_DOKAN_EXPORTABLE DokanFindFiles :
{ {
public: public:
DokanFindFiles(const SString& cachePath, const SString& rootPath, const SString& siaQuery, const SString& findFile, const SString& fileName) : DokanFindFiles(const SString& cachePath, const SString& rootPath, const SString& siaQuery, const SString& findFile, const SString& fileName) :
CEvent(EventLevel::Debug),
_cachePath(cachePath), _cachePath(cachePath),
_rootPath(rootPath), _rootPath(rootPath),
_siaQuery(siaQuery), _siaQuery(siaQuery),
@@ -233,12 +235,12 @@ public:
} }
}; };
class SIADRIVE_DOKAN_EXPORTABLE DokanCloseFile : class SIADRIVE_DOKAN_EXPORTABLE DokanCloseFile :
public CEvent public CEvent
{ {
public: public:
DokanCloseFile(const SString& cachePath) : DokanCloseFile(const SString& cachePath) :
CEvent(EventLevel::Debug),
_cachePath(cachePath) _cachePath(cachePath)
{ {
} }
@@ -269,6 +271,7 @@ class SIADRIVE_DOKAN_EXPORTABLE DokanGetFileInformation :
{ {
public: public:
DokanGetFileInformation(const SString& cachePath, const SString& fileName, const NTSTATUS& result) : DokanGetFileInformation(const SString& cachePath, const SString& fileName, const NTSTATUS& result) :
CEvent(EventLevel::Debug),
_cachePath(cachePath), _cachePath(cachePath),
_fileName(fileName), _fileName(fileName),
_result(result) _result(result)
@@ -303,6 +306,7 @@ class SIADRIVE_DOKAN_EXPORTABLE DokanReadFile :
{ {
public: public:
DokanReadFile(const SString& cachePath) : DokanReadFile(const SString& cachePath) :
CEvent(EventLevel::Debug),
_cachePath(cachePath) _cachePath(cachePath)
{ {
} }
@@ -333,6 +337,7 @@ class SIADRIVE_DOKAN_EXPORTABLE DokanWriteFile :
{ {
public: public:
DokanWriteFile(const SString& cachePath) : DokanWriteFile(const SString& cachePath) :
CEvent(EventLevel::Debug),
_cachePath(cachePath) _cachePath(cachePath)
{ {
} }
@@ -363,6 +368,7 @@ class SIADRIVE_DOKAN_EXPORTABLE DokanSetEndOfFile :
{ {
public: public:
DokanSetEndOfFile(const SString& cachePath) : DokanSetEndOfFile(const SString& cachePath) :
CEvent(EventLevel::Debug),
_cachePath(cachePath) _cachePath(cachePath)
{ {
} }
@@ -393,6 +399,7 @@ class SIADRIVE_DOKAN_EXPORTABLE DokanFlushFileBuffers :
{ {
public: public:
DokanFlushFileBuffers(const SString& cachePath) : DokanFlushFileBuffers(const SString& cachePath) :
CEvent(EventLevel::Debug),
_cachePath(cachePath) _cachePath(cachePath)
{ {
} }
@@ -453,6 +460,7 @@ class SIADRIVE_DOKAN_EXPORTABLE DokanDeleteFileW :
{ {
public: public:
DokanDeleteFileW(const SString& cachePath) : DokanDeleteFileW(const SString& cachePath) :
CEvent(EventLevel::Debug),
_cachePath(cachePath) _cachePath(cachePath)
{ {
} }
@@ -483,6 +491,7 @@ class SIADRIVE_DOKAN_EXPORTABLE DokanSetFileAttributesW :
{ {
public: public:
DokanSetFileAttributesW(const SString& cachePath) : DokanSetFileAttributesW(const SString& cachePath) :
CEvent(EventLevel::Debug),
_cachePath(cachePath) _cachePath(cachePath)
{ {
} }
@@ -513,6 +522,7 @@ class SIADRIVE_DOKAN_EXPORTABLE DokanGetFileAttributesW :
{ {
public: public:
DokanGetFileAttributesW(const SString& cachePath) : DokanGetFileAttributesW(const SString& cachePath) :
CEvent(EventLevel::Debug),
_cachePath(cachePath) _cachePath(cachePath)
{ {
} }
@@ -543,6 +553,7 @@ class SIADRIVE_DOKAN_EXPORTABLE DokanSetFileSecurityW :
{ {
public: public:
DokanSetFileSecurityW(const SString& cachePath) : DokanSetFileSecurityW(const SString& cachePath) :
CEvent(EventLevel::Debug),
_cachePath(cachePath) _cachePath(cachePath)
{ {
} }
@@ -573,6 +584,7 @@ class SIADRIVE_DOKAN_EXPORTABLE DokanSetFileTime :
{ {
public: public:
DokanSetFileTime(const SString& cachePath) : DokanSetFileTime(const SString& cachePath) :
CEvent(EventLevel::Debug),
_cachePath(cachePath) _cachePath(cachePath)
{ {
} }
@@ -603,6 +615,7 @@ class SIADRIVE_DOKAN_EXPORTABLE DokanSetAllocationSize :
{ {
public: public:
DokanSetAllocationSize(const SString& cachePath) : DokanSetAllocationSize(const SString& cachePath) :
CEvent(EventLevel::Debug),
_cachePath(cachePath) _cachePath(cachePath)
{ {
} }
@@ -633,6 +646,7 @@ class SIADRIVE_DOKAN_EXPORTABLE DokanMoveFileW :
{ {
public: public:
DokanMoveFileW(const SString& srcPath, const SString& destPath) : DokanMoveFileW(const SString& srcPath, const SString& destPath) :
CEvent(EventLevel::Debug),
_srcPath(srcPath), _srcPath(srcPath),
_destPath(destPath) _destPath(destPath)
{ {

View File

@@ -23,7 +23,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
CDebugConsumer debugConsumer; CDebugConsumer debugConsumer;
CLoggingConsumer loggingConsumer(EventLevel::Debug); CLoggingConsumer loggingConsumer(EventLevel::Debug);
#else #else
CLoggingConsumer loggingConsumer(EventLevel::Release); CLoggingConsumer loggingConsumer(EventLevel::Normal);
#endif #endif
CEventSystem::EventSystem.Start(); CEventSystem::EventSystem.Start();
CefEnableHighDPISupport(); CefEnableHighDPISupport();

View File

@@ -119,7 +119,7 @@ private:
static void HandleSiaFileClose(const OpenFileInfo& openFileInfo, const std::uint64_t& fileSize, const bool& deleteOnClose) static void HandleSiaFileClose(const OpenFileInfo& openFileInfo, const std::uint64_t& fileSize, const bool& deleteOnClose)
{ {
//CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanCloseFile(openFileInfo.CacheFilePath))); CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanCloseFile(openFileInfo.CacheFilePath)));
if (deleteOnClose) if (deleteOnClose)
{ {
// TODO Handle failure // TODO Handle failure
@@ -763,7 +763,7 @@ private:
PDOKAN_FILE_INFO dokanFileInfo) PDOKAN_FILE_INFO dokanFileInfo)
{ {
FilePath filePath(GetCacheLocation(), fileName); FilePath filePath(GetCacheLocation(), fileName);
//CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanReadFile(filePath))); CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanReadFile(filePath)));
auto openFileInfo = reinterpret_cast<OpenFileInfo*>(dokanFileInfo->Context); auto openFileInfo = reinterpret_cast<OpenFileInfo*>(dokanFileInfo->Context);
if (openFileInfo && openFileInfo->Dummy) if (openFileInfo && openFileInfo->Dummy)
@@ -821,7 +821,7 @@ private:
{ {
// TODO Check dummy and add to cache if not found // TODO Check dummy and add to cache if not found
FilePath filePath(GetCacheLocation(), fileName); FilePath filePath(GetCacheLocation(), fileName);
//CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanWriteFile(filePath))); CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanWriteFile(filePath)));
auto openFileInfo = reinterpret_cast<OpenFileInfo*>(dokanFileInfo->Context); auto openFileInfo = reinterpret_cast<OpenFileInfo*>(dokanFileInfo->Context);
BOOL opened = FALSE; BOOL opened = FALSE;
@@ -931,7 +931,7 @@ private:
// TODO Check dummy and add to cache if not found // TODO Check dummy and add to cache if not found
FilePath filePath(GetCacheLocation(), fileName); FilePath filePath(GetCacheLocation(), fileName);
//CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanSetEndOfFile(filePath))); CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanSetEndOfFile(filePath)));
auto openFileInfo = reinterpret_cast<OpenFileInfo*>(dokanFileInfo->Context); auto openFileInfo = reinterpret_cast<OpenFileInfo*>(dokanFileInfo->Context);
if (!openFileInfo || !openFileInfo->FileHandle || (openFileInfo->FileHandle == INVALID_HANDLE_VALUE)) if (!openFileInfo || !openFileInfo->FileHandle || (openFileInfo->FileHandle == INVALID_HANDLE_VALUE))
@@ -1011,7 +1011,7 @@ private:
static NTSTATUS DOKAN_CALLBACK Sia_FlushFileBuffers(LPCWSTR fileName, PDOKAN_FILE_INFO dokanFileInfo) static NTSTATUS DOKAN_CALLBACK Sia_FlushFileBuffers(LPCWSTR fileName, PDOKAN_FILE_INFO dokanFileInfo)
{ {
FilePath filePath(GetCacheLocation(), fileName); FilePath filePath(GetCacheLocation(), fileName);
//CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanFlushFileBuffers(filePath))); CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanFlushFileBuffers(filePath)));
auto openFileInfo = reinterpret_cast<OpenFileInfo*>(dokanFileInfo->Context); auto openFileInfo = reinterpret_cast<OpenFileInfo*>(dokanFileInfo->Context);
if (!openFileInfo || !openFileInfo->FileHandle || (openFileInfo->FileHandle == INVALID_HANDLE_VALUE)) if (!openFileInfo || !openFileInfo->FileHandle || (openFileInfo->FileHandle == INVALID_HANDLE_VALUE))
@@ -1033,7 +1033,7 @@ private:
static NTSTATUS DOKAN_CALLBACK Sia_DeleteDirectory(LPCWSTR fileName, PDOKAN_FILE_INFO dokanFileInfo) static NTSTATUS DOKAN_CALLBACK Sia_DeleteDirectory(LPCWSTR fileName, PDOKAN_FILE_INFO dokanFileInfo)
{ {
FilePath filePath = FilePath(GetCacheLocation(), fileName); FilePath filePath = FilePath(GetCacheLocation(), fileName);
//CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanDeleteDirectory(filePath))); CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanDeleteDirectory(filePath)));
NTSTATUS ret = STATUS_SUCCESS; NTSTATUS ret = STATUS_SUCCESS;
if (dokanFileInfo->DeleteOnClose) if (dokanFileInfo->DeleteOnClose)
@@ -1080,7 +1080,7 @@ private:
auto openFileInfo = reinterpret_cast<OpenFileInfo*>(dokanFileInfo->Context); auto openFileInfo = reinterpret_cast<OpenFileInfo*>(dokanFileInfo->Context);
FilePath filePath(GetCacheLocation(), fileName); FilePath filePath(GetCacheLocation(), fileName);
//CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanDeleteFileW(filePath))); CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanDeleteFileW(filePath)));
DWORD dwAttrib = ::GetFileAttributes(&filePath[0]); DWORD dwAttrib = ::GetFileAttributes(&filePath[0]);
if ((dwAttrib != INVALID_FILE_ATTRIBUTES) && (dwAttrib & FILE_ATTRIBUTE_DIRECTORY)) if ((dwAttrib != INVALID_FILE_ATTRIBUTES) && (dwAttrib & FILE_ATTRIBUTE_DIRECTORY))
@@ -1107,7 +1107,7 @@ private:
FilePath filePath(GetCacheLocation(), fileName); FilePath filePath(GetCacheLocation(), fileName);
FilePath newFilePath(GetCacheLocation(), NewFileName); FilePath newFilePath(GetCacheLocation(), NewFileName);
//CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanMoveFileW(filePath, newFilePath))); CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanMoveFileW(filePath, newFilePath)));
auto openFileInfo = reinterpret_cast<OpenFileInfo*>(dokanFileInfo->Context); auto openFileInfo = reinterpret_cast<OpenFileInfo*>(dokanFileInfo->Context);
if (!openFileInfo || !openFileInfo->FileHandle || (openFileInfo->FileHandle == INVALID_HANDLE_VALUE)) if (!openFileInfo || !openFileInfo->FileHandle || (openFileInfo->FileHandle == INVALID_HANDLE_VALUE))
@@ -1154,7 +1154,7 @@ private:
NTSTATUS ret = STATUS_SUCCESS; NTSTATUS ret = STATUS_SUCCESS;
FilePath filePath(GetCacheLocation(), fileName); FilePath filePath(GetCacheLocation(), fileName);
//CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanSetFileAttributesW(filePath))); CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanSetFileAttributesW(filePath)));
if (!::SetFileAttributes(&filePath[0], fileAttributes)) if (!::SetFileAttributes(&filePath[0], fileAttributes))
{ {
@@ -1172,7 +1172,7 @@ private:
{ {
UNREFERENCED_PARAMETER(dokanFileInfo); UNREFERENCED_PARAMETER(dokanFileInfo);
FilePath filePath(GetCacheLocation(), fileName); FilePath filePath(GetCacheLocation(), fileName);
//CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanGetFileAttributesW(filePath))); CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanGetFileAttributesW(filePath)));
SECURITY_INFORMATION requestingSaclInfo = ((*securityInfo & SACL_SECURITY_INFORMATION) || (*securityInfo & BACKUP_SECURITY_INFORMATION)); SECURITY_INFORMATION requestingSaclInfo = ((*securityInfo & SACL_SECURITY_INFORMATION) || (*securityInfo & BACKUP_SECURITY_INFORMATION));
//if (!g_HasSeSecurityPrivilege) { //if (!g_HasSeSecurityPrivilege) {
@@ -1223,7 +1223,7 @@ private:
UNREFERENCED_PARAMETER(securityDescriptorLength); UNREFERENCED_PARAMETER(securityDescriptorLength);
FilePath filePath(GetCacheLocation(), fileName); FilePath filePath(GetCacheLocation(), fileName);
//CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanSetFileSecurityW(filePath))); CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanSetFileSecurityW(filePath)));
auto openFileInfo = reinterpret_cast<OpenFileInfo*>(dokanFileInfo->Context); auto openFileInfo = reinterpret_cast<OpenFileInfo*>(dokanFileInfo->Context);
if (!openFileInfo || !openFileInfo->FileHandle || (openFileInfo->FileHandle == INVALID_HANDLE_VALUE)) if (!openFileInfo || !openFileInfo->FileHandle || (openFileInfo->FileHandle == INVALID_HANDLE_VALUE))
@@ -1245,7 +1245,7 @@ private:
PDOKAN_FILE_INFO dokanFileInfo) PDOKAN_FILE_INFO dokanFileInfo)
{ {
FilePath filePath(GetCacheLocation(), fileName); FilePath filePath(GetCacheLocation(), fileName);
//CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanSetFileTime(filePath))); CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanSetFileTime(filePath)));
auto openFileInfo = reinterpret_cast<OpenFileInfo*>(dokanFileInfo->Context); auto openFileInfo = reinterpret_cast<OpenFileInfo*>(dokanFileInfo->Context);
if (!openFileInfo || !openFileInfo->FileHandle || (openFileInfo->FileHandle == INVALID_HANDLE_VALUE)) if (!openFileInfo || !openFileInfo->FileHandle || (openFileInfo->FileHandle == INVALID_HANDLE_VALUE))
@@ -1267,7 +1267,7 @@ private:
// TODO Check dummy and add to cache if not found // TODO Check dummy and add to cache if not found
NTSTATUS ret = STATUS_SUCCESS; NTSTATUS ret = STATUS_SUCCESS;
FilePath filePath(GetCacheLocation(), fileName); FilePath filePath(GetCacheLocation(), fileName);
//CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanSetAllocationSize(filePath))); CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanSetAllocationSize(filePath)));
auto openFileInfo = reinterpret_cast<OpenFileInfo*>(dokanFileInfo->Context); auto openFileInfo = reinterpret_cast<OpenFileInfo*>(dokanFileInfo->Context);
if (!openFileInfo || !openFileInfo->FileHandle || (openFileInfo->FileHandle == INVALID_HANDLE_VALUE)) if (!openFileInfo || !openFileInfo->FileHandle || (openFileInfo->FileHandle == INVALID_HANDLE_VALUE))