1
0

More Dokan changes

This commit is contained in:
Scott E. Graves
2017-02-10 17:16:09 -06:00
parent 25bb8b7cc9
commit 01453d0006
3 changed files with 40 additions and 6 deletions

View File

@@ -6,7 +6,13 @@
using namespace Sia::Api; using namespace Sia::Api;
using namespace Sia::Api::Dokan; using namespace Sia::Api::Dokan;
static NTSTATUS DOKAN_CALLBACK _ZwCreateFile(
static bool s_dokenInitialized = false;
static CSiaDokenDrive* s_dokenDrive = nullptr;
static DOKAN_OPERATIONS s_dokanOps = {0};
static NTSTATUS DOKAN_CALLBACK SiaDrive_ZwCreateFile(
LPCWSTR FileName, LPCWSTR FileName,
PDOKAN_IO_SECURITY_CONTEXT SecurityContext, PDOKAN_IO_SECURITY_CONTEXT SecurityContext,
ACCESS_MASK DesiredAccess, ACCESS_MASK DesiredAccess,
@@ -18,16 +24,31 @@ static NTSTATUS DOKAN_CALLBACK _ZwCreateFile(
{ {
} }
CSiaDokenDrive::CSiaDokenDrive(CSiaApi& siaApi) : CSiaDokenDrive::CSiaDokenDrive(CSiaApi& siaApi) :
_siaApi(siaApi) _siaApi(siaApi)
{ {
if (s_dokenDrive)
{
throw SiaDokenDriveException("Sia drive has already been activated");
}
else
{
s_dokenDrive = this;
s_dokanOps.ZwCreateFile = SiaDrive_ZwCreateFile;
}
} }
CSiaDokenDrive::~CSiaDokenDrive() CSiaDokenDrive::~CSiaDokenDrive()
{ {
Unmount();
s_dokenDrive = nullptr;
} }
void CSiaDokenDrive::InitializeOperations() void CSiaDokenDrive::Mount(const wchar_t& driveLetter)
{
}
void CSiaDokenDrive::Unmount()
{ {
} }

View File

@@ -5,9 +5,21 @@ NS_BEGIN(Sia)
NS_BEGIN(Api) NS_BEGIN(Api)
NS_BEGIN(Dokan) NS_BEGIN(Dokan)
class SiaDokenDriveException :
std::exception
{
public:
SiaDokenDriveException(char* message) :
std::exception(message)
{
}
};
class AFX_EXT_CLASS CSiaDokenDrive class AFX_EXT_CLASS CSiaDokenDrive
{ {
public: public:
// throws SiaDokenDriveException
CSiaDokenDrive(CSiaApi& siaApi); CSiaDokenDrive(CSiaApi& siaApi);
public: public:
@@ -16,8 +28,10 @@ public:
private: private:
CSiaApi& _siaApi; CSiaApi& _siaApi;
private: public:
void InitializeOperations(); void Mount(const wchar_t& driveLetter);
void Unmount( );
}; };
NS_END(3) NS_END(3)

View File

@@ -7,7 +7,6 @@
#ifndef VC_EXTRALEAN #ifndef VC_EXTRALEAN
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#endif #endif
#include "targetver.h" #include "targetver.h"
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit