⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vdsdkdll.h

📁 Eterlogic公司所提供免费的虚拟磁盘SDK
💻 H
字号:
#ifndef _VSDK_DLL_H_
#define _VSDK_DLL_H_

#include <windows.h>

#ifdef VSDK_DLL_EXPORTS
#define VDSDK_API extern "C" _declspec(dllexport)
#else
#define VDSDK_API extern "C" _declspec(dllimport)
#endif


typedef long DRIVE_HANDLE;
#define INVALID_DRIVE_HANDLE -1

// -------------------------------------------
// Callback handlers definitions
// -------------------------------------------

/*
Read callback typedef
@param h drive handle
@param ReadOffset read data offset
@param ReadSize size of data to read
@param ReadBuffer pointer to the destination buffer
@param BytesRead actually read bytes count
@return result
*/
typedef BOOL (_stdcall *ON_READ_CALLBACK)(
    DRIVE_HANDLE h,
    ULONGLONG ReadOffset,
    ULONG ReadSize,
    void* ReadBuffer,
    ULONG *BytesRead
    );

/*
Write callback typedef
@param h drive handle
@param Writeffset write data offset
@param WriteSize size of data to write
@param WriteBuffer pointer to the destination buffer
@param BytesWritten actually written bytes count
@return  result
*/
typedef BOOL (_stdcall *ON_WRITE_CALLBACK)(
    DRIVE_HANDLE h,
    ULONGLONG WriteOffset,
    ULONG WriteSize,
    const void* WriteBuffer,
    ULONG *BytesWritten
    );


// -------------------------------------------
// General purpose API functions
// -------------------------------------------

/*
Initialize Virtual Drive SDK
If driver is not running, it will be installed and started
@return result
*/
VDSDK_API
BOOL
InitializeVDSDK();


/*
Uninitialize Virtual Drive SDK
@param bForceUnmountDisks forcibly dismount disks if they are used
*/
VDSDK_API
void
ShutdownVDSDK(BOOL bForceUnmountDisks);


/*
Create virtual drive and register virtual drive callback handlers
@param DriveLetter drive letter (e.g. 'X')
@param DriveSize drive size, MB
@param pReadCallback pointer to read callback handler
@param pWriteCallback pointer to write callback handler
@return drive handle
*/
VDSDK_API
DRIVE_HANDLE
CreateVirtualDrive(
           char DriveLetter,
           ULONG DriveSize,
           ON_READ_CALLBACK pReadCallback,
           ON_WRITE_CALLBACK pWriteCallback
           );

/*
Destroy virtual drive by drive handle
@param h drive handle
@param bForce force dismount disk in case it is used
@return result
*/
VDSDK_API
BOOL
DestroyVirtualDrive(DRIVE_HANDLE h, BOOL bForce);


/*
Get error code.
Error codes are defined in VDSDKErrors.h
@return result
*/
VDSDK_API
int
GetVDSDKErrorCode();


// -------------------------------------------
// Additional kernel driver control functions
// -------------------------------------------

/*
Install kernel driver service
@return result
*/
VDSDK_API
BOOL
InstallDriver();


/*
Start kernel driver service
@return result
*/
VDSDK_API
BOOL
StartDriver();

/*
Stop kernel driver service
@return result
*/
VDSDK_API
BOOL
StopDriver();

/*
Uninstall kernel driver service
@return result
*/
VDSDK_API
BOOL
UninstallDriver();

/*
Query is kernel driver running
@return result
*/
VDSDK_API
BOOL
IsDriverReady();

/*
Obtain kernel driver version
@param major (reference) Major version
@param minor (reference) Minor version
@return result
*/
VDSDK_API
BOOL
GetVDSDKDriverVersion(int &major, int &minor);


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -