2 * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
23 Change History (most recent first):
25 $Log: PrinterSetupWizardSheet.h,v $
26 Revision 1.8 2005/02/08 18:53:33 shersche
27 Remove qtotalDefined parameter from ParseTextRecord()
29 Revision 1.7 2005/01/31 23:54:29 shersche
30 <rdar://problem/3947508> Start browsing when printer wizard starts. Move browsing logic from CSecondPage object to CPrinterSetupWizardSheet object.
32 Revision 1.6 2005/01/03 19:05:01 shersche
33 Store pointer to instance of wizard sheet so that print driver install thread sends a window message to the correct window
35 Revision 1.5 2004/12/29 18:53:38 shersche
36 <rdar://problem/3725106>
37 <rdar://problem/3737413> Added support for LPR and IPP protocols as well as support for obtaining multiple text records. Reorganized and simplified codebase.
38 Bug #: 3725106, 3737413
40 Revision 1.4 2004/07/13 21:24:23 rpantos
41 Fix for <rdar://problem/3701120>.
43 Revision 1.3 2004/06/28 00:51:47 shersche
44 Move call to EnumPrinters out of browse callback into standalone function
46 Revision 1.2 2004/06/24 20:12:07 shersche
48 Submitted by: herscher
50 Revision 1.1 2004/06/18 04:36:57 rpantos
59 #include "firstpage.h"
60 #include "secondpage.h"
61 #include "thirdpage.h"
62 #include "fourthpage.h"
63 #include "UtilTypes.h"
68 using namespace PrinterSetupWizard
;
70 // CPrinterSetupWizardSheet
72 class CPrinterSetupWizardSheet
: public CPropertySheet
74 DECLARE_DYNAMIC(CPrinterSetupWizardSheet
)
78 struct WizardException
86 CPrinterSetupWizardSheet(UINT nIDCaption
, CWnd
* pParentWnd
= NULL
, UINT iSelectPage
= 0);
87 virtual ~CPrinterSetupWizardSheet();
90 SetSelectedPrinter(Printer
* printer
);
96 LoadPrinterDriver(const CString
& filename
);
102 // handles end of process event
105 OnProcessEvent(WPARAM inWParam
, LPARAM inLParam
);
108 OnSocketEvent(WPARAM inWParam
, LPARAM inLParam
);
111 OnCommand(WPARAM wParam
, LPARAM lParam
);
117 OnSetCursor(CWnd
* pWnd
, UINT nHitTest
, UINT message
);
120 OnContextMenu(CWnd
* pWnd
, CPoint pos
);
126 StartResolve( Printer
* printer
);
129 StopResolve( Printer
* printer
);
138 DECLARE_MESSAGE_MAP()
139 CFirstPage m_pgFirst
;
140 CSecondPage m_pgSecond
;
141 CThirdPage m_pgThird
;
142 CFourthPage m_pgFourth
;
152 static void DNSSD_API
155 DNSServiceFlags inFlags
,
156 uint32_t inInterfaceIndex
,
157 DNSServiceErrorType inErrorCode
,
160 const char * inDomain
,
163 static void DNSSD_API
166 DNSServiceFlags inFlags
,
167 uint32_t inInterfaceIndex
,
168 DNSServiceErrorType inErrorCode
,
169 const char * inFullName
,
170 const char * inHostName
,
176 static void DNSSD_API
179 DNSServiceFlags inFlags
,
180 uint32_t inInterfaceIndex
,
181 DNSServiceErrorType inErrorCode
,
182 const char * inFullName
,
186 const void * inRData
,
192 uint32_t inInterfaceIndex
,
195 const char * inDomain
,
206 uint32_t inInterfaceIndex
,
209 const char * inDomain
);
220 OrderServiceFunc( const Service
* a
, const Service
* b
);
223 OrderQueueFunc( const Queue
* q1
, const Queue
* q2
);
226 StartOperation( DNSServiceRef ref
);
229 StopOperation( DNSServiceRef
& ref
);
238 StartResolve( Service
* service
);
241 StopResolve( Service
* service
);
244 ParseTextRecord( Service
* service
, uint16_t inTXTSize
, const char * inTXT
, CString
& qname
, uint32_t & qpriority
);
250 Lookup( const char * name
);
253 InstallPrinter(Printer
* printer
);
256 InstallPrinterPDLAndLPR(Printer
* printer
, Service
* service
, DWORD protocol
);
259 InstallPrinterIPP(Printer
* printer
, Service
* service
);
261 static unsigned WINAPI
262 InstallDriverThread( LPVOID inParam
);
264 typedef std::map
<CString
,CString
> PrinterNameMap
;
265 typedef std::list
<DNSServiceRef
> ServiceRefList
;
266 static CPrinterSetupWizardSheet
* m_self
;
267 PrinterNameMap m_printerNames
;
268 Printer
* m_selectedPrinter
;
269 bool m_driverThreadFinished
;
270 DWORD m_driverThreadExitCode
;
271 ServiceRefList m_serviceRefList
;
272 DNSServiceRef m_pdlBrowser
;
273 DNSServiceRef m_lprBrowser
;
274 DNSServiceRef m_ippBrowser
;
275 DNSServiceRef m_resolver
;
280 CPrinterSetupWizardSheet::GetSelectedPrinter()
282 return m_selectedPrinter
;
287 CPrinterSetupWizardSheet::GetCursor()
295 #define kPDLServiceType "_pdl-datastream._tcp."
296 #define kLPRServiceType "_printer._tcp."
297 #define kIPPServiceType "_ipp._tcp."