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::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,
PDOKAN_IO_SECURITY_CONTEXT SecurityContext,
ACCESS_MASK DesiredAccess,
@@ -18,16 +24,31 @@ static NTSTATUS DOKAN_CALLBACK _ZwCreateFile(
{
}
CSiaDokenDrive::CSiaDokenDrive(CSiaApi& 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()
{
Unmount();
s_dokenDrive = nullptr;
}
void CSiaDokenDrive::InitializeOperations()
void CSiaDokenDrive::Mount(const wchar_t& driveLetter)
{
}
void CSiaDokenDrive::Unmount()
{
}

View File

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

View File

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