summaryrefslogtreecommitdiff
path: root/wia/ProdScan/PropMan.h
blob: c7436b92ad084f5e88e57790f4fee5309c7eecb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/**************************************************************************
*
*  Copyright � Microsoft Corporation
*
*  File Title:  PropMan.h
*
*  Project:     Production Scanner Driver Sample
*
*  Description: This file contains the class definition of the
*               CWIAPropertyManager class that encapsulates
*               WIA property creation for this driver.
*
***************************************************************************/

#pragma once


//
// Structure definitions:
//

typedef struct _WIA_PROPERTY_INFO_DATA{
    LPOLESTR          pszName;  // property name
    PROPID            pid;      // property id
    PROPVARIANT       pv;       // property variant
    PROPSPEC          ps;       // property spec
    WIA_PROPERTY_INFO wpi;      // property info
} WIA_PROPERTY_INFO_DATA,*PWIA_PROPERTY_INFO_DATA;

//
// WIA access flag combinations:
//

#define RN   (WIA_PROP_READ | WIA_PROP_NONE)
#define RF   (WIA_PROP_READ | WIA_PROP_FLAG)
#define RW   (WIA_PROP_READ | WIA_PROP_WRITE | WIA_PROP_NONE)
#define RWL  (WIA_PROP_READ | WIA_PROP_WRITE | WIA_PROP_LIST)
#define RWR  (WIA_PROP_READ | WIA_PROP_WRITE | WIA_PROP_RANGE)
#define RWF  (WIA_PROP_READ | WIA_PROP_WRITE | WIA_PROP_FLAG)
#define RWLC (WIA_PROP_READ | WIA_PROP_WRITE | WIA_PROP_LIST|WIA_PROP_CACHEABLE)
#define RWRC (WIA_PROP_READ | WIA_PROP_WRITE | WIA_PROP_RANGE|WIA_PROP_CACHEABLE)
#define RWFC (WIA_PROP_READ | WIA_PROP_WRITE | WIA_PROP_FLAG|WIA_PROP_CACHEABLE)

//
// CWIAPropertyManager class:
//

class CWIAPropertyManager
{
private:
    CBasicDynamicArray<PWIA_PROPERTY_INFO_DATA> m_List;

    PWIA_PROPERTY_INFO_DATA
    FindProperty(
        LONG lPropertyID);

    HRESULT
    DeletePropertyData(
        _Inout_ PWIA_PROPERTY_INFO_DATA pInfo);

    PWIA_PROPERTY_INFO_DATA
    AllocatePropertyData();

    HRESULT
    RemovePropertyAndDeleteData(
        LONG lPropertyID);

public:
    CWIAPropertyManager();
    ~CWIAPropertyManager();

    //
    // LONG type property creation:
    //

    HRESULT
    AddProperty(
        LONG lPropertyID,
        _In_ LPOLESTR pszName,
        LONG lAccessFlags,
        LONG lCurrValue);

    HRESULT
    AddProperty(
        LONG lPropertyID,
        _In_ LPOLESTR pszName,
        LONG lAccessFlags,
        ULONG ulCurrValueItems,
        _In_reads_(ulCurrValueItems) LONG *pCurrValue);

    HRESULT
    AddProperty(
        LONG lPropertyID,
        _In_ LPOLESTR pszName,
        LONG lAccessFlags,
        _In_reads_(ulNumItems) BYTE *pbCurrValue,
        ULONG ulNumItems);

    HRESULT
    AddProperty(
        LONG lPropertyID,
        _In_ LPOLESTR pszName,
        LONG lAccessFlags,
        LONG lCurrValue,
        LONG lNomValue,
        LONG lMinValue,
        LONG lMaxValue,
        LONG lInc);

    HRESULT
    AddProperty(
        LONG lPropertyID,
        _In_ LPOLESTR pszName,
        LONG lAccessFlags,
        LONG lCurrValue,
        LONG lNomValue,
        _In_ LONG *plValues,
        LONG lNumValues);

    HRESULT
    AddProperty(
        LONG lPropertyID,
        _In_ LPOLESTR pszName,
        LONG lAccessFlags,
        LONG lCurrValue,
        LONG lNomValue,
        _In_ CBasicDynamicArray<LONG> *pValueList);

    HRESULT
    AddProperty(
        LONG lPropertyID,
        _In_ LPOLESTR pszName,
        LONG lAccessFlags,
        LONG lCurrValue,
        LONG lValidBits);

    //
    // ULONG type property creation
    //

    HRESULT
    AddPropertyUL(
        LONG  lPropertyID,
        _In_  LPOLESTR pszName,
        LONG  lAccessFlags,
        ULONG ulCurrValue);

    HRESULT
    AddPropertyUL(
        LONG  lPropertyID,
        _In_  LPOLESTR pszName,
        LONG  lAccessFlags,
        ULONG ulCurrValue,
        ULONG ulNomValue,
        ULONG ulMinValue,
        ULONG ulMaxValue,
        ULONG ulInc);

    //
    // BSTR type property creation:
    //

    HRESULT
    AddProperty(
        LONG lPropertyID,
        _In_ LPOLESTR pszName,
        LONG lAccessFlags,
        _In_ BSTR bstrCurrValue);

    HRESULT
    AddProperty(
        LONG lPropertyID,
        _In_ LPOLESTR pszName,
        LONG lAccessFlags,
        ULONG ulCurrValueItems,
        _In_reads_(ulCurrValueItems) BSTR *pCurrValue);

    //
    // GUID type property creation:
    //

    HRESULT
    AddProperty(
        LONG lPropertyID,
        _In_ LPOLESTR pszName,
        LONG lAccessFlags,
        GUID guidCurrValue);

    HRESULT
    AddProperty(
        LONG lPropertyID,
        _In_ LPOLESTR pszName,
        LONG lAccessFlags,
        GUID guidCurrValue,
        GUID guidNomValue,
        _In_ CBasicDynamicArray<GUID> *pValueList);

    HRESULT
    RemoveProperty(
        LONG lPropertyID);

    HRESULT
    SetItemProperties(
        _Inout_ BYTE *pWiasContext);
};