Sample Code

Windows Driver Samples/ Windows Image Acquisition (WIA) Driver Samples/ C++/ idl/ wiamindr_lh.idl/

/****************************************************************************
*
*  (C) COPYRIGHT 1998-2000, MICROSOFT CORP.
*
*  FILE:        wiamindr_lh.idl
*
*  VERSION:     2.0
*
*  DATE:        8/28/1998
*
*  DESCRIPTION:
*    IDL source for the WIA mini driver.
*
*****************************************************************************/

cpp_quote("#include <winapifamily.h>")

#pragma region Desktop Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)")

interface IWiaMiniDrv;
interface IWiaMiniDrvCallBack;
interface IWiaMiniDrvTransferCallBack;
interface IWiaDrvItem;
interface IWiaItem;
interface IWiaPropertyStorage;

import "unknwn.idl";
import "oaidl.idl";
import "propidl.idl";
import "wia_lh.idl";

midl_pragma warning( disable: 2495 )

/**************************************************************************\
*
* MINIDRV_TRANSFER_CONTEXT - Minidriver data transfer context
*
\**************************************************************************/

typedef struct _MINIDRV_TRANSFER_CONTEXT{
    LONG                 lSize;
    LONG                 lWidthInPixels;
    LONG                 lLines;
    LONG                 lDepth;
    LONG                 lXRes;
    LONG                 lYRes;
    LONG                 lCompression;
    GUID                 guidFormatID;
    LONG                 tymed;
    LONG_PTR             hFile;
    LONG                 cbOffset;
    LONG                 lBufferSize;
    LONG                 lActiveBuffer;
    LONG                 lNumBuffers;
    BYTE                 *pBaseBuffer;
    BYTE                 *pTransferBuffer;
    BOOL                 bTransferDataCB;
    BOOL                 bClassDrvAllocBuf;
    LONG_PTR             lClientAddress;
    IWiaMiniDrvCallBack  *pIWiaMiniDrvCallBack;
    LONG                 lImageSize;
    LONG                 lHeaderSize;
    LONG                 lItemSize;
    LONG                 cbWidthInBytes;
    LONG                 lPage;
    LONG                 lCurIfdOffset;
    LONG                 lPrevIfdOffset;

} MINIDRV_TRANSFER_CONTEXT, *PMINIDRV_TRANSFER_CONTEXT;


/*******************************************************************************
*
*  WIA_DEV_CAP_DRV - Device capabilities
*
*******************************************************************************/

typedef struct _WIA_DEV_CAP_DRV {
        GUID                *guid;
        ULONG               ulFlags;
        LPOLESTR            wszName;
        LPOLESTR            wszDescription;
        LPOLESTR            wszIcon;
} WIA_DEV_CAP_DRV,*PWIA_DEV_CAP_DRV;


/*******************************************************************************
*
* IWiaMiniDrvItem interface
*
*******************************************************************************/

[
    object,
    uuid(d8cdee14-3c6c-11d2-9a35-00c04fa36145),
    helpstring("WIA Mini Driver Interface"),
    pointer_default(unique)
]

interface IWiaMiniDrv : IUnknown
{
    [helpstring("Initialize WIA, build item tree, etc")]
    HRESULT drvInitializeWia(
        [in]            BYTE*,
        [in]            LONG,
        [in]            BSTR,
        [in]            BSTR,
        [in]            IUnknown*,
        [in]            IUnknown*,
        [out]           IWiaDrvItem**,
        [out]           IUnknown**,
        [out]           LONG*);

    [helpstring("Acquire data from the device item")]
    HRESULT drvAcquireItemData(
        [in]            BYTE*,
        [in]            LONG,
        [in, out]       PMINIDRV_TRANSFER_CONTEXT,
        [out]           LONG*);

    [helpstring("Initialize the device item properties")]
    HRESULT drvInitItemProperties(
        [in]            BYTE*,
        [in]            LONG,
        [out]           LONG*);

    [helpstring("Mini driver validatation of the device item properties")]
    HRESULT drvValidateItemProperties(
        [in]            BYTE*,
        [in]            LONG,
        [in]            ULONG,
        [in]            const   PROPSPEC*,
        [out]           LONG*);

    [helpstring("Mini driver write of the device item properties")]
    HRESULT drvWriteItemProperties(
        [in]            BYTE*,
        [in]            LONG,
        [in]            PMINIDRV_TRANSFER_CONTEXT,
        [out]           LONG*);

    [helpstring("Mini driver read of the device item properties")]
    HRESULT drvReadItemProperties(
        [in]            BYTE*,
        [in]            LONG,
        [in]            ULONG,
        [in]            const   PROPSPEC*,
        [out]           LONG*);

    [helpstring("Lock Device")]
    HRESULT drvLockWiaDevice(
        [in]            BYTE*,
        [in]            LONG,
        [out]           LONG*);

    [helpstring("UnLock Device")]
    HRESULT drvUnLockWiaDevice(
        [in]            BYTE*,
        [in]            LONG,
        [out]           LONG*);

    [helpstring("Look at item and create sub-items if needed")]
    HRESULT drvAnalyzeItem(
        [in]            BYTE*,
        [in]            LONG,
        [in]            LONG*);

    [helpstring("Map a device error value to a string")]
    HRESULT drvGetDeviceErrorStr(
        [in]            LONG,
        [in]            LONG,
        [out, string]   LPOLESTR*,
        [out]           LONG*);

    [helpstring("Issue a device command")]
    HRESULT drvDeviceCommand(
        [in]            BYTE*,
        [in]            LONG,
        [in]            const GUID*,
        [out]           IWiaDrvItem**,
        [out]           LONG*);

    [helpstring("Get the device capabilities")]
    HRESULT drvGetCapabilities(
        [in]            BYTE*,
        [in]            LONG,
        [out]           LONG*,
        [out]           WIA_DEV_CAP_DRV**,
        [out]           LONG*);

    [helpstring("Delete the item from the device")]
    HRESULT drvDeleteItem(
        [in]            BYTE*,
        [in]            LONG,
        [out]           LONG*);

    [helpstring("Free driver item context")]
    HRESULT drvFreeDrvItemContext(
        [in]            LONG,
        [in]            BYTE*,
        [out]           LONG*);

    [helpstring("Get the FORMAT and TYMED")]
    HRESULT drvGetWiaFormatInfo(
        [in]            BYTE*,
        [in]            LONG,
        [out]           LONG*,
        [out]           WIA_FORMAT_INFO**,
        [out]           LONG*);

    [helpstring("Notify Pnp event received by device manager")]
    HRESULT drvNotifyPnpEvent(
        [in]            const GUID      *pEventGUID,
        [in]            BSTR             bstrDeviceID,
        [in]            ULONG            ulReserved);

    [helpstring("UnInitialize WIA, remove resources attached to item, etc")]
    HRESULT drvUnInitializeWia(
        [in]            BYTE*);
};


/*******************************************************************************
*
* IWiaMiniDrvCallBack interface
*
*******************************************************************************/

[
    object,
    uuid(33a57d5a-3de8-11d2-9a36-00c04fa36145),
    helpstring("WIA Mini Driver Call Back Interface"),
    pointer_default(unique)
]

interface IWiaMiniDrvCallBack : IUnknown
{
    [id(1), helpstring("Acquire data from the device")]
    HRESULT MiniDrvCallback(
        [in]            LONG                            lReason,
        [in]            LONG                            lStatus,
        [in]            LONG                            lPercentComplete,
        [in]            LONG                            lOffset,
        [in]            LONG                            lLength,
        [in]            PMINIDRV_TRANSFER_CONTEXT       pTranCtx,
        [in]            LONG                            lReserved);
};

/*******************************************************************************
*
* IWiaMiniDrvTransferCallback interface
*
*******************************************************************************/

[
    object,
    uuid(a9d2ee89-2ce5-4ff0-8adb-c961d1d774ca),
    helpstring("Callback interface for stream-based transfers"),
    pointer_default(unique)
]

interface IWiaMiniDrvTransferCallback : IUnknown
{
    [helpstring("This method is called to get the next stream from the client for upload or download")]
    HRESULT GetNextStream(
       [in]    LONG                 lFlags,
       [in]    BSTR                 bstrItemName,
       [in]    BSTR                 bstrFullItemName,
       [out, annotation("_Outptr_result_maybenull_ _At_(*ppIStream, _When_(return == S_OK, _Post_notnull_))")]
               IStream              **ppIStream);

    [helpstring("This sends a messages such as progress to the calling application")]
    HRESULT SendMessage(
       [in]    LONG                 lFlags,
       [in]    WiaTransferParams    *pWiaTransferParams);
};

/**************************************************************************\
*
* IWiaDrvItem interface
*
\**************************************************************************/

[
    object,
    uuid(1f02b5c5-b00c-11d2-a094-00c04f72dc3c),
    helpstring("WIA Mini Driver DrvItem Interface"),
    pointer_default(unique)
]
interface IWiaDrvItem : IUnknown
{
    HRESULT GetItemFlags(
        [out]           LONG*);

    HRESULT GetDeviceSpecContext(
        [out]           BYTE**);

    HRESULT GetFullItemName(
        [out]           BSTR*);

    HRESULT GetItemName(
        [out]           BSTR*);

    HRESULT AddItemToFolder(
        [in]            IWiaDrvItem*);

    HRESULT UnlinkItemTree(
        [in]            LONG);

    HRESULT RemoveItemFromFolder(
        [in]            LONG);

    HRESULT FindItemByName(
        [in]            LONG,
        [in]            BSTR,
        [out]           IWiaDrvItem**);

    HRESULT FindChildItemByName(
        [in]            BSTR,
        [out]           IWiaDrvItem**);

    HRESULT GetParentItem(
        [out]           IWiaDrvItem**);

    HRESULT GetFirstChildItem(
        [out]           IWiaDrvItem**);

    HRESULT GetNextSiblingItem(
        [out]           IWiaDrvItem**);

    HRESULT DumpItemData(
        [out]           BSTR*);
};


/*******************************************************************************
*
* WIA_PROPERTY_INFO - Stores default access and valid values for item properties
*
*******************************************************************************/

typedef struct _WIA_PROPERTY_INFO
{
    ULONG       lAccessFlags;
    VARTYPE     vt;

    union {

        struct {
            LONG       Min;
            LONG       Nom;
            LONG       Max;
            LONG       Inc;
        } Range;

        struct {
            DOUBLE      Min;
            DOUBLE      Nom;
            DOUBLE      Max;
            DOUBLE      Inc;
        } RangeFloat;

        struct {
            LONG        cNumList;
            LONG        Nom;
            [size_is(cNumList)] BYTE *pList;
        } List;

        struct {
            LONG        cNumList;
            DOUBLE      Nom;
            [size_is(cNumList)] BYTE *pList;
        } ListFloat;

        struct {
            LONG        cNumList;
            GUID        Nom;
            [size_is(cNumList)] GUID *pList;
        } ListGuid;

        struct {
            LONG        cNumList;
            BSTR        Nom;
            [size_is(cNumList)] BSTR *pList;
        } ListBStr;

        struct {
            LONG        Nom;
            LONG        ValidBits;
        } Flag;

        struct {
            LONG        Dummy;
        } None;

    } ValidVal;

}WIA_PROPERTY_INFO, *PWIA_PROPERTY_INFO;


/*******************************************************************************
*
* WIA_PROPERTY_CONTEXT - Stores property id and flag indicating whether the
*                        application is changing the property
*
*******************************************************************************/

typedef struct _WIA_PROPERTY_CONTEXT{
    ULONG       cProps;
    [size_is(cProps)] PROPID *pProps;
    [size_is(cProps)] BOOL *pChanged;
} WIA_PROPERTY_CONTEXT, *PWIA_PROPERTY_CONTEXT;


/*******************************************************************************
*
* WIAS_CHANGED_VALUE_INFO - Stores current and previous values for a property
*
*******************************************************************************/

typedef struct _WIAS_CHANGED_VALUE_INFO{
    BOOL        bChanged;
    LONG        vt;

    union {
        LONG    lVal;
        FLOAT   fltVal;
        BSTR    bstrVal;
        GUID    guidVal;
    } Old;

    union {
        LONG    lVal;
        FLOAT   fltVal;
        BSTR    bstrVal;
        GUID    guidVal;
    } Current;
} WIAS_CHANGED_VALUE_INFO, *PWIAS_CHANGED_VALUE_INFO;


/*******************************************************************************
*
* WIAS_DOWN_SAMPLE_INFO - Used by wiasDownSampleBuffer
*
*******************************************************************************/

typedef struct _WIAS_DOWN_SAMPLE_INFO {
    ULONG   ulOriginalWidth;
    ULONG   ulOriginalHeight;
    ULONG   ulBitsPerPixel;
    ULONG   ulXRes;
    ULONG   ulYRes;
    ULONG   ulDownSampledWidth;
    ULONG   ulDownSampledHeight;
    ULONG   ulActualSize;
    ULONG   ulDestBufSize;
    ULONG   ulSrcBufSize;
    [size_is(ulSrcBufSize)] BYTE *pSrcBuffer;
    [size_is(ulDestBufSize)] BYTE *pDestBuffer;
} WIAS_DOWN_SAMPLE_INFO, *PWIAS_DOWN_SAMPLE_INFO;


/*******************************************************************************
*
* WIAS_ENDORSER_VALUE - Stores endorser strings
*
*******************************************************************************/
typedef struct _WIAS_ENDORSER_VALUE {
   LPWSTR      wszTokenName;
   LPWSTR      wszValue;
} WIAS_ENDORSER_VALUE, *PWIAS_ENDORSER_VALUE;


/*******************************************************************************
*
* WIAS_ENDORSER_INFO - Stores token/value pairs for endorser
*
*******************************************************************************/
typedef struct _WIAS_ENDORSER_INFO {
   ULONG                   ulPageCount;
   ULONG                   ulNumEndorserValues;
   [size_is(ulNumEndorserValues)] WIAS_ENDORSER_VALUE *pEndorserValues;
} WIAS_ENDORSER_INFO, *PWIAS_ENDORSER_INFO;


cpp_quote("#include \"wiamdef.h\"")


cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */")
#pragma endregion

Our Services

  • What our customers say about us?

© 2011-2024 All Rights Reserved. Joya Systems. 4425 South Mopac Building II Suite 101 Austin, TX 78735 Tel: 800-DEV-KERNEL

Privacy Policy. Terms of use. Valid XHTML & CSS