Eterlogic Virtual Drive SDK documentation


COM interface

import "oaidl.idl";
import "ocidl.idl";


[
    object,
    uuid(84084091-bbc3-492c-95da-e6aa9672571c),
    dual,
    nonextensible,
    helpstring("IVirtualDrivesManager Interface"),
    pointer_default(unique)
]

// ========================================================================
// Main VDSDK interface
// ========================================================================
interface IVirtualDrivesManager : IDispatch{
    /*
    Initialize Virtual Drive SDK
    If driver is not running, it will be installed and started
    */
    [id(1), helpstring("method InitializeVDSDK")] HRESULT InitializeVDSDK([out, retval] BOOL* Result);

    /*
    Create virtual drive and register virtual drive callback handlers
    */
    [id(2), helpstring("method CreateVirtualDrive")] HRESULT CreateVirtualDrive([in] UCHAR DriveLetter,[in] ULONG DriveSize,[in] IUnknown* Implementation, [out,retval] LONG* Handle);

    /*
    Destroy virtual drive by drive handle
    */
    [id(3), helpstring("method DestroyVirtualDrive")] HRESULT DestroyVirtualDrive([in] LONG Handle, [in] BOOL Force, [out, retval] BOOL* Result);

    /*
    Uninitialize Virtual Drive SDK
    */
    [id(4), helpstring("method ShutdownVDSDK")] HRESULT ShutdownVDSDK([in] BOOL ForceUnmountDisks);

    /*
    Install kernel driver service
    */
    [id(5), helpstring("method InstallDriver")] HRESULT InstallDriver([out, retval] BOOL* Result);

    /*
    Start kernel driver service
    */
    [id(6), helpstring("method StartDriver")] HRESULT StartDriver([out, retval] BOOL* Result);

    /*
    Stop kernel driver service
    */
    [id(7), helpstring("method StopDriver")] HRESULT StopDriver([out, retval] BOOL* Result);

    /*
    Uninstall kernel driver service
    */
    [id(8), helpstring("method UninstallDriver")] HRESULT UninstallDriver([out, retval] BOOL* Result);

    /*
    Query whether kernel driver is started
    */
    [id(9), helpstring("method IsDriverReady")] HRESULT IsDriverReady([out, retval] BOOL* Result);

    /*
    Check whether drive handle is valid
    */
    [id(10), helpstring("method IsValidHandle")] HRESULT IsValidHandle([in] LONG Handle, [out, retval] BOOL* Result);

    /*
    Obtain kernel driver version
    */
    [id(11), helpstring("method GetVDSDKDriverVersion")] HRESULT GetVDSDKDriverVersion([out] LONG* major,[out] LONG* minor,[out, retval] BOOL* Result);

    /*
    Activate VDSDK
    */
    [id(12), helpstring("method ActivateVDSDK")] HRESULT ActivateVDSDK([in] BSTR ActivationKey, [out, retval] BOOL* Result);

    /*
    Create virtual drive and register virtual drive callback handlers
    */
    [id(13), helpstring("method CreateVirtualDriveEx")] HRESULT CreateVirtualDriveEx([in] UCHAR DriveLetter,[in] ULONG DriveSize,[in] IUnknown* Implementation, [in] BOOL ReadOnly, [in] ULONG DriveFlags, [out,retval] LONG* Handle);

    /*
    Format virtual drive
    CallbackHandler: IVirtualDriveFormatCallbackHandler. Can be NULL.
    */
    [id(14), helpstring("method FormatVirtualDrive")] HRESULT FormatVirtualDrive([in] LONG Handle, [in] BOOL QuickFormat, [in] BSTR FileSystem, [in] BSTR VolumeLabel, [in] IUnknown* CallbackHandler, [out, retval] BOOL* Result);

    /*
    Register VDSDK notifications handler
    NotificationHandler: IVDSDKNotificationHandler. Can be NULL.
    */
    [id(15), helpstring("method RegisterNotificationHandler")] HRESULT RegisterNotificationHandler([in] IUnknown* NotificationHandler);
};



