Sample Code

Windows Driver Samples/ OEM Printer Customization Plug-in Samples/ C++/ PSUIRep/ Helper.h/

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
206
207
208
209
210
211
212
213
214
//  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
//  ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
//  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//  PARTICULAR PURPOSE.
//
//  Copyright  2001 - 2003  Microsoft Corporation.  All Rights Reserved.
//
//  FILE:   Helper.h
//
#pragma once
 
class CUIHelper
{
    private:
        IUnknown   *m_pUIHelper;         // pointer to Driver UI's Helper interface
        IID        m_iidUIHelper;       // Driver UI's Helper interface IID
 
    public:
        CUIHelper();
        CUIHelper(const IID &HelperIID, PVOID pHelper);
        virtual ~CUIHelper();
 
        inline BOOL IsValid() {return NULL != m_pUIHelper;}
 
        void Assign(const IID &HelperIID, PVOID pHelper);
        ULONG Release();
 
    //
    // IPrintOemDriverUI methods
    //
 
    //
    // Helper function to get driver settings. This function is only supported
    // for UI plugins that do not fully replace core driver's standard UI.
    //
 
    STDMETHOD(DrvGetDriverSetting) (THIS_
                        PVOID   pci,
                        PCSTR   Feature,
                        PVOID   pOutput,
                        DWORD   cbSize,
                        PDWORD  pcbNeeded,
                        PDWORD  pdwOptionsReturned
                        );
 
    //
    // Helper function to allow OEM plugins upgrade private registry
    // settings. This function is supported for any UI plugins and should be
    // called only by OEM's UpgradePrinter.
    //
 
    STDMETHOD(DrvUpgradeRegistrySetting) (THIS_
                        HANDLE   hPrinter,
                        PCSTR    pFeature,
                        PCSTR    pOption
                        );
 
    //
    // Helper function to allow OEM plugins to update the driver UI settings.
    // This function is only supported for UI plugins that do not fully replace
    // core driver's standard UI. It should be called only when the UI is present.
    //
 
    STDMETHOD(DrvUpdateUISetting) (THIS_
                        PVOID    pci,
                        PVOID    pOptItem,
                        DWORD    dwPreviousSelection,
                        DWORD    dwMode
                        );
 
    //
    // IPrintCoreUI2 new methods
    //
 
    //
    // Following four helper functions are only supported for UI plugins that fully
    // replace core driver's standard UI. They should only be called by the UI plugin's
    // DocumentPropertySheets, DevicePropertySheets and their property sheet callback
    // functions.
    //
    // Helper function to retrieve driver's current setting as a list of
    // feature/option keyword pairs.
    //
 
    STDMETHOD(GetOptions) (THIS_
                           POEMUIOBJ                   poemuiobj,
                           _Reserved_ DWORD            dwFlags,
                           _In_reads_bytes_opt_(cbIn) PCSTR pmszFeaturesRequested,
                           DWORD                       cbIn,
                           _Out_writes_bytes_to_opt_(cbSize, *pcbNeeded) PSTR   pmszFeatureOptionBuf,
                           DWORD                       cbSize,
                           _Out_ _On_failure_(_When_(return == E_OUTOFMEMORY, _Post_valid_)) PDWORD pcbNeeded);
 
    //
    // Helper function to change driver's setting using a list of feature/option
    // keyword pairs.
    //
 
    STDMETHOD(SetOptions) (THIS_
                           POEMUIOBJ                 poemuiobj,
                           DWORD                     dwFlags,
                           _In_reads_bytes_(cbIn)  PCSTR  pmszFeatureOptionBuf,
                           DWORD                     cbIn,
                           _Out_ PDWORD              pdwResult);
 
    //
    // Helper function to retrieve the option(s) of a given feature that are
    // constrained in driver's current setting.
    //
 
    STDMETHOD(EnumConstrainedOptions) (THIS_
                                       _In_ POEMUIOBJ                 poemuiobj,
                                       _Reserved_ DWORD               dwFlags,
                                       _In_  PCSTR                    pszFeatureKeyword,
                                       _Out_writes_bytes_to_opt_(cbSize, *pcbNeeded) PSTR pmszConstrainedOptionList,
                                       DWORD                          cbSize,
                                       _Out_ _On_failure_(_When_(return == E_OUTOFMEMORY, _Post_valid_)) PDWORD pcbNeeded);
 
 
    //
    // Helper function to retrieve a list of feature/option keyword pairs from
    // driver's current setting that conflict with the given feature/option pair.
    //
 
    STDMETHOD(WhyConstrained) (THIS_
                               POEMUIOBJ                      poemuiobj,
                               _Reserved_ DWORD               dwFlags,
                               _In_  PCSTR                    pszFeatureKeyword,
                               _In_  PCSTR                    pszOptionKeyword,
                               _Out_writes_bytes_to_opt_(cbSize, *pcbNeeded) PSTR pmszReasonList,
                               DWORD                          cbSize,
                               _Out_ _On_failure_(_When_(return == E_OUTOFMEMORY, _Post_valid_)) PDWORD pcbNeeded);
 
    //
    // Following five helper functions are supported for any UI plugins.
    //
    // Helper function to retrieve global attribute.
    //
 
    STDMETHOD(GetGlobalAttribute) (THIS_
                                   POEMUIOBJ                       poemuiobj,
                                   _Reserved_ DWORD                dwFlags,
                                   _In_opt_  PCSTR                 pszAttribute,
                                   _Out_ PDWORD                    pdwDataType,
                                   _Out_writes_bytes_to_opt_(cbSize, *pcbNeeded) PBYTE pbData,
                                   DWORD                           cbSize,
                                   _Out_ _On_failure_(_When_(return == E_OUTOFMEMORY, _Post_valid_)) PDWORD pcbNeeded);
 
    //
    // Helper function to retrieve attribute of a given feature.
    //
 
    STDMETHOD(GetFeatureAttribute) (THIS_
                                    POEMUIOBJ                      poemuiobj,
                                    _Reserved_ DWORD               dwFlags,
                                    _In_ PCSTR                     pszFeatureKeyword,
                                    _In_opt_ PCSTR                 pszAttribute,
                                    _Out_ PDWORD                   pdwDataType,
                                    _Out_writes_bytes_to_opt_(cbSize, *pcbNeeded) PBYTE pbData,
                                    DWORD                          cbSize,
                                    _Out_ _On_failure_(_When_(return == E_OUTOFMEMORY, _Post_valid_)) PDWORD pcbNeeded);
 
    //
    // Helper function to retrieve attribute of a given feature/option selection.
    //
 
    STDMETHOD(GetOptionAttribute) (THIS_
                                   POEMUIOBJ                       poemuiobj,
                                   _Reserved_ DWORD                dwFlags,
                                   _In_ PCSTR                      pszFeatureKeyword,
                                   _In_ PCSTR                      pszOptionKeyword,
                                   _In_opt_  PCSTR                 pszAttribute,
                                   _Out_ PDWORD                    pdwDataType,
                                   _Out_writes_bytes_to_opt_(cbSize, *pcbNeeded) PBYTE pbData,
                                   DWORD                           cbSize,
                                   _Out_ _On_failure_(_When_(return == E_OUTOFMEMORY, _Post_valid_)) PDWORD pcbNeeded);
 
    //
    // Helper function to retrieve the list of feature keyword.
    //
 
    STDMETHOD(EnumFeatures) (THIS_
                             POEMUIOBJ                      poemuiobj,
                             _Reserved_ DWORD               dwFlags,
                             _Out_writes_bytes_to_opt_(cbSize, *pcbNeeded) PSTR pmszFeatureList,
                             DWORD                          cbSize,
                             _Out_ _On_failure_(_When_(return == E_OUTOFMEMORY, _Post_valid_)) PDWORD pcbNeeded);
 
    //
    // Helper function to retrieve the list of options keyword of a given feature.
    //
 
    STDMETHOD(EnumOptions) (THIS_
                            POEMUIOBJ                      poemuiobj,
                            _Reserved_ DWORD               dwFlags,
                            _In_ PCSTR                     pszFeatureKeyword,
                            _Out_writes_bytes_to_opt_(cbSize, *pcbNeeded) PSTR pmszOptionList,
                            DWORD                          cbSize,
                            _Out_ _On_failure_(_When_(return == E_OUTOFMEMORY, _Post_valid_)) PDWORD pcbNeeded);
 
    //
    // Helper function to query system simulation support
    //
 
    STDMETHOD(QuerySimulationSupport) (THIS_
                                       HANDLE                      hPrinter,
                                       DWORD                       dwLevel,
                                       _Out_writes_bytes_to_opt_(cbSize, *pcbNeeded) PBYTE  pCaps,
                                       DWORD                       cbSize,
                                       _Out_ _On_failure_(_When_(return == E_OUTOFMEMORY, _Post_valid_)) PDWORD pcbNeeded);
 
    private:
        void Clear();
};

Our Services

  • What our customers say about us?

© 2011-2025 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