[
    uuid(aaadcf2c-39ae-4faa-bfc7-7b83d02ebc4f),
    version(1.0),
    helpstring("VDSDK 1.0 Type Library")
]
library VDSDKLib
{
    // ========================================================================
    // IVirtualDriveHandler : handler that uses VARIANTs
    // ========================================================================
    [
        uuid(7596d3ec-bf7c-42ca-a57f-596db0c23c60),
        helpstring("IVirtualDriveHandler Interface for script languages")
    ]
    interface IVirtualDriveHandler : IDispatch
    {
        /*
        ReadData callback handler
        */
        [id(1), helpstring("method OnReadData")] HRESULT OnReadData(
            [in] VARIANT Offset, 
            [in] ULONG BufferSize, 
            [in, out] VARIANT *Buffer, 
            [out, retval] ULONG *BytesRead);

        /*
        WriteData callback handler
        */
        [id(2), helpstring("method OnWriteData")] HRESULT OnWriteData(
            [in] VARIANT Offset, 
            [in] ULONG BufferSize, 
            [in] VARIANT Buffer, 
            [out, retval] ULONG *BytesWritten);
    };


    // ========================================================================
    // IVirtualDriveHandler2 : handler that uses SAFEARRAYs
    // ========================================================================
    [
        uuid(0aa6a8b4-5a0f-497b-8f14-407023ccc9d6),
        helpstring("IVirtualDriveHandler2 Interface for script languages")
    ]

    interface IVirtualDriveHandler2 : IDispatch
    {
        /*
        ReadData callback handler
        */
        [id(1), helpstring("method OnReadData")] HRESULT OnReadData(
            [in] ULONGLONG Offset, 
            [in] ULONG BufferSize, 
            [out] SAFEARRAY(byte)* Buffer,
            [out, retval] ULONG *BytesRead);

        /*
        WriteData callback handler
        */
        [id(2), helpstring("method OnWriteData")] HRESULT OnWriteData(
            [in] ULONGLONG Offset, 
            [in] ULONG BufferSize, 
            [in] SAFEARRAY(byte)* Buffer,
            [out, retval] ULONG *BytesWritten);
    };


    // ========================================================================
    // IVirtualDriveHandler : handler that uses raw pointers (the fastest)
    // ========================================================================
    [
        uuid(5dd3c95a-5514-4502-a4e8-e06c333556a7),
        helpstring("IVirtualDriveHandler3 Interface")
    ]

    interface IVirtualDriveHandler3 : IDispatch
    {
        /*
        ReadData callback handler
        */
        [id(1), helpstring("method OnReadData")] HRESULT OnReadData(
            [in] ULONGLONG Offset, 
            [in] ULONG BufferSize, 
            [in, out, size_is(BufferSize)] UCHAR Buffer[*],
            [out, retval] ULONG *BytesRead);

        /*
        WriteData callback handler
        */
        [id(2), helpstring("method OnWriteData")] HRESULT OnWriteData(
            [in] ULONGLONG Offset, 
            [in] ULONG BufferSize, 
            [in, size_is(BufferSize)] UCHAR Buffer[*],
            [out, retval] ULONG *BytesWritten);
    };


    // ========================================================================
    // IVirtualDriveFormatCallbackHandler : format callback handler
    // ========================================================================
    [
        uuid(27bce9ae-3593-48a1-8eef-28ee10ac24a1),
        helpstring("IVirtualDriveFormatCallbackHandler format callback support")
    ]
    interface IVirtualDriveFormatCallbackHandler : IDispatch
    {
        /*
        Progress: Progress in percents
        */
        [id(1), helpstring("method OnFormatCallback")] HRESULT OnFormatCallback([in] ULONG Progress);

    };


    // ========================================================================
    // IVDSDKNotificationHandler : VDSDK notification handler
    // ========================================================================
    [
        uuid(509bb6a4-3b4c-48eb-8f55-2c6591bb9f6a),
        helpstring("IVDSDKNotificationHandler: notifications handler")
    ]
    interface IVDSDKNotificationHandler : IDispatch
    {
        [id(1), helpstring("method OnVDSDK_Notification")] HRESULT OnVDSDK_Notification([in] LONG DriveHandle, [in] ULONG NotificationCode, [in] ULONG Reserved, [out, retval] BOOL *Result);
    };



    // enumerations
    enum eDriveFlags
    {
        DRIVE_FLAG_REMOVABLE = 1,
        DRIVE_FLAG_CDROM = 2,
        DRIVE_FLAG_FLOPPY = 4,
    };

    // VDSDK notifications
    enum eVDSDKNotifications
    {
        VDSDK_OnUnmountRemovableMedia = 0,
        VDSDK_OnUnmountedDrive = 1,
    };


    // ========================================================================
    // Interface implementations
    // ========================================================================

    [
        uuid(cac8aa14-138f-496c-a05a-db470c27af18),
        helpstring("VirtualDrivesManager Class")
    ]
    coclass VirtualDrivesManager
    {
        [default] interface IVirtualDrivesManager;
    };

};

(C) 2008-2009 Eterlogic.com. All rights reserved.