summaryrefslogtreecommitdiffstats
path: root/mDNSResponder/Clients/PrinterSetupWizard
diff options
context:
space:
mode:
Diffstat (limited to 'mDNSResponder/Clients/PrinterSetupWizard')
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/About.cpp31
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/About.h21
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/FirstPage.cpp98
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/FirstPage.h50
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/FourthPage.cpp212
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/FourthPage.h61
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/Logger.cpp85
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/Logger.h63
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizard.ncb1
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizard.rc157
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizard.vcproj638
-rwxr-xr-xmDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizard.vcxproj365
-rwxr-xr-xmDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizard.vcxproj.filters145
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardApp.cpp172
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardApp.h48
-rwxr-xr-xmDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardLocRes.rc310
-rwxr-xr-xmDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardLocRes.vcproj441
-rwxr-xr-xmDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardLocRes.vcxproj345
-rwxr-xr-xmDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardLocRes.vcxproj.filters29
-rwxr-xr-xmDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardRes.rc173
-rwxr-xr-xmDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardRes.vcproj465
-rwxr-xr-xmDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardRes.vcxproj347
-rwxr-xr-xmDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardRes.vcxproj.filters47
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardSheet.cpp1949
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardSheet.h352
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/ReadMe.txt94
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/SecondPage.cpp513
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/SecondPage.h105
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/ThirdPage.cpp1583
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/ThirdPage.h159
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/UtilTypes.h280
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/res/Info.icobin0 -> 23558 bytes
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/res/NetworkPrinter.icobin0 -> 287934 bytes
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/res/Print.icobin0 -> 82726 bytes
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizard.icobin0 -> 77214 bytes
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizard.manifest17
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizard.rc213
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizard64.manifest17
-rwxr-xr-xmDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizardLocRes.rc213
-rwxr-xr-xmDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizardRes.rc213
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/res/Thumbs.dbbin0 -> 6144 bytes
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/res/about.bmpbin0 -> 254802 bytes
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/res/banner_icon.bmpbin0 -> 7308 bytes
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/res/watermark.bmpbin0 -> 162908 bytes
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/resource.h29
-rwxr-xr-xmDNSResponder/Clients/PrinterSetupWizard/resource_exe.h94
-rwxr-xr-xmDNSResponder/Clients/PrinterSetupWizard/resource_loc_res.h95
-rwxr-xr-xmDNSResponder/Clients/PrinterSetupWizard/resource_res.h94
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/stdafx.cpp20
-rw-r--r--mDNSResponder/Clients/PrinterSetupWizard/stdafx.h61
-rwxr-xr-xmDNSResponder/Clients/PrinterSetupWizard/tcpxcv.h107
51 files changed, 9912 insertions, 0 deletions
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/About.cpp b/mDNSResponder/Clients/PrinterSetupWizard/About.cpp
new file mode 100644
index 00000000..6fda7101
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/About.cpp
@@ -0,0 +1,31 @@
+// About.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "PrinterSetupWizardApp.h"
+#include "About.h"
+
+
+// CAbout dialog
+
+IMPLEMENT_DYNAMIC(CAbout, CDialog)
+CAbout::CAbout(CWnd* pParent /*=NULL*/)
+ : CDialog(CAbout::IDD, pParent)
+{
+}
+
+CAbout::~CAbout()
+{
+}
+
+void CAbout::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CAbout, CDialog)
+END_MESSAGE_MAP()
+
+
+// CAbout message handlers
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/About.h b/mDNSResponder/Clients/PrinterSetupWizard/About.h
new file mode 100644
index 00000000..72e893da
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/About.h
@@ -0,0 +1,21 @@
+#pragma once
+
+
+// CAbout dialog
+
+class CAbout : public CDialog
+{
+DECLARE_DYNAMIC(CAbout)
+
+public:
+CAbout(CWnd* pParent = NULL); // standard constructor
+virtual ~CAbout();
+
+// Dialog Data
+enum { IDD = IDD_DIALOG1 };
+
+protected:
+virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+DECLARE_MESSAGE_MAP()
+};
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/FirstPage.cpp b/mDNSResponder/Clients/PrinterSetupWizard/FirstPage.cpp
new file mode 100644
index 00000000..a4e6e43d
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/FirstPage.cpp
@@ -0,0 +1,98 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "stdafx.h"
+#include "PrinterSetupWizardApp.h"
+#include "PrinterSetupWizardSheet.h"
+#include "FirstPage.h"
+
+#include <DebugServices.h>
+
+
+// CFirstPage dialog
+
+IMPLEMENT_DYNAMIC(CFirstPage, CPropertyPage)
+CFirstPage::CFirstPage()
+ : CPropertyPage(CFirstPage::IDD)
+{
+ CString fontName;
+
+ m_psp.dwFlags &= ~(PSP_HASHELP);
+ m_psp.dwFlags |= PSP_DEFAULT|PSP_HIDEHEADER;
+
+ fontName.LoadString(IDS_LARGE_FONT);
+
+ // create the large font
+ m_largeFont.CreateFont(-16, 0, 0, 0,
+ FW_BOLD, FALSE, FALSE, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
+ CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, fontName);
+}
+
+CFirstPage::~CFirstPage()
+{
+}
+
+void CFirstPage::DoDataExchange(CDataExchange* pDX)
+{
+ CPropertyPage::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_GREETING, m_greeting);
+}
+
+
+BOOL
+CFirstPage::OnSetActive()
+{
+ CPrinterSetupWizardSheet * psheet;
+ CString greetingText;
+
+ psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent());
+ require_quiet( psheet, exit );
+
+ psheet->SetWizardButtons(PSWIZB_NEXT);
+
+ m_greeting.SetFont(&m_largeFont);
+
+ greetingText.LoadString(IDS_GREETING);
+ m_greeting.SetWindowText(greetingText);
+
+exit:
+
+ return CPropertyPage::OnSetActive();
+}
+
+
+BOOL
+CFirstPage::OnKillActive()
+{
+ CPrinterSetupWizardSheet * psheet;
+
+ psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent());
+ require_quiet( psheet, exit );
+
+ psheet->SetLastPage(this);
+
+exit:
+
+ return CPropertyPage::OnKillActive();
+}
+
+
+BEGIN_MESSAGE_MAP(CFirstPage, CPropertyPage)
+END_MESSAGE_MAP()
+
+
+// CFirstPage message handlers
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/FirstPage.h b/mDNSResponder/Clients/PrinterSetupWizard/FirstPage.h
new file mode 100644
index 00000000..0186c026
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/FirstPage.h
@@ -0,0 +1,50 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+#include "afxwin.h"
+
+
+// CFirstPage dialog
+
+class CFirstPage : public CPropertyPage
+{
+DECLARE_DYNAMIC(CFirstPage)
+
+public:
+CFirstPage();
+virtual ~CFirstPage();
+
+// Dialog Data
+enum { IDD = IDD_FIRST_PAGE };
+
+protected:
+virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+virtual BOOL OnSetActive();
+virtual BOOL OnKillActive();
+
+
+DECLARE_MESSAGE_MAP()
+
+private:
+
+CFont m_largeFont;
+
+public:
+
+CStatic m_greeting;
+};
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/FourthPage.cpp b/mDNSResponder/Clients/PrinterSetupWizard/FourthPage.cpp
new file mode 100644
index 00000000..3817246e
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/FourthPage.cpp
@@ -0,0 +1,212 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "stdafx.h"
+#include "PrinterSetupWizardApp.h"
+#include "PrinterSetupWizardSheet.h"
+#include "FourthPage.h"
+
+#if !defined( PBS_MARQUEE )
+# define PBS_MARQUEE 0x08
+#endif
+
+#if !defined( PBM_SETMARQUEE )
+# define PBM_SETMARQUEE WM_USER + 10
+#endif
+
+
+
+// CFourthPage dialog
+
+IMPLEMENT_DYNAMIC(CFourthPage, CPropertyPage)
+CFourthPage::CFourthPage()
+ : CPropertyPage(CFourthPage::IDD),
+ m_initialized(false)
+{
+ CString fontName;
+
+ m_psp.dwFlags &= ~(PSP_HASHELP);
+ m_psp.dwFlags |= PSP_DEFAULT|PSP_HIDEHEADER;
+
+ fontName.LoadString(IDS_LARGE_FONT);
+
+ // create the large font
+ m_largeFont.CreateFont(-16, 0, 0, 0,
+ FW_BOLD, FALSE, FALSE, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
+ CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, fontName);
+}
+
+CFourthPage::~CFourthPage()
+{
+}
+
+void CFourthPage::DoDataExchange(CDataExchange* pDX)
+{
+ CPropertyPage::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_GOODBYE, m_goodbye);
+ DDX_Control(pDX, IDC_PRINTER_NAME, m_printerNameCtrl);
+ DDX_Control(pDX, IDC_PRINTER_MANUFACTURER, m_printerManufacturerCtrl);
+ DDX_Control(pDX, IDC_PRINTER_MODEL, m_printerModelCtrl);
+ DDX_Control(pDX, IDC_PRINTER_PROTOCOL, m_printerProtocolCtrl);
+ DDX_Control(pDX, IDC_PRINTER_DEFAULT, m_printerDefault);
+}
+
+
+BEGIN_MESSAGE_MAP(CFourthPage, CPropertyPage)
+END_MESSAGE_MAP()
+
+
+// CFourthPage message handlers
+OSStatus
+CFourthPage::OnInitPage()
+{
+ CWnd * window;
+ OSStatus err = kNoErr;
+
+ window = GetDlgItem( IDC_INSTALLING );
+ require_action( window, exit, err = kUnknownErr );
+ window->ShowWindow( SW_HIDE );
+
+ window = GetDlgItem( IDC_PROGRESS );
+ require_action( window, exit, err = kUnknownErr );
+ SetWindowLong( *window, GWL_STYLE, GetWindowLong( *window, GWL_STYLE ) | PBS_MARQUEE );
+ SetWindowLongPtr( *window, GWL_STYLE, GetWindowLongPtr( *window, GWL_STYLE ) | PBS_MARQUEE );
+ window->SendMessage( ( UINT ) PBM_SETMARQUEE, ( WPARAM ) FALSE,( LPARAM ) 35 );
+ window->ShowWindow( SW_HIDE );
+
+exit:
+
+ return err;
+}
+
+
+BOOL
+CFourthPage::OnSetActive()
+{
+ CPrinterSetupWizardSheet * psheet;
+ CString goodbyeText;
+ Printer * printer;
+ CString defaultText;
+
+ psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent());
+ require_quiet( psheet, exit );
+
+ printer = psheet->GetSelectedPrinter();
+ require_quiet( psheet, exit );
+
+ psheet->SetWizardButtons(PSWIZB_BACK|PSWIZB_FINISH);
+
+ if (m_initialized == false)
+ {
+ m_initialized = true;
+ OnInitPage();
+ }
+
+ m_goodbye.SetFont(&m_largeFont);
+
+ goodbyeText.LoadString(IDS_GOODBYE);
+ m_goodbye.SetWindowText(goodbyeText);
+
+ m_printerNameCtrl.SetWindowText( printer->actualName );
+ m_printerManufacturerCtrl.SetWindowText ( printer->manufacturer );
+ m_printerModelCtrl.SetWindowText ( printer->displayModelName );
+
+ Service * service = printer->services.front();
+ require_quiet( service, exit );
+ m_printerProtocolCtrl.SetWindowText ( service->protocol );
+
+ if (printer->deflt)
+ {
+ defaultText.LoadString(IDS_YES);
+ }
+ else
+ {
+ defaultText.LoadString(IDS_NO);
+ }
+
+ m_printerDefault.SetWindowText ( defaultText );
+
+exit:
+
+ return CPropertyPage::OnSetActive();
+}
+
+
+BOOL
+CFourthPage::OnKillActive()
+{
+ CPrinterSetupWizardSheet * psheet;
+
+ psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent());
+ require_quiet( psheet, exit );
+
+ psheet->SetLastPage(this);
+
+exit:
+
+ return CPropertyPage::OnKillActive();
+}
+
+
+BOOL
+CFourthPage::StartActivityIndicator()
+{
+ CWnd * window;
+ BOOL ok = TRUE;
+
+ window = GetDlgItem( IDC_COMPLETE1 );
+ require_action( window, exit, ok = FALSE );
+ window->ShowWindow( SW_HIDE );
+
+ window = GetDlgItem( IDC_COMPLETE2 );
+ require_action( window, exit, ok = FALSE );
+ window->ShowWindow( SW_HIDE );
+
+ window = GetDlgItem( IDC_INSTALLING );
+ require_action( window, exit, ok = FALSE );
+ window->ShowWindow( SW_SHOW );
+
+ window = GetDlgItem( IDC_PROGRESS );
+ require_action( window, exit, ok = FALSE );
+ window->SendMessage( ( UINT ) PBM_SETMARQUEE, ( WPARAM ) TRUE,( LPARAM ) 50 );
+ window->ShowWindow( SW_SHOW );
+
+exit:
+
+ return ok;
+}
+
+
+BOOL
+CFourthPage::StopActivityIndicator()
+{
+ CWnd * window;
+ BOOL ok = TRUE;
+
+ window = GetDlgItem( IDC_INSTALLING );
+ require_action( window, exit, ok = FALSE );
+ window->ShowWindow( SW_HIDE );
+
+ window = GetDlgItem( IDC_PROGRESS );
+ require_action( window, exit, ok = FALSE );
+ window->SendMessage( ( UINT ) PBM_SETMARQUEE, ( WPARAM ) FALSE,( LPARAM ) 35 );
+ window->ShowWindow( SW_HIDE );
+
+exit:
+
+ return ok;
+}
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/FourthPage.h b/mDNSResponder/Clients/PrinterSetupWizard/FourthPage.h
new file mode 100644
index 00000000..5b4ea99b
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/FourthPage.h
@@ -0,0 +1,61 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+#include "afxwin.h"
+
+
+// CFourthPage dialog
+
+class CFourthPage : public CPropertyPage
+{
+DECLARE_DYNAMIC(CFourthPage)
+
+public:
+CFourthPage();
+virtual ~CFourthPage();
+
+// Dialog Data
+enum { IDD = IDD_FOURTH_PAGE };
+
+virtual BOOL OnSetActive();
+virtual BOOL OnKillActive();
+
+BOOL StartActivityIndicator();
+BOOL StopActivityIndicator();
+
+protected:
+virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+DECLARE_MESSAGE_MAP()
+
+private:
+
+OSStatus OnInitPage();
+CFont m_largeFont;
+bool m_initialized;
+
+
+public:
+CStatic m_goodbye;
+private:
+CStatic m_printerNameCtrl;
+CStatic m_printerManufacturerCtrl;
+CStatic m_printerModelCtrl;
+CStatic m_printerProtocolCtrl;
+CStatic m_printerDefault;
+};
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/Logger.cpp b/mDNSResponder/Clients/PrinterSetupWizard/Logger.cpp
new file mode 100644
index 00000000..3385d31c
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/Logger.cpp
@@ -0,0 +1,85 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "stdafx.h"
+#include "Logger.h"
+#include "DebugServices.h"
+#include <string>
+
+
+Logger::Logger()
+{
+ std::string tmp;
+ char path[ MAX_PATH ];
+ HRESULT err;
+ BOOL ok;
+
+ err = SHGetFolderPathA( NULL, CSIDL_LOCAL_APPDATA, NULL, 0, path );
+ require_noerr( err, exit );
+
+ tmp = path;
+
+ // Create Logs subdir
+ tmp += "\\Apple";
+ ok = CreateDirectoryA( tmp.c_str(), NULL );
+ require_action( ( ok || ( GetLastError() == ERROR_ALREADY_EXISTS ) ), exit, err = -1 );
+
+ // Create Logs subdir
+ tmp += "\\Bonjour";
+ ok = CreateDirectoryA( tmp.c_str(), NULL );
+ require_action( ( ok || ( GetLastError() == ERROR_ALREADY_EXISTS ) ), exit, err = -1 );
+
+ // Create log file
+ tmp += "\\PrinterSetupLog.txt";
+ open( tmp.c_str());
+
+ *this << currentTime() << " Log started" << std::endl;
+
+exit:
+
+ return;
+}
+
+
+Logger::~Logger()
+{
+ *this << currentTime() << " Log finished" << std::endl;
+ flush();
+}
+
+
+std::string
+Logger::currentTime()
+{
+ time_t ltime;
+ struct tm now;
+ int err;
+ std::string ret;
+
+ time( &ltime );
+ err = localtime_s( &now, &ltime );
+
+ if ( !err )
+ {
+ char temp[ 64 ];
+
+ strftime( temp, sizeof( temp ), "%m/%d/%y %I:%M:%S %p", &now );
+ ret = temp;
+ }
+
+ return ret;
+}
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/Logger.h b/mDNSResponder/Clients/PrinterSetupWizard/Logger.h
new file mode 100644
index 00000000..2f338c1f
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/Logger.h
@@ -0,0 +1,63 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _Logger_h
+#define _Logger_h
+
+#include <fstream>
+#include <string>
+
+
+class Logger : public std::ofstream
+{
+public:
+
+Logger();
+~Logger();
+
+std::string
+currentTime();
+};
+
+
+#define require_noerr_with_log( LOG, MESSAGE, ERR, LABEL ) \
+ do \
+ { \
+ int_least32_t localErr; \
+ localErr = (int_least32_t)( ERR ); \
+ if( localErr != 0 ) \
+ { \
+ log << log.currentTime() << " [ERROR] " << MESSAGE << " returned " << ERR << std::endl; \
+ log << log.currentTime() << " [WHERE] " << "\"" << __FILE__ << "\", \"" << __FUNCTION__ << "\", line " << __LINE__ << std::endl << std::endl; \
+ goto LABEL; \
+ } \
+ } while( 0 )
+
+
+#define require_action_with_log( LOG, X, LABEL, ACTION ) \
+ do \
+ { \
+ if( !( X ) ) \
+ { \
+ log << log.currentTime() << " [ERROR] " << # X << std::endl; \
+ log << log.currentTime() << " [WHERE] " << "\"" << __FILE__ << "\", \"" << __FUNCTION__ << "\", line " << __LINE__ << std::endl << std::endl; \
+ { ACTION; } \
+ goto LABEL; \
+ } \
+ } while( 0 )
+
+#endif
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizard.ncb b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizard.ncb
new file mode 100644
index 00000000..9057ebac
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizard.ncb
@@ -0,0 +1 @@
+Microsoft C/C++ MSF 7.00
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizard.rc b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizard.rc
new file mode 100644
index 00000000..88b13795
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizard.rc
@@ -0,0 +1,157 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource_exe.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+#include "WinVersRes.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Russian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
+#ifdef _WIN32
+LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
+#pragma code_page(1251)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource_exe.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "#include ""WinVersRes.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+ "#define _AFX_NO_OLE_RESOURCES\r\n"
+ "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+ "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+ "\r\n"
+ "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
+ "LANGUAGE 9, 1\r\n"
+ "#pragma code_page(1252)\r\n"
+ "#include ""res\\PrinterSetupWizard.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
+ "#include ""afxres.rc"" // Standard components\r\n"
+ "#endif\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // Russian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDR_MAINFRAME ICON "res\\NetworkPrinter.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION MASTER_PROD_VERS
+ PRODUCTVERSION MASTER_PROD_VERS
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904e4"
+ BEGIN
+ VALUE "CompanyName", MASTER_COMPANY_NAME
+ VALUE "FileDescription", "Bonjour Printer Wizard"
+ VALUE "FileVersion", MASTER_PROD_VERS_STR
+ VALUE "InternalName", "PrinterWizard.exe"
+ VALUE "LegalCopyright", MASTER_LEGAL_COPYRIGHT
+ VALUE "OriginalFilename", "PrinterWizard.exe"
+ VALUE "ProductName", MASTER_PROD_NAME
+ VALUE "ProductVersion", MASTER_PROD_VERS_STR
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1252
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE
+BEGIN
+ IDS_REINSTALL "Bonjour Printer Wizard cannot run because some of its required files are missing. Please reinstall Bonjour Printer Wizard."
+ IDS_REINSTALL_CAPTION "Bonjour Printer Wizard"
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#pragma code_page(1252)
+#include "res\PrinterSetupWizard.rc2" // non-Microsoft Visual C++ edited resources
+#include "afxres.rc" // Standard components
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizard.vcproj b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizard.vcproj
new file mode 100644
index 00000000..f570ab67
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizard.vcproj
@@ -0,0 +1,638 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="PrinterSetupWizard"
+ ProjectGUID="{B1D2CDA2-CC8F-45D5-A694-2EE45B0308CF}"
+ Keyword="MFCProj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="false"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;../../mDNSWindows;../../mDNSShared"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUGS;DEBUG=1;WINVER=0x0501;UNICODE;_UNICODE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1"
+ StringPooling="true"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="true"
+ TreatWChar_tAsBuiltInType="true"
+ UsePrecompiledHeader="0"
+ AssemblerListingLocation="$(IntDir)\"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ CallingConvention="0"
+ DisableSpecificWarnings="4702"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir);../../mDNSWindows"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/NXCOMPAT /DYNAMICBASE /SAFESEH"
+ AdditionalDependencies="../../mDNSWindows/DLLStub/$(PlatformName)/$(ConfigurationName)/dnssdStatic.lib ws2_32.lib iphlpapi.lib winspool.lib setupapi.lib"
+ OutputFile="$(OutDir)/PrinterWizard.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile="$(IntDir)/$(ProjectName).pdb"
+ SubSystem="2"
+ EntryPointSymbol="wWinMainCRTStartup"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ AdditionalManifestFiles="res\PrinterSetupWizard.manifest"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="false"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;../../mDNSWindows;../../mDNSShared"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUGS;DEBUG=1;WINVER=0x0501;UNICODE;_UNICODE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1"
+ StringPooling="true"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="true"
+ TreatWChar_tAsBuiltInType="true"
+ UsePrecompiledHeader="0"
+ AssemblerListingLocation="$(IntDir)\"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ CallingConvention="0"
+ DisableSpecificWarnings="4702"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir);../../mDNSWindows"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/NXCOMPAT /DYNAMICBASE"
+ AdditionalDependencies="../../mDNSWindows/DLLStub/$(PlatformName)/$(ConfigurationName)/dnssdStatic.lib ws2_32.lib iphlpapi.lib winspool.lib setupapi.lib"
+ OutputFile="$(OutDir)/PrinterWizard.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile="$(IntDir)/$(ProjectName).pdb"
+ SubSystem="2"
+ EntryPointSymbol="wWinMainCRTStartup"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ AdditionalManifestFiles="res\PrinterSetupWizard64.manifest"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="false"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ AdditionalIncludeDirectories=".;../../mDNSWindows;../../mDNSShared"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;WINVER=0x0501;UNICODE;_UNICODE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1"
+ StringPooling="true"
+ MinimalRebuild="false"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ TreatWChar_tAsBuiltInType="true"
+ UsePrecompiledHeader="0"
+ AssemblerListingLocation="$(IntDir)\"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ DisableSpecificWarnings="4702"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir);../../mDNSWindows"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/NXCOMPAT /DYNAMICBASE /SAFESEH"
+ AdditionalDependencies="../../mDNSWindows/DLLStub/$(PlatformName)/$(ConfigurationName)/dnssdStatic.lib ws2_32.lib iphlpapi.lib winspool.lib setupapi.lib"
+ OutputFile="$(OutDir)/PrinterWizard.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile="$(IntDir)/$(ProjectName).pdb"
+ SubSystem="2"
+ OptimizeReferences="0"
+ EnableCOMDATFolding="0"
+ EntryPointSymbol="wWinMainCRTStartup"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ AdditionalManifestFiles="res\PrinterSetupWizard.manifest"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="if not &quot;%RC_XBS%&quot; == &quot;YES&quot; goto END&#x0D;&#x0A;if not exist &quot;$(DSTROOT)\Program Files\Bonjour Print Services\$(PlatformName)&quot; mkdir &quot;$(DSTROOT)\Program Files\Bonjour Print Services\$(PlatformName)&quot;&#x0D;&#x0A;xcopy /I/Y &quot;$(TargetPath)&quot; &quot;$(DSTROOT)\Program Files\Bonjour Print Services\$(PlatformName)&quot;&#x0D;&#x0A;:END&#x0D;&#x0A;"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="false"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ AdditionalIncludeDirectories=".;../../mDNSWindows;../../mDNSShared"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;WINVER=0x0501;UNICODE;_UNICODE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1"
+ StringPooling="true"
+ MinimalRebuild="false"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ TreatWChar_tAsBuiltInType="true"
+ UsePrecompiledHeader="0"
+ AssemblerListingLocation="$(IntDir)\"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ DisableSpecificWarnings="4702"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir);../../mDNSWindows"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/NXCOMPAT /DYNAMICBASE"
+ AdditionalDependencies="../../mDNSWindows/DLLStub/$(PlatformName)/$(ConfigurationName)/dnssdStatic.lib ws2_32.lib iphlpapi.lib winspool.lib setupapi.lib"
+ OutputFile="$(OutDir)/PrinterWizard.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile="$(IntDir)/$(ProjectName).pdb"
+ SubSystem="2"
+ OptimizeReferences="0"
+ EnableCOMDATFolding="0"
+ EntryPointSymbol="wWinMainCRTStartup"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ AdditionalManifestFiles="res\PrinterSetupWizard64.manifest"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="if not &quot;%RC_XBS%&quot; == &quot;YES&quot; goto END&#x0D;&#x0A;if not exist &quot;$(DSTROOT)\Program Files\Bonjour Print Services\$(PlatformName)&quot; mkdir &quot;$(DSTROOT)\Program Files\Bonjour Print Services\$(PlatformName)&quot;&#x0D;&#x0A;xcopy /I/Y &quot;$(TargetPath)&quot; &quot;$(DSTROOT)\Program Files\Bonjour Print Services\$(PlatformName)&quot;&#x0D;&#x0A;:END&#x0D;&#x0A;"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath=".\About.cpp"
+ >
+ </File>
+ <File
+ RelativePath="FirstPage.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\FourthPage.cpp"
+ >
+ </File>
+ <File
+ RelativePath="PrinterSetupWizardApp.cpp"
+ >
+ </File>
+ <File
+ RelativePath="PrinterSetupWizardSheet.cpp"
+ >
+ </File>
+ <File
+ RelativePath="SecondPage.cpp"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ </File>
+ <File
+ RelativePath="ThirdPage.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath=".\About.h"
+ >
+ </File>
+ <File
+ RelativePath="FirstPage.h"
+ >
+ </File>
+ <File
+ RelativePath=".\FourthPage.h"
+ >
+ </File>
+ <File
+ RelativePath="PrinterSetupWizardApp.h"
+ >
+ </File>
+ <File
+ RelativePath="PrinterSetupWizardSheet.h"
+ >
+ </File>
+ <File
+ RelativePath="resource.h"
+ >
+ </File>
+ <File
+ RelativePath="resource_exe.h"
+ >
+ </File>
+ <File
+ RelativePath="SecondPage.h"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ <File
+ RelativePath="ThirdPage.h"
+ >
+ </File>
+ <File
+ RelativePath=".\UtilTypes.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;jpg;jpeg;jpe;manifest"
+ >
+ <File
+ RelativePath="res\about.bmp"
+ >
+ </File>
+ <File
+ RelativePath="res\banner_icon.bmp"
+ >
+ </File>
+ <File
+ RelativePath="res\Info.ico"
+ >
+ </File>
+ <File
+ RelativePath="res\NetworkPrinter.ico"
+ >
+ </File>
+ <File
+ RelativePath="res\PrinterSetupWizard.manifest"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PrinterSetupWizard.rc"
+ >
+ </File>
+ <File
+ RelativePath="res\watermark.bmp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Support"
+ >
+ <File
+ RelativePath="..\..\mDNSShared\CommonServices.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\mDNSShared\DebugServices.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\mDNSShared\DebugServices.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\mDNSShared\dns_sd.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\mDNSWindows\isocode.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\mDNSWindows\loclibrary.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ DisableSpecificWarnings="4201"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ DisableSpecificWarnings="4201"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\mDNSWindows\loclibrary.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Logger.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Logger.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\mDNSWindows\WinServices.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\mDNSWindows\WinServices.h"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath="ReadMe.txt"
+ >
+ </File>
+ </Files>
+ <Globals>
+ <Global
+ Name="RESOURCE_FILE"
+ Value="PrinterSetupWizard.rc"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizard.vcxproj b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizard.vcxproj
new file mode 100755
index 00000000..563597e3
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizard.vcxproj
@@ -0,0 +1,365 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Template|Win32">
+ <Configuration>Template</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Template|x64">
+ <Configuration>Template</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{B1D2CDA2-CC8F-45D5-A694-2EE45B0308CF}</ProjectGuid>
+ <Keyword>MFCProj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseOfMfc>Static</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseOfMfc>Static</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Template|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseOfMfc>Static</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseOfMfc>Static</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Template|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+ <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IncludePath)</IncludePath>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">PrinterWizard</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">PrinterWizard</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">PrinterWizard</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">PrinterWizard</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">PrinterWizard</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Template|x64'">PrinterWizard</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>false</MkTypLibCompatible>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>.;../../mDNSWindows;../../mDNSShared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUGS;DEBUG=1;WINVER=0x0501;_WIN32_WINNT=0x0501;UNICODE;_UNICODE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
+ <WarningLevel>Level4</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <CallingConvention>Cdecl</CallingConvention>
+ <DisableSpecificWarnings>4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ <AdditionalIncludeDirectories>$(IntDir);../../mDNSWindows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <AdditionalOptions>/NXCOMPAT /DYNAMICBASE /SAFESEH %(AdditionalOptions)</AdditionalOptions>
+ <AdditionalDependencies>../../mDNSWindows/DLLStub/$(Platform)/$(Configuration)/dnssdStatic.lib;ws2_32.lib;iphlpapi.lib;winspool.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)PrinterWizard.exe</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDatabaseFile>$(IntDir)$(ProjectName).pdb</ProgramDatabaseFile>
+ <SubSystem>Windows</SubSystem>
+ <EntryPointSymbol>wWinMainCRTStartup</EntryPointSymbol>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <Manifest>
+ <AdditionalManifestFiles>res\PrinterSetupWizard.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
+ </Manifest>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>false</MkTypLibCompatible>
+ <TargetEnvironment>X64</TargetEnvironment>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>.;../../mDNSWindows;../../mDNSShared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUGS;DEBUG=1;WINVER=0x0501;_WIN32_WINNT=0x0501;UNICODE;_UNICODE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
+ <WarningLevel>Level4</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <CallingConvention>Cdecl</CallingConvention>
+ <DisableSpecificWarnings>4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ <AdditionalIncludeDirectories>$(IntDir);../../mDNSWindows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <AdditionalOptions>/NXCOMPAT /DYNAMICBASE %(AdditionalOptions)</AdditionalOptions>
+ <AdditionalDependencies>../../mDNSWindows/DLLStub/$(Platform)/$(Configuration)/dnssdStatic.lib;ws2_32.lib;iphlpapi.lib;winspool.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)PrinterWizard.exe</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDatabaseFile>$(IntDir)$(ProjectName).pdb</ProgramDatabaseFile>
+ <SubSystem>Windows</SubSystem>
+ <EntryPointSymbol>wWinMainCRTStartup</EntryPointSymbol>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ <Manifest>
+ <AdditionalManifestFiles>res\PrinterSetupWizard64.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
+ </Manifest>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>false</MkTypLibCompatible>
+ </Midl>
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <OmitFramePointers>true</OmitFramePointers>
+ <AdditionalIncludeDirectories>.;../../mDNSWindows;../../mDNSShared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;WINVER=0x0501;_WIN32_WINNT=0x0501;UNICODE;_UNICODE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <MinimalRebuild>false</MinimalRebuild>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
+ <WarningLevel>Level4</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ <AdditionalIncludeDirectories>$(IntDir);../../mDNSWindows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <AdditionalOptions>/NXCOMPAT /DYNAMICBASE /SAFESEH %(AdditionalOptions)</AdditionalOptions>
+ <AdditionalDependencies>../../mDNSWindows/DLLStub/$(Platform)/$(Configuration)/dnssdStatic.lib;ws2_32.lib;iphlpapi.lib;winspool.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)PrinterWizard.exe</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDatabaseFile>$(IntDir)$(ProjectName).pdb</ProgramDatabaseFile>
+ <SubSystem>Windows</SubSystem>
+ <OptimizeReferences>
+ </OptimizeReferences>
+ <EnableCOMDATFolding>
+ </EnableCOMDATFolding>
+ <EntryPointSymbol>wWinMainCRTStartup</EntryPointSymbol>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <Manifest>
+ <AdditionalManifestFiles>res\PrinterSetupWizard.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
+ </Manifest>
+ <PostBuildEvent>
+ <Command>if not "%RC_XBS%" == "YES" goto END
+if not exist "$(DSTROOT)\Program Files\Bonjour Print Services\$(Platform)" mkdir "$(DSTROOT)\Program Files\Bonjour Print Services\$(Platform)"
+xcopy /I/Y "$(TargetPath)" "$(DSTROOT)\Program Files\Bonjour Print Services\$(Platform)"
+:END
+</Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>false</MkTypLibCompatible>
+ <TargetEnvironment>X64</TargetEnvironment>
+ </Midl>
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <OmitFramePointers>true</OmitFramePointers>
+ <AdditionalIncludeDirectories>.;../../mDNSWindows;../../mDNSShared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;WINVER=0x0501;_WIN32_WINNT=0x0501;UNICODE;_UNICODE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <MinimalRebuild>false</MinimalRebuild>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
+ <WarningLevel>Level4</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ <AdditionalIncludeDirectories>$(IntDir);../../mDNSWindows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <AdditionalOptions>/NXCOMPAT /DYNAMICBASE %(AdditionalOptions)</AdditionalOptions>
+ <AdditionalDependencies>../../mDNSWindows/DLLStub/$(Platform)/$(Configuration)/dnssdStatic.lib;ws2_32.lib;iphlpapi.lib;winspool.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)PrinterWizard.exe</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDatabaseFile>$(IntDir)$(ProjectName).pdb</ProgramDatabaseFile>
+ <SubSystem>Windows</SubSystem>
+ <OptimizeReferences>
+ </OptimizeReferences>
+ <EnableCOMDATFolding>
+ </EnableCOMDATFolding>
+ <EntryPointSymbol>wWinMainCRTStartup</EntryPointSymbol>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ <Manifest>
+ <AdditionalManifestFiles>res\PrinterSetupWizard64.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
+ </Manifest>
+ <PostBuildEvent>
+ <Command>if not "%RC_XBS%" == "YES" goto END
+if not exist "$(DSTROOT)\Program Files\Bonjour Print Services\$(Platform)" mkdir "$(DSTROOT)\Program Files\Bonjour Print Services\$(Platform)"
+xcopy /I/Y "$(TargetPath)" "$(DSTROOT)\Program Files\Bonjour Print Services\$(Platform)"
+:END
+</Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="About.cpp" />
+ <ClCompile Include="FirstPage.cpp" />
+ <ClCompile Include="FourthPage.cpp" />
+ <ClCompile Include="PrinterSetupWizardApp.cpp" />
+ <ClCompile Include="PrinterSetupWizardSheet.cpp" />
+ <ClCompile Include="SecondPage.cpp" />
+ <ClCompile Include="stdafx.cpp" />
+ <ClCompile Include="ThirdPage.cpp" />
+ <ClCompile Include="..\..\mDNSShared\DebugServices.c" />
+ <ClCompile Include="..\..\mDNSWindows\loclibrary.c">
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ClCompile Include="Logger.cpp" />
+ <ClCompile Include="..\..\mDNSWindows\WinServices.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="About.h" />
+ <ClInclude Include="FirstPage.h" />
+ <ClInclude Include="FourthPage.h" />
+ <ClInclude Include="PrinterSetupWizardApp.h" />
+ <ClInclude Include="PrinterSetupWizardSheet.h" />
+ <ClInclude Include="resource.h" />
+ <ClInclude Include="resource_exe.h" />
+ <ClInclude Include="SecondPage.h" />
+ <ClInclude Include="stdafx.h" />
+ <ClInclude Include="tcpxcv.h" />
+ <ClInclude Include="ThirdPage.h" />
+ <ClInclude Include="UtilTypes.h" />
+ <ClInclude Include="..\..\mDNSShared\CommonServices.h" />
+ <ClInclude Include="..\..\mDNSShared\DebugServices.h" />
+ <ClInclude Include="..\..\mDNSShared\dns_sd.h" />
+ <ClInclude Include="..\..\mDNSWindows\isocode.h" />
+ <ClInclude Include="..\..\mDNSWindows\loclibrary.h" />
+ <ClInclude Include="Logger.h" />
+ <ClInclude Include="..\..\mDNSWindows\WinServices.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="res\about.bmp" />
+ <None Include="res\banner_icon.bmp" />
+ <None Include="res\Info.ico" />
+ <None Include="res\NetworkPrinter.ico" />
+ <None Include="res\watermark.bmp" />
+ <None Include="ReadMe.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <CustomBuildStep Include="res\PrinterSetupWizard.manifest">
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ </CustomBuildStep>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="PrinterSetupWizard.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\mDNSWindows\DLLStub\DLLStub.vcxproj">
+ <Project>{3a2b6325-3053-4236-84bd-aa9be2e323e5}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+ <ProjectExtensions>
+ <VisualStudio>
+ <UserProperties RESOURCE_FILE="PrinterSetupWizard.rc" />
+ </VisualStudio>
+ </ProjectExtensions>
+</Project> \ No newline at end of file
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizard.vcxproj.filters b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizard.vcxproj.filters
new file mode 100755
index 00000000..d2102791
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizard.vcxproj.filters
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{2a6fb856-bfd6-4cf1-bd97-b1c798cadff4}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{cc2ba15e-c8ac-4990-9bf2-a27b18361b12}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{18aa6a23-2325-46e6-a1e2-45d743d9ff32}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;jpg;jpeg;jpe;manifest</Extensions>
+ </Filter>
+ <Filter Include="Support">
+ <UniqueIdentifier>{5c8be428-d955-40e2-bbb6-349f5867d422}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="About.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="FirstPage.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="FourthPage.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="PrinterSetupWizardApp.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="PrinterSetupWizardSheet.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="SecondPage.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="stdafx.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ThirdPage.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\mDNSShared\DebugServices.c">
+ <Filter>Support</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\mDNSWindows\loclibrary.c">
+ <Filter>Support</Filter>
+ </ClCompile>
+ <ClCompile Include="Logger.cpp">
+ <Filter>Support</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\mDNSWindows\WinServices.cpp">
+ <Filter>Support</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="About.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="FirstPage.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="FourthPage.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="PrinterSetupWizardApp.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="PrinterSetupWizardSheet.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="resource.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="resource_exe.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="SecondPage.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="stdafx.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ThirdPage.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="UtilTypes.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\mDNSShared\CommonServices.h">
+ <Filter>Support</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\mDNSShared\DebugServices.h">
+ <Filter>Support</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\mDNSShared\dns_sd.h">
+ <Filter>Support</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\mDNSWindows\isocode.h">
+ <Filter>Support</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\mDNSWindows\loclibrary.h">
+ <Filter>Support</Filter>
+ </ClInclude>
+ <ClInclude Include="Logger.h">
+ <Filter>Support</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\mDNSWindows\WinServices.h">
+ <Filter>Support</Filter>
+ </ClInclude>
+ <ClInclude Include="tcpxcv.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="res\about.bmp">
+ <Filter>Resource Files</Filter>
+ </None>
+ <None Include="res\banner_icon.bmp">
+ <Filter>Resource Files</Filter>
+ </None>
+ <None Include="res\Info.ico">
+ <Filter>Resource Files</Filter>
+ </None>
+ <None Include="res\NetworkPrinter.ico">
+ <Filter>Resource Files</Filter>
+ </None>
+ <None Include="res\watermark.bmp">
+ <Filter>Resource Files</Filter>
+ </None>
+ <None Include="ReadMe.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="PrinterSetupWizard.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <CustomBuildStep Include="res\PrinterSetupWizard.manifest">
+ <Filter>Resource Files</Filter>
+ </CustomBuildStep>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardApp.cpp b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardApp.cpp
new file mode 100644
index 00000000..d2a896d0
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardApp.cpp
@@ -0,0 +1,172 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "stdafx.h"
+#include "PrinterSetupWizardApp.h"
+#include "PrinterSetupWizardSheet.h"
+#include "DebugServices.h"
+#include "loclibrary.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+#ifndef HeapEnableTerminationOnCorruption
+# define HeapEnableTerminationOnCorruption (HEAP_INFORMATION_CLASS) 1
+#endif
+
+
+// Stash away pointers to our resource DLLs
+
+static HINSTANCE g_nonLocalizedResources = NULL;
+static HINSTANCE g_localizedResources = NULL;
+
+
+HINSTANCE
+GetNonLocalizedResources()
+{
+ return g_nonLocalizedResources;
+}
+
+
+HINSTANCE
+GetLocalizedResources()
+{
+ return g_localizedResources;
+}
+
+
+// CPrinterSetupWizardApp
+
+BEGIN_MESSAGE_MAP(CPrinterSetupWizardApp, CWinApp)
+ ON_COMMAND(ID_HELP, CWinApp::OnHelp)
+END_MESSAGE_MAP()
+
+
+// CPrinterSetupWizardApp construction
+
+CPrinterSetupWizardApp::CPrinterSetupWizardApp()
+{
+ // TODO: add construction code here,
+ // Place all significant initialization in InitInstance
+}
+
+
+// The one and only CPrinterSetupWizardApp object
+
+CPrinterSetupWizardApp theApp;
+
+
+// CPrinterSetupWizardApp initialization
+
+BOOL CPrinterSetupWizardApp::InitInstance()
+{
+ CString errorMessage;
+ CString errorCaption;
+ wchar_t resource[MAX_PATH];
+ int res;
+ OSStatus err = kNoErr;
+
+ HeapSetInformation( NULL, HeapEnableTerminationOnCorruption, NULL, 0 );
+
+ //
+ // initialize the debugging framework
+ //
+ debug_initialize( kDebugOutputTypeWindowsDebugger, "PrinterSetupWizard", NULL );
+ debug_set_property( kDebugPropertyTagPrintLevel, kDebugLevelTrace );
+
+ // Before we load the resources, let's load the error string
+
+ errorMessage.LoadString( IDS_REINSTALL );
+ errorCaption.LoadString( IDS_REINSTALL_CAPTION );
+
+ // Load Resources
+
+ res = PathForResource( NULL, L"PrinterWizardResources.dll", resource, MAX_PATH );
+ err = translate_errno( res != 0, kUnknownErr, kUnknownErr );
+ require_noerr( err, exit );
+
+ g_nonLocalizedResources = LoadLibrary( resource );
+ translate_errno( g_nonLocalizedResources, GetLastError(), kUnknownErr );
+ require_noerr( err, exit );
+
+ res = PathForResource( NULL, L"PrinterWizardLocalized.dll", resource, MAX_PATH );
+ err = translate_errno( res != 0, kUnknownErr, kUnknownErr );
+ require_noerr( err, exit );
+
+ g_localizedResources = LoadLibrary( resource );
+ translate_errno( g_localizedResources, GetLastError(), kUnknownErr );
+ require_noerr( err, exit );
+
+ AfxSetResourceHandle( g_localizedResources );
+
+ // InitCommonControls() is required on Windows XP if an application
+ // manifest specifies use of ComCtl32.dll version 6 or later to enable
+ // visual styles. Otherwise, any window creation will fail.
+ InitCommonControls();
+
+ CWinApp::InitInstance();
+
+ AfxEnableControlContainer();
+
+ {
+ CPrinterSetupWizardSheet dlg(IDS_CAPTION);
+
+ m_pMainWnd = &dlg;
+
+ try
+ {
+ INT_PTR nResponse = dlg.DoModal();
+
+ if (nResponse == IDOK)
+ {
+ // TODO: Place code here to handle when the dialog is
+ // dismissed with OK
+ }
+ else if (nResponse == IDCANCEL)
+ {
+ // TODO: Place code here to handle when the dialog is
+ // dismissed with Cancel
+ }
+ }
+ catch (CPrinterSetupWizardSheet::WizardException & exc)
+ {
+ MessageBox(NULL, exc.text, exc.caption, MB_OK|MB_ICONEXCLAMATION);
+ }
+ }
+
+exit:
+
+ if ( err )
+ {
+ MessageBox( NULL, errorMessage, errorCaption, MB_ICONERROR | MB_OK );
+ }
+
+ if ( g_nonLocalizedResources )
+ {
+ FreeLibrary( g_nonLocalizedResources );
+ }
+
+ if ( g_localizedResources )
+ {
+ FreeLibrary( g_localizedResources );
+ }
+
+ // Since the dialog has been closed, return FALSE so that we exit the
+ // application, rather than start the application's message pump.
+ return FALSE;
+}
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardApp.h b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardApp.h
new file mode 100644
index 00000000..379c9e4b
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardApp.h
@@ -0,0 +1,48 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#ifndef __AFXWIN_H__
+ #error include 'stdafx.h' before including this file for PCH
+#endif
+
+#include "resource.h" // main symbols
+
+
+// CWiz97_3App:
+// See Wiz97_3.cpp for the implementation of this class
+//
+
+class CPrinterSetupWizardApp : public CWinApp
+{
+public:
+CPrinterSetupWizardApp();
+
+// Overrides
+public:
+virtual BOOL InitInstance();
+
+// Implementation
+
+DECLARE_MESSAGE_MAP()
+};
+
+
+extern CPrinterSetupWizardApp theApp;
+extern HINSTANCE GetNonLocalizedResources();
+extern HINSTANCE GetLocalizedResources();
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardLocRes.rc b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardLocRes.rc
new file mode 100755
index 00000000..198890fd
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardLocRes.rc
@@ -0,0 +1,310 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource_loc_res.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+#include "WinVersRes.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Russian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
+#ifdef _WIN32
+LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
+#pragma code_page(1251)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource_loc_res.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "#include ""WinVersRes.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+ "#define _AFX_NO_OLE_RESOURCES\r\n"
+ "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+ "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+ "\r\n"
+ "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
+ "LANGUAGE 9, 1\r\n"
+ "#pragma code_page(1252)\r\n"
+ "#include ""res\\PrinterSetupWizardLocRes.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
+ "#include ""afxres.rc"" // Standard components\r\n"
+ "#endif\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // Russian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_ABOUTBOX DIALOGEX 0, 0, 235, 55
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "About Printer Wizard"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ ICON 128,IDC_STATIC,11,17,20,20
+ LTEXT "Printer Wizard Version 1.0",IDC_STATIC,40,10,119,
+ 8,SS_NOPREFIX
+ LTEXT "Copyright (C) 2002",IDC_STATIC,40,25,119,8
+ DEFPUSHBUTTON "OK",IDOK,178,7,50,16,WS_GROUP
+END
+
+IDD_PRINTERSETUPWIZARD_DIALOG DIALOGEX 0, 0, 320, 200
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE |
+ WS_CAPTION | WS_SYSMENU
+EXSTYLE WS_EX_APPWINDOW
+CAPTION "Bonjour Printer Wizard"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,263,7,50,16
+ PUSHBUTTON "Cancel",IDCANCEL,263,25,50,16
+ PUSHBUTTON "Start Wizard",IDC_BUTTON1,100,86,109,35
+END
+
+IDD_SECOND_PAGE DIALOGEX 0, 0, 290, 154
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
+CAPTION "Bonjour Printer Wizard"
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
+BEGIN
+ LTEXT "Shared printers:",IDC_STATIC,3,0,171,8
+ CONTROL "",IDC_BROWSE_LIST,"SysTreeView32",TVS_DISABLEDRAGDROP |
+ TVS_SHOWSELALWAYS | TVS_FULLROWSELECT | WS_BORDER |
+ WS_TABSTOP,2,11,286,101
+ LTEXT "Description:",IDC_DESCRIPTION_LABEL,13,128,39,8
+ LTEXT "Location:",IDC_LOCATION_LABEL,13,139,30,8
+ GROUPBOX "Printer information",IDC_PRINTER_INFORMATION,2,116,286,
+ 37
+ LTEXT "",IDC_DESCRIPTION_FIELD,57,128,226,8
+ LTEXT "",IDC_LOCATION_FIELD,57,139,226,8
+END
+
+IDD_FIRST_PAGE DIALOGEX 0, 0, 290, 199
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
+CAPTION "Bonjour Printer Wizard"
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
+BEGIN
+ LTEXT "Welcome to the Bonjour Printer Wizard",
+ IDC_GREETING,114,7,171,46
+ LTEXT "To continue, click Next.",IDC_STATIC,115,188,143,8
+ LTEXT "This wizard helps you connect to a shared printer using Bonjour. Make sure your printer is turned on and connected to your network.",
+ IDC_STATIC,114,60,171,62
+END
+
+IDD_THIRD_PAGE DIALOGEX 0, 0, 290, 154
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "Bonjour Printer Wizard"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ CONTROL "",IDC_PRINTER_MODEL,"SysListView32",LVS_REPORT |
+ LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING |
+ LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,110,58,178,76
+ CONTROL "",IDC_PRINTER_MANUFACTURER,"SysListView32",LVS_REPORT |
+ LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING |
+ LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,2,58,105,76
+ ICON 1017,1,3,5,20,27
+ LTEXT "",IDC_PRINTER_NAME,40,5,173,8
+ LTEXT "The Bonjour Printer Wizard has auto-selected the following printer settings. To continue installing this printer, click Next.",
+ IDC_PRINTER_SELECTION_TEXT,40,18,243,33
+ CONTROL "Use this printer as the default printer",
+ IDC_DEFAULT_PRINTER,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,3,142,140,10
+ PUSHBUTTON "Have Disk...",IDC_HAVE_DISK,238,140,50,14
+END
+
+IDD_FOURTH_PAGE DIALOGEX 0, 0, 290, 199
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
+CAPTION "Bonjour Printer Wizard"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ LTEXT "Completing the Bonjour Printer Wizard",IDC_GOODBYE,
+ 116,7,171,27
+ LTEXT "You are ready to complete the Bonjour Printer Wizard. The printer has the following settings:",
+ IDC_STATIC,116,42,171,31
+ LTEXT "Name:",IDC_STATIC,116,78,22,8
+ LTEXT "Manufacturer:",IDC_STATIC,116,91,47,8
+ LTEXT "Model:",IDC_STATIC,116,104,22,8
+ LTEXT "Protocol:",IDC_STATIC,116,117,38,8
+ LTEXT "Default:",IDC_STATIC,116,130,27,8
+ LTEXT "",IDC_PRINTER_NAME,172,78,113,8,SS_ENDELLIPSIS
+ LTEXT "",IDC_PRINTER_MANUFACTURER,172,91,113,8
+ LTEXT "",IDC_PRINTER_MODEL,172,104,113,8
+ LTEXT "",IDC_PRINTER_PROTOCOL,172,117,113,8
+ LTEXT "",IDC_PRINTER_DEFAULT,172,130,113,8
+ LTEXT "To complete the installation, click Finish.",IDC_COMPLETE1,116,180,171,8
+ LTEXT "To change these settings, click Back.",IDC_COMPLETE2,116,190,171,8
+ LTEXT "Please wait a few moments while the Bonjour Printer Wizard installs the printer.",IDC_INSTALLING,116,170,171,31
+ CONTROL "",IDC_PROGRESS,"msctls_progress32",WS_BORDER,116,190,165,8
+END
+
+IDD_DIALOG1 DIALOGEX 0, 0, 265, 130
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "Dialog"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ CONTROL 138,IDC_STATIC,"Static",SS_BITMAP | SS_REALSIZEIMAGE,0,0,
+ 265,131
+ LTEXT "Static",IDC_STATIC,77,12,19,8
+ LTEXT "Static",IDC_STATIC,71,46,19,8
+ LTEXT "Static",IDC_STATIC,71,89,19,8
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION MASTER_PROD_VERS
+ PRODUCTVERSION MASTER_PROD_VERS
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904e4"
+ BEGIN
+ VALUE "CompanyName", MASTER_COMPANY_NAME
+ VALUE "FileDescription", "Bonjour Resource Module"
+ VALUE "FileVersion", MASTER_PROD_VERS_STR
+ VALUE "InternalName", "PrinterWizardLocalized.dll"
+ VALUE "LegalCopyright", MASTER_LEGAL_COPYRIGHT
+ VALUE "OriginalFilename", "PrinterWizardLocalized.dll"
+ VALUE "ProductName", MASTER_PROD_NAME
+ VALUE "ProductVersion", MASTER_PROD_VERS_STR
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1252
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE
+BEGIN
+ IDS_ABOUTBOX "&About Bonjour Printer Wizard..."
+ IDS_GOODBYE "Completing the Bonjour Printer Wizard."
+ IDS_GREETING "Welcome to the Bonjour Printer Wizard"
+ IDS_BROWSE_TITLE "Browse for Bonjour Printers"
+ IDS_BROWSE_SUBTITLE "Select the printer you want to use from the list below."
+ IDS_CAPTION "Bonjour Printer Wizard"
+ IDS_GOODBYE_GOOD1 "You are ready to complete the Bonjour Printer Wizard. The printer has the following settings:"
+ IDS_SEARCHING "Searching for printers..."
+ IDS_GOODBYTE_GOOD2 "To complete the installation, click Finish."
+ IDS_INSTALL_TITLE "Install Bonjour Printer"
+ IDS_INSTALL_SUBTITLE "The manufacturer and model determine which printer software to use."
+END
+
+STRINGTABLE
+BEGIN
+ IDS_ERROR_SELECTING_PRINTER_TEXT
+ "There was an error selecting this printer."
+ IDS_ERROR_SELECTING_PRINTER_CAPTION "Error"
+ IDS_INSTALL_ERROR_CAPTION "Error"
+ IDS_INSTALL_ERROR_MESSAGE
+ "You do not have sufficient access to your computer to connect to the selected printer."
+ IDS_NO_MATCH_INF_FILE "The software that you chose does not match the selected printer."
+ IDS_NO_MATCH_INF_FILE_CAPTION "Select Device"
+ IDS_BAD_INF_FILE "The specified location does not contain information about your printer"
+ IDS_BAD_INF_FILE_CAPTION "Select Device"
+ IDS_MANUFACTURER_HEADING "Manufacturer"
+ IDS_MODEL_HEADING "Model"
+ IDS_NO_PRINTERS "No Bonjour Printers are available"
+ IDS_NO_MDNSRESPONDER_SERVICE_TEXT "Bonjour Service is not available."
+ IDS_NO_MDNSRESPONDER_SERVICE_CAPTION "Error"
+ IDS_PRINTER_MATCH_GOOD "The Bonjour Printer Wizard has auto-selected the following printer settings. Click 'Next' to continue installing this printer."
+ IDS_PRINTER_MATCH_BAD "The Bonjour Printer Wizard cannot find a driver for this printer. Manually select from the list, or click 'Have Disk' if your printer came with an installation disk. "
+ IDS_PRINTER_MATCH_MAYBE "The Bonjour Printer Wizard has selected a generic printer driver for this printer. If your printer came with an installation disk, click 'Have Disk' now to load the manufacturer's drivers."
+ IDS_YES "Yes"
+ IDS_NO "No"
+ IDS_LARGE_FONT "MS Sans Serif"
+ IDS_FIREWALL "Please check firewall setting to ensure the Bonjour Printer Wizard operates correctly."
+ IDS_ERROR_CAPTION "Error"
+ IDS_PRINTER_UNAVAILABLE "The Bonjour printer you have selected is no longer available. Please make sure the printer is powered-on and plugged-in."
+END
+
+STRINGTABLE
+BEGIN
+ IDS_FIREWALL_CAPTION "Firewall Detected"
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#pragma code_page(1252)
+#include "res\PrinterSetupWizardLocRes.rc2" // non-Microsoft Visual C++ edited resources
+#include "afxres.rc" // Standard components
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardLocRes.vcproj b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardLocRes.vcproj
new file mode 100755
index 00000000..3b3c68f9
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardLocRes.vcproj
@@ -0,0 +1,441 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="PrinterSetupWizardLocRes"
+ ProjectGUID="{967F5375-0176-43D3-ADA3-22EE25551C37}"
+ Keyword="MFCProj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="false"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\mDNSWindows"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUGS;DEBUG=1;WINVER=0x0400;UNICODE;_UNICODE"
+ StringPooling="true"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="true"
+ TreatWChar_tAsBuiltInType="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ CallingConvention="0"
+ DisableSpecificWarnings="4702"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir);../../mDNSWindows"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ Description="Building Output Directories"
+ CommandLine="if not exist $(OutDir)\PrinterWizard.Resources mkdir $(OutDir)\PrinterWizard.Resources&#x0D;&#x0A;if not exist $(OutDir)\PrinterWizard.Resources\en.lproj mkdir $(OutDir)\PrinterWizard.Resources\en.lproj&#x0D;&#x0A;"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\PrinterWizard.Resources\en.lproj\PrinterWizardLocalized.dll"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ EntryPointSymbol=""
+ ResourceOnlyDLL="true"
+ ImportLibrary="$(OutDir)/Localized.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="false"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\mDNSWindows"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUGS;DEBUG=1;WINVER=0x0400;UNICODE;_UNICODE"
+ StringPooling="true"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="true"
+ TreatWChar_tAsBuiltInType="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ CallingConvention="0"
+ DisableSpecificWarnings="4702"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir);../../mDNSWindows"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ Description="Building Output Directories"
+ CommandLine="if not exist $(OutDir)\PrinterWizard.Resources mkdir $(OutDir)\PrinterWizard.Resources&#x0D;&#x0A;if not exist $(OutDir)\PrinterWizard.Resources\en.lproj mkdir $(OutDir)\PrinterWizard.Resources\en.lproj&#x0D;&#x0A;"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\PrinterWizard.Resources\en.lproj\PrinterWizardLocalized.dll"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ EntryPointSymbol=""
+ ResourceOnlyDLL="true"
+ ImportLibrary="$(OutDir)/Localized.lib"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="false"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ AdditionalIncludeDirectories="..\..\mDNSWindows"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;WINVER=0x0400;UNICODE;_UNICODE"
+ StringPooling="true"
+ MinimalRebuild="false"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ TreatWChar_tAsBuiltInType="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ DisableSpecificWarnings="4702"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir);../../mDNSWindows"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ Description="Building Output Directories"
+ CommandLine="if not exist $(OutDir)\PrinterWizard.Resources mkdir $(OutDir)\PrinterWizard.Resources&#x0D;&#x0A;if not exist $(OutDir)\PrinterWizard.Resources\en.lproj mkdir $(OutDir)\PrinterWizard.Resources\en.lproj&#x0D;&#x0A;"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\PrinterWizard.Resources\en.lproj\PrinterWizardLocalized.dll"
+ LinkIncremental="1"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="0"
+ EnableCOMDATFolding="0"
+ EntryPointSymbol=""
+ ResourceOnlyDLL="true"
+ ImportLibrary="$(IntDir)/$(TargetName).lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="if not &quot;%RC_XBS%&quot; == &quot;YES&quot; goto END&#x0D;&#x0A;if not exist &quot;$(DSTROOT)\Program Files\Bonjour Print Services\$(PlatformName)\PrinterWizard.Resources\en.lproj&quot; mkdir &quot;$(DSTROOT)\Program Files\Bonjour Print Services\$(PlatformName)\PrinterWizard.Resources\en.lproj&quot;&#x0D;&#x0A;xcopy /I/Y &quot;$(TargetPath)&quot; &quot;$(DSTROOT)\Program Files\Bonjour Print Services\$(PlatformName)\PrinterWizard.Resources\en.lproj&quot;&#x0D;&#x0A;:END&#x0D;&#x0A;"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="false"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ AdditionalIncludeDirectories="..\..\mDNSWindows"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;WINVER=0x0400;UNICODE;_UNICODE"
+ StringPooling="true"
+ MinimalRebuild="false"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ TreatWChar_tAsBuiltInType="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ DisableSpecificWarnings="4702"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir);../../mDNSWindows"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ Description="Building Output Directories"
+ CommandLine="if not exist $(OutDir)\PrinterWizard.Resources mkdir $(OutDir)\PrinterWizard.Resources&#x0D;&#x0A;if not exist $(OutDir)\PrinterWizard.Resources\en.lproj mkdir $(OutDir)\PrinterWizard.Resources\en.lproj&#x0D;&#x0A;"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\PrinterWizard.Resources\en.lproj\PrinterWizardLocalized.dll"
+ LinkIncremental="1"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="0"
+ EnableCOMDATFolding="0"
+ EntryPointSymbol=""
+ ResourceOnlyDLL="true"
+ ImportLibrary="$(IntDir)/$(TargetName).lib"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="if not &quot;%RC_XBS%&quot; == &quot;YES&quot; goto END&#x0D;&#x0A;if not exist &quot;$(DSTROOT)\Program Files\Bonjour Print Services\$(PlatformName)\PrinterWizard.Resources\en.lproj&quot; mkdir &quot;$(DSTROOT)\Program Files\Bonjour Print Services\$(PlatformName)\PrinterWizard.Resources\en.lproj&quot;&#x0D;&#x0A;xcopy /I/Y &quot;$(TargetPath)&quot; &quot;$(DSTROOT)\Program Files\Bonjour Print Services\$(PlatformName)\PrinterWizard.Resources\en.lproj&quot;&#x0D;&#x0A;:END&#x0D;&#x0A;"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath="resource_loc_dll.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;jpg;jpeg;jpe;manifest"
+ >
+ <File
+ RelativePath="PrinterSetupWizardLocRes.rc"
+ >
+ </File>
+ <File
+ RelativePath="res\PrinterSetupWizardLocRes.rc2"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath="ReadMe.txt"
+ >
+ </File>
+ </Files>
+ <Globals>
+ <Global
+ Name="RESOURCE_FILE"
+ Value="PrinterSetupWizardLocRes.rc"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardLocRes.vcxproj b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardLocRes.vcxproj
new file mode 100755
index 00000000..86affb8c
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardLocRes.vcxproj
@@ -0,0 +1,345 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Template|Win32">
+ <Configuration>Template</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Template|x64">
+ <Configuration>Template</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{967F5375-0176-43D3-ADA3-22EE25551C37}</ProjectGuid>
+ <Keyword>MFCProj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>Static</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>Static</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Template|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>Static</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>Static</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Template|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\PrinterWizard.Resources\en.lproj\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\PrinterWizard.Resources\en.lproj\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\PrinterWizard.Resources\en.lproj\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\PrinterWizard.Resources\en.lproj\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">$(Platform)\$(Configuration)\PrinterWizard.Resources\en.lproj\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">$(Platform)\$(Configuration)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Template|x64'">$(Platform)\$(Configuration)\PrinterWizard.Resources\en.lproj\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Template|x64'">$(Platform)\$(Configuration)\</IntDir>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">PrinterWizardLocalized</TargetName>
+ <TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.dll</TargetExt>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">PrinterWizardLocalized</TargetName>
+ <TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.dll</TargetExt>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">PrinterWizardLocalized</TargetName>
+ <TargetExt Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">.dll</TargetExt>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">PrinterWizardLocalized</TargetName>
+ <TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.dll</TargetExt>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">PrinterWizardLocalized</TargetName>
+ <TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.dll</TargetExt>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Template|x64'">PrinterWizardLocalized</TargetName>
+ <TargetExt Condition="'$(Configuration)|$(Platform)'=='Template|x64'">.dll</TargetExt>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>false</MkTypLibCompatible>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\mDNSWindows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUGS;DEBUG=1;WINVER=0x0400;UNICODE;_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level4</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ <CallingConvention>Cdecl</CallingConvention>
+ <DisableSpecificWarnings>4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ <AdditionalIncludeDirectories>$(IntDir);../../mDNSWindows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <PreLinkEvent>
+ <Message>Building Output Directories</Message>
+ <Command>if not exist $(OutDir)PrinterWizard.Resources mkdir $(OutDir)PrinterWizard.Resources
+if not exist $(OutDir)PrinterWizard.Resources\en.lproj mkdir $(OutDir)PrinterWizard.Resources\en.lproj
+</Command>
+ </PreLinkEvent>
+ <Link>
+ <OutputFile>$(OutDir)PrinterWizardLocalized.dll</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <EntryPointSymbol>
+ </EntryPointSymbol>
+ <NoEntryPoint>true</NoEntryPoint>
+ <ImportLibrary>$(OutDir)Localized.lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>false</MkTypLibCompatible>
+ <TargetEnvironment>X64</TargetEnvironment>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\mDNSWindows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUGS;DEBUG=1;WINVER=0x0400;UNICODE;_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level4</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <CallingConvention>Cdecl</CallingConvention>
+ <DisableSpecificWarnings>4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ <AdditionalIncludeDirectories>$(IntDir);../../mDNSWindows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <PreLinkEvent>
+ <Message>Building Output Directories</Message>
+ <Command>if not exist $(OutDir)PrinterWizard.Resources mkdir $(OutDir)PrinterWizard.Resources
+if not exist $(OutDir)PrinterWizard.Resources\en.lproj mkdir $(OutDir)PrinterWizard.Resources\en.lproj
+</Command>
+ </PreLinkEvent>
+ <Link>
+ <OutputFile>$(OutDir)PrinterWizardLocalized.dll</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <EntryPointSymbol>
+ </EntryPointSymbol>
+ <NoEntryPoint>true</NoEntryPoint>
+ <ImportLibrary>$(OutDir)Localized.lib</ImportLibrary>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>false</MkTypLibCompatible>
+ </Midl>
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <OmitFramePointers>true</OmitFramePointers>
+ <AdditionalIncludeDirectories>..\..\mDNSWindows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;WINVER=0x0400;UNICODE;_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <MinimalRebuild>false</MinimalRebuild>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level4</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ <AdditionalIncludeDirectories>$(IntDir);../../mDNSWindows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <PreLinkEvent>
+ <Message>Building Output Directories</Message>
+ <Command>if not exist $(OutDir)PrinterWizard.Resources mkdir $(OutDir)PrinterWizard.Resources
+if not exist $(OutDir)PrinterWizard.Resources\en.lproj mkdir $(OutDir)PrinterWizard.Resources\en.lproj
+</Command>
+ </PreLinkEvent>
+ <Link>
+ <OutputFile>$(OutDir)PrinterWizardLocalized.dll</OutputFile>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <OptimizeReferences>
+ </OptimizeReferences>
+ <EnableCOMDATFolding>
+ </EnableCOMDATFolding>
+ <EntryPointSymbol>
+ </EntryPointSymbol>
+ <NoEntryPoint>true</NoEntryPoint>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <PostBuildEvent>
+ <Command>if not "%RC_XBS%" == "YES" goto END
+if not exist "$(DSTROOT)\Program Files\Bonjour Print Services\$(Platform)\PrinterWizard.Resources\en.lproj" mkdir "$(DSTROOT)\Program Files\Bonjour Print Services\$(Platform)\PrinterWizard.Resources\en.lproj"
+xcopy /I/Y "$(TargetPath)" "$(DSTROOT)\Program Files\Bonjour Print Services\$(Platform)\PrinterWizard.Resources\en.lproj"
+:END
+</Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>false</MkTypLibCompatible>
+ <TargetEnvironment>X64</TargetEnvironment>
+ </Midl>
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <OmitFramePointers>true</OmitFramePointers>
+ <AdditionalIncludeDirectories>..\..\mDNSWindows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;WINVER=0x0400;UNICODE;_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <MinimalRebuild>false</MinimalRebuild>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level4</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ <AdditionalIncludeDirectories>$(IntDir);../../mDNSWindows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <PreLinkEvent>
+ <Message>Building Output Directories</Message>
+ <Command>if not exist $(OutDir)PrinterWizard.Resources mkdir $(OutDir)PrinterWizard.Resources
+if not exist $(OutDir)PrinterWizard.Resources\en.lproj mkdir $(OutDir)PrinterWizard.Resources\en.lproj
+</Command>
+ </PreLinkEvent>
+ <Link>
+ <OutputFile>$(OutDir)PrinterWizardLocalized.dll</OutputFile>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <OptimizeReferences>
+ </OptimizeReferences>
+ <EnableCOMDATFolding>
+ </EnableCOMDATFolding>
+ <EntryPointSymbol>
+ </EntryPointSymbol>
+ <NoEntryPoint>true</NoEntryPoint>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ <PostBuildEvent>
+ <Command>if not "%RC_XBS%" == "YES" goto END
+if not exist "$(DSTROOT)\Program Files\Bonjour Print Services\$(Platform)\PrinterWizard.Resources\en.lproj" mkdir "$(DSTROOT)\Program Files\Bonjour Print Services\$(Platform)\PrinterWizard.Resources\en.lproj"
+xcopy /I/Y "$(TargetPath)" "$(DSTROOT)\Program Files\Bonjour Print Services\$(Platform)\PrinterWizard.Resources\en.lproj"
+:END
+</Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">
+ <Link>
+ <OutputFile>$(OutDir)PrinterWizardLocalized.dll</OutputFile>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Template|x64'">
+ <Link>
+ <OutputFile>$(OutDir)PrinterWizardLocalized.dll</OutputFile>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="resource_loc_dll.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="PrinterSetupWizardLocRes.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="res\PrinterSetupWizardLocRes.rc2" />
+ <None Include="ReadMe.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\mDNSWindows\DLL\dnssd.vcxproj">
+ <Project>{ab581101-18f0-46f6-b56a-83a6b1ea657e}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+ <ProjectExtensions>
+ <VisualStudio>
+ <UserProperties RESOURCE_FILE="PrinterSetupWizardLocRes.rc" />
+ </VisualStudio>
+ </ProjectExtensions>
+</Project> \ No newline at end of file
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardLocRes.vcxproj.filters b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardLocRes.vcxproj.filters
new file mode 100755
index 00000000..b0c2900e
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardLocRes.vcxproj.filters
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{7a783aeb-7735-4f37-9b8d-ae201c3bf118}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{e9d0d017-9740-4270-9ab9-b3b50c3bff30}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;jpg;jpeg;jpe;manifest</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="resource_loc_dll.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="PrinterSetupWizardLocRes.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="res\PrinterSetupWizardLocRes.rc2">
+ <Filter>Resource Files</Filter>
+ </None>
+ <None Include="ReadMe.txt" />
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardRes.rc b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardRes.rc
new file mode 100755
index 00000000..067aabfe
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardRes.rc
@@ -0,0 +1,173 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource_res.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+#include "WinVersRes.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Russian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
+#ifdef _WIN32
+LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
+#pragma code_page(1251)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource_res.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "#include ""WinVersRes.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+ "#define _AFX_NO_OLE_RESOURCES\r\n"
+ "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+ "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+ "\r\n"
+ "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
+ "LANGUAGE 9, 1\r\n"
+ "#pragma code_page(1252)\r\n"
+ "#include ""res\\PrinterSetupWizardRes.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
+ "#include ""afxres.rc"" // Standard components\r\n"
+ "#endif\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // Russian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDR_MAINFRAME ICON "res\\NetworkPrinter.ico"
+IDI_INFO ICON "res\\Info.ico"
+IDI_PRINTER ICON "res\\NetworkPrinter.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Bitmap
+//
+
+IDB_WATERMARK BITMAP "res\\watermark.bmp"
+IDB_BANNER_ICON BITMAP "res\\banner_icon.bmp"
+IDB_ABOUT BITMAP "res\\about.bmp"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION MASTER_PROD_VERS
+ PRODUCTVERSION MASTER_PROD_VERS
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904e4"
+ BEGIN
+ VALUE "CompanyName", MASTER_COMPANY_NAME
+ VALUE "FileDescription", "Bonjour Resource Module"
+ VALUE "FileVersion", MASTER_PROD_VERS_STR
+ VALUE "InternalName", "PrinterWizardLocalized.dll"
+ VALUE "LegalCopyright", MASTER_LEGAL_COPYRIGHT
+ VALUE "OriginalFilename", "PrinterWizardLocalized.dll"
+ VALUE "ProductName", MASTER_PROD_NAME
+ VALUE "ProductVersion", MASTER_PROD_VERS_STR
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1252
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+#endif // APSTUDIO_INVOKED
+
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#pragma code_page(1252)
+#include "res\PrinterSetupWizardRes.rc2" // non-Microsoft Visual C++ edited resources
+#include "afxres.rc" // Standard components
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardRes.vcproj b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardRes.vcproj
new file mode 100755
index 00000000..07d05f07
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardRes.vcproj
@@ -0,0 +1,465 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="PrinterSetupWizardRes"
+ ProjectGUID="{CFCCB176-6CAA-472B-B0A2-90511C8E2E52}"
+ Keyword="MFCProj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="false"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\mDNSWindows"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUGS;DEBUG=1;WINVER=0x0400;UNICODE;_UNICODE"
+ StringPooling="true"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="true"
+ TreatWChar_tAsBuiltInType="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ CallingConvention="0"
+ DisableSpecificWarnings="4702"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir);../../mDNSWindows"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ Description="Building Output Directories"
+ CommandLine="if not exist Debug\PrinterWizard.Resources mkdir Debug\PrinterWizard.Resources"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\PrinterWizard.Resources\PrinterWizardResources.dll"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ EntryPointSymbol=""
+ ResourceOnlyDLL="true"
+ ImportLibrary="$(OutDir)/Localized.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="false"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\mDNSWindows"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUGS;DEBUG=1;WINVER=0x0400;UNICODE;_UNICODE"
+ StringPooling="true"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="true"
+ TreatWChar_tAsBuiltInType="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ CallingConvention="0"
+ DisableSpecificWarnings="4702"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir);../../mDNSWindows"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ Description="Building Output Directories"
+ CommandLine="if not exist Debug\PrinterWizard.Resources mkdir Debug\PrinterWizard.Resources"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\PrinterWizard.Resources\PrinterWizardResources.dll"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ EntryPointSymbol=""
+ ResourceOnlyDLL="true"
+ ImportLibrary="$(OutDir)/Localized.lib"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="false"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ AdditionalIncludeDirectories="..\..\mDNSWindows"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;WINVER=0x0400;UNICODE;_UNICODE"
+ StringPooling="true"
+ MinimalRebuild="false"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ TreatWChar_tAsBuiltInType="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ DisableSpecificWarnings="4702"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir);../../mDNSWindows"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ Description="Building Output Directories"
+ CommandLine="if not exist Release mkdir Release&#x0D;&#x0A;if not exist &quot;Release\PrinterWizard.Resources&quot; mkdir &quot;Release\PrinterWizard.Resources&quot;&#x0D;&#x0A;"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\PrinterWizard.Resources\PrinterWizardResources.dll"
+ LinkIncremental="1"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="0"
+ EnableCOMDATFolding="0"
+ EntryPointSymbol=""
+ ResourceOnlyDLL="true"
+ ImportLibrary="$(IntDir)/$(TargetName).lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="if not &quot;%RC_XBS%&quot; == &quot;YES&quot; goto END&#x0D;&#x0A;if not exist &quot;$(DSTROOT)\Program Files\Bonjour Print Services\$(PlatformName)\PrinterWizard.Resources&quot; mkdir &quot;$(DSTROOT)\Program Files\Bonjour Print Services\$(PlatformName)\PrinterWizard.Resources&quot;&#x0D;&#x0A;xcopy /I/Y &quot;$(TargetPath)&quot; &quot;$(DSTROOT)\Program Files\Bonjour Print Services\$(PlatformName)\PrinterWizard.Resources&quot;&#x0D;&#x0A;:END&#x0D;&#x0A;"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="false"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ AdditionalIncludeDirectories="..\..\mDNSWindows"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;WINVER=0x0400;UNICODE;_UNICODE"
+ StringPooling="true"
+ MinimalRebuild="false"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ TreatWChar_tAsBuiltInType="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ DisableSpecificWarnings="4702"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir);../../mDNSWindows"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ Description="Building Output Directories"
+ CommandLine="if not exist Release mkdir Release&#x0D;&#x0A;if not exist &quot;Release\PrinterWizard.Resources&quot; mkdir &quot;Release\PrinterWizard.Resources&quot;&#x0D;&#x0A;"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\PrinterWizard.Resources\PrinterWizardResources.dll"
+ LinkIncremental="1"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="0"
+ EnableCOMDATFolding="0"
+ EntryPointSymbol=""
+ ResourceOnlyDLL="true"
+ ImportLibrary="$(IntDir)/$(TargetName).lib"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="if not &quot;%RC_XBS%&quot; == &quot;YES&quot; goto END&#x0D;&#x0A;if not exist &quot;$(DSTROOT)\Program Files\Bonjour Print Services\$(PlatformName)\PrinterWizard.Resources&quot; mkdir &quot;$(DSTROOT)\Program Files\Bonjour Print Services\$(PlatformName)\PrinterWizard.Resources&quot;&#x0D;&#x0A;xcopy /I/Y &quot;$(TargetPath)&quot; &quot;$(DSTROOT)\Program Files\Bonjour Print Services\$(PlatformName)\PrinterWizard.Resources&quot;&#x0D;&#x0A;:END&#x0D;&#x0A;"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath="resource_dll.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;jpg;jpeg;jpe;manifest"
+ >
+ <File
+ RelativePath=".\res\about.bmp"
+ >
+ </File>
+ <File
+ RelativePath="res\banner_icon.bmp"
+ >
+ </File>
+ <File
+ RelativePath=".\res\Info.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\res\NetworkPrinter.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\res\Printer.bmp"
+ >
+ </File>
+ <File
+ RelativePath="PrinterSetupWizardRes.rc"
+ >
+ </File>
+ <File
+ RelativePath="res\PrinterSetupWizardRes.rc2"
+ >
+ </File>
+ <File
+ RelativePath="res\watermark.bmp"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath="ReadMe.txt"
+ >
+ </File>
+ </Files>
+ <Globals>
+ <Global
+ Name="RESOURCE_FILE"
+ Value="PrinterSetupWizardRes.rc"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardRes.vcxproj b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardRes.vcxproj
new file mode 100755
index 00000000..16befa70
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardRes.vcxproj
@@ -0,0 +1,347 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Template|Win32">
+ <Configuration>Template</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Template|x64">
+ <Configuration>Template</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{CFCCB176-6CAA-472B-B0A2-90511C8E2E52}</ProjectGuid>
+ <Keyword>MFCProj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>Static</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>Static</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Template|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>Static</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>Static</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Template|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\PrinterWizard.Resources\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\PrinterWizard.Resources\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\PrinterWizard.Resources\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\PrinterWizard.Resources\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">PrinterWizardResources</TargetName>
+ <TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.dll</TargetExt>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">PrinterWizardResources</TargetName>
+ <TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.dll</TargetExt>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">$(Platform)\$(Configuration)\PrinterWizard.Resources\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">$(Platform)\$(Configuration)\</IntDir>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">PrinterWizardResources</TargetName>
+ <TargetExt Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">.dll</TargetExt>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">PrinterWizardResources</TargetName>
+ <TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.dll</TargetExt>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">PrinterWizardResources</TargetName>
+ <TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.dll</TargetExt>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Template|x64'">$(Platform)\$(Configuration)\PrinterWizard.Resources\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Template|x64'">$(Platform)\$(Configuration)\</IntDir>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Template|x64'">PrinterWizardResources</TargetName>
+ <TargetExt Condition="'$(Configuration)|$(Platform)'=='Template|x64'">.dll</TargetExt>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>false</MkTypLibCompatible>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\mDNSWindows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUGS;DEBUG=1;WINVER=0x0400;UNICODE;_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level4</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ <CallingConvention>Cdecl</CallingConvention>
+ <DisableSpecificWarnings>4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ <AdditionalIncludeDirectories>$(IntDir);../../mDNSWindows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <PreLinkEvent>
+ <Message>Building Output Directories</Message>
+ <Command>if not exist Debug\PrinterWizard.Resources mkdir Debug\PrinterWizard.Resources</Command>
+ </PreLinkEvent>
+ <Link>
+ <OutputFile>$(OutDir)PrinterWizardResources.dll</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <EntryPointSymbol>
+ </EntryPointSymbol>
+ <NoEntryPoint>true</NoEntryPoint>
+ <ImportLibrary>$(OutDir)Localized.lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>false</MkTypLibCompatible>
+ <TargetEnvironment>X64</TargetEnvironment>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\mDNSWindows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUGS;DEBUG=1;WINVER=0x0400;UNICODE;_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level4</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <CallingConvention>Cdecl</CallingConvention>
+ <DisableSpecificWarnings>4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ <AdditionalIncludeDirectories>$(IntDir);../../mDNSWindows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <PreLinkEvent>
+ <Message>Building Output Directories</Message>
+ <Command>if not exist Debug\PrinterWizard.Resources mkdir Debug\PrinterWizard.Resources</Command>
+ </PreLinkEvent>
+ <Link>
+ <OutputFile>$(OutDir)PrinterWizardResources.dll</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <EntryPointSymbol>
+ </EntryPointSymbol>
+ <NoEntryPoint>true</NoEntryPoint>
+ <ImportLibrary>$(OutDir)Localized.lib</ImportLibrary>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>false</MkTypLibCompatible>
+ </Midl>
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <OmitFramePointers>true</OmitFramePointers>
+ <AdditionalIncludeDirectories>..\..\mDNSWindows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;WINVER=0x0400;UNICODE;_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <MinimalRebuild>false</MinimalRebuild>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level4</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ <AdditionalIncludeDirectories>$(IntDir);../../mDNSWindows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <PreLinkEvent>
+ <Message>Building Output Directories</Message>
+ <Command>if not exist Release mkdir Release
+if not exist "Release\PrinterWizard.Resources" mkdir "Release\PrinterWizard.Resources"
+</Command>
+ </PreLinkEvent>
+ <Link>
+ <OutputFile>$(OutDir)PrinterWizardResources.dll</OutputFile>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <OptimizeReferences>
+ </OptimizeReferences>
+ <EnableCOMDATFolding>
+ </EnableCOMDATFolding>
+ <EntryPointSymbol>
+ </EntryPointSymbol>
+ <NoEntryPoint>true</NoEntryPoint>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <PostBuildEvent>
+ <Command>if not "%RC_XBS%" == "YES" goto END
+if not exist "$(DSTROOT)\Program Files\Bonjour Print Services\$(Platform)\PrinterWizard.Resources" mkdir "$(DSTROOT)\Program Files\Bonjour Print Services\$(Platform)\PrinterWizard.Resources"
+xcopy /I/Y "$(TargetPath)" "$(DSTROOT)\Program Files\Bonjour Print Services\$(Platform)\PrinterWizard.Resources"
+:END
+</Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>false</MkTypLibCompatible>
+ <TargetEnvironment>X64</TargetEnvironment>
+ </Midl>
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <OmitFramePointers>true</OmitFramePointers>
+ <AdditionalIncludeDirectories>..\..\mDNSWindows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;WINVER=0x0400;UNICODE;_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <MinimalRebuild>false</MinimalRebuild>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level4</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ <AdditionalIncludeDirectories>$(IntDir);../../mDNSWindows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <PreLinkEvent>
+ <Message>Building Output Directories</Message>
+ <Command>if not exist Release mkdir Release
+if not exist "Release\PrinterWizard.Resources" mkdir "Release\PrinterWizard.Resources"
+</Command>
+ </PreLinkEvent>
+ <Link>
+ <OutputFile>$(OutDir)PrinterWizardResources.dll</OutputFile>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <OptimizeReferences>
+ </OptimizeReferences>
+ <EnableCOMDATFolding>
+ </EnableCOMDATFolding>
+ <EntryPointSymbol>
+ </EntryPointSymbol>
+ <NoEntryPoint>true</NoEntryPoint>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ <PostBuildEvent>
+ <Command>if not "%RC_XBS%" == "YES" goto END
+if not exist "$(DSTROOT)\Program Files\Bonjour Print Services\$(Platform)\PrinterWizard.Resources" mkdir "$(DSTROOT)\Program Files\Bonjour Print Services\$(Platform)\PrinterWizard.Resources"
+xcopy /I/Y "$(TargetPath)" "$(DSTROOT)\Program Files\Bonjour Print Services\$(Platform)\PrinterWizard.Resources"
+:END
+</Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">
+ <Link>
+ <OutputFile>$(OutDir)PrinterWizardResources.dll</OutputFile>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Template|x64'">
+ <Link>
+ <OutputFile>$(OutDir)PrinterWizardResources.dll</OutputFile>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="resource_dll.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="res\about.bmp" />
+ <None Include="res\banner_icon.bmp" />
+ <None Include="res\Info.ico" />
+ <None Include="res\NetworkPrinter.ico" />
+ <None Include="res\Printer.bmp" />
+ <None Include="res\PrinterSetupWizardRes.rc2" />
+ <None Include="res\watermark.bmp" />
+ <None Include="ReadMe.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="PrinterSetupWizardRes.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\mDNSWindows\DLL\dnssd.vcxproj">
+ <Project>{ab581101-18f0-46f6-b56a-83a6b1ea657e}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+ <ProjectExtensions>
+ <VisualStudio>
+ <UserProperties RESOURCE_FILE="PrinterSetupWizardRes.rc" />
+ </VisualStudio>
+ </ProjectExtensions>
+</Project> \ No newline at end of file
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardRes.vcxproj.filters b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardRes.vcxproj.filters
new file mode 100755
index 00000000..e5b0f595
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardRes.vcxproj.filters
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{f366b81b-a033-4fe2-83f9-f249205c8f41}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{dd34ed24-7798-4514-b9b3-ecc1172409a0}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;jpg;jpeg;jpe;manifest</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="resource_dll.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="res\about.bmp">
+ <Filter>Resource Files</Filter>
+ </None>
+ <None Include="res\banner_icon.bmp">
+ <Filter>Resource Files</Filter>
+ </None>
+ <None Include="res\Info.ico">
+ <Filter>Resource Files</Filter>
+ </None>
+ <None Include="res\NetworkPrinter.ico">
+ <Filter>Resource Files</Filter>
+ </None>
+ <None Include="res\Printer.bmp">
+ <Filter>Resource Files</Filter>
+ </None>
+ <None Include="res\PrinterSetupWizardRes.rc2">
+ <Filter>Resource Files</Filter>
+ </None>
+ <None Include="res\watermark.bmp">
+ <Filter>Resource Files</Filter>
+ </None>
+ <None Include="ReadMe.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="PrinterSetupWizardRes.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardSheet.cpp b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardSheet.cpp
new file mode 100644
index 00000000..47e5f911
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardSheet.cpp
@@ -0,0 +1,1949 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "stdafx.h"
+#include "PrinterSetupWizardApp.h"
+#include "PrinterSetupWizardSheet.h"
+#include "CommonServices.h"
+#include "DebugServices.h"
+#include "WinServices.h"
+#include "About.h"
+#include "tcpxcv.h"
+#include <winspool.h>
+#include <string>
+#include <shlwapi.h>
+
+// unreachable code
+#pragma warning(disable:4702)
+
+
+#if( !TARGET_OS_WINDOWS_CE )
+# include <mswsock.h>
+# include <process.h>
+#endif
+
+
+#if defined( UNICODE ) || defined( _UNICODE )
+# define GetEnv _wgetenv
+#else
+# define GetEnv getenv
+#endif
+
+static TCHAR*
+g_printerDriverFiles[] = // Printer driver files
+{
+ TEXT( "ps5ui.dll" ),
+ TEXT( "pscript.hlp" ),
+ TEXT( "pscript.ntf" ),
+ TEXT( "pscript5.dll" ),
+ TEXT( "cups6.ini" ),
+ TEXT( "cupsui6.dll" ),
+ TEXT( "cupsps6.dll" )
+};
+
+
+// Private Messages
+
+#define WM_SOCKET_EVENT ( WM_USER + 0x100 )
+#define WM_PROCESS_EVENT ( WM_USER + 0x101 )
+
+
+static BOOL
+Is64BitWindows()
+{
+#if defined(_WIN64)
+ return TRUE; // 64-bit programs run only on Win64
+#else
+ typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS)( HANDLE, PBOOL );
+ LPFN_ISWOW64PROCESS fnIsWow64Process;
+ BOOL bIsWow64 = FALSE;
+
+ fnIsWow64Process = ( LPFN_ISWOW64PROCESS ) GetProcAddress( GetModuleHandle( TEXT( "kernel32" ) ), "IsWow64Process" );
+
+ if ( fnIsWow64Process != NULL )
+ {
+ BOOL ok;
+
+ ok = fnIsWow64Process( GetCurrentProcess(), &bIsWow64 );
+
+ if ( !ok )
+ {
+ bIsWow64 = FALSE;
+ }
+ }
+
+ return bIsWow64;
+#endif
+}
+
+
+// CPrinterSetupWizardSheet
+CPrinterSetupWizardSheet * CPrinterSetupWizardSheet::m_self;
+
+IMPLEMENT_DYNAMIC(CPrinterSetupWizardSheet, CPropertySheet)
+CPrinterSetupWizardSheet::CPrinterSetupWizardSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
+ :CPropertySheet(nIDCaption, pParentWnd, iSelectPage),
+ m_selectedPrinter(NULL),
+ m_driverThreadExitCode( 0 ),
+ m_driverThreadFinished( false ),
+ m_pdlBrowser( NULL ),
+ m_ippBrowser( NULL ),
+ m_lprBrowser( NULL ),
+ m_lastPage( NULL )
+{
+ m_arrow = LoadCursor(0, IDC_ARROW);
+ m_wait = LoadCursor(0, IDC_APPSTARTING);
+ m_active = m_arrow;
+ m_self = this;
+
+ Init();
+
+ LoadPrinterNames();
+}
+
+
+CPrinterSetupWizardSheet::~CPrinterSetupWizardSheet()
+{
+ Printer * printer;
+
+ while ( m_printers.size() > 0 )
+ {
+ printer = m_printers.front();
+ m_printers.pop_front();
+
+ delete printer;
+ }
+
+ m_self = NULL;
+}
+
+
+// ------------------------------------------------------
+// SetSelectedPrinter
+//
+// Manages setting a printer as the printer to install. Stops
+// any pending resolves.
+//
+void
+CPrinterSetupWizardSheet::SetSelectedPrinter(Printer * printer)
+{
+ check( !printer || ( printer != m_selectedPrinter ) );
+
+ m_selectedPrinter = printer;
+}
+
+
+OSStatus
+CPrinterSetupWizardSheet::LoadPrinterNames()
+{
+ PBYTE buffer = NULL;
+ OSStatus err = 0;
+
+ //
+ // rdar://problem/3701926 - Printer can't be installed twice
+ //
+ // First thing we want to do is make sure the printer isn't already installed.
+ // If the printer name is found, we'll try and rename it until we
+ // find a unique name
+ //
+ DWORD dwNeeded = 0, dwNumPrinters = 0;
+
+ BOOL ok = EnumPrinters(PRINTER_ENUM_LOCAL, NULL, 4, NULL, 0, &dwNeeded, &dwNumPrinters);
+ err = translate_errno( ok, errno_compat(), kUnknownErr );
+
+ if ((err == ERROR_INSUFFICIENT_BUFFER) && (dwNeeded > 0))
+ {
+ try
+ {
+ buffer = new unsigned char[dwNeeded];
+ }
+ catch (...)
+ {
+ buffer = NULL;
+ }
+
+ require_action( buffer, exit, kNoMemoryErr );
+ ok = EnumPrinters(PRINTER_ENUM_LOCAL, NULL, 4, buffer, dwNeeded, &dwNeeded, &dwNumPrinters);
+ err = translate_errno( ok, errno_compat(), kUnknownErr );
+ require_noerr( err, exit );
+
+ for (DWORD index = 0; index < dwNumPrinters; index++)
+ {
+ PRINTER_INFO_4 * lppi4 = (PRINTER_INFO_4*) (buffer + index * sizeof(PRINTER_INFO_4));
+
+ m_printerNames.push_back( lppi4->pPrinterName );
+ }
+ }
+
+exit:
+
+ if (buffer != NULL)
+ {
+ delete [] buffer;
+ }
+
+ return err;
+}
+
+
+
+// ------------------------------------------------------
+// InstallPrinter
+//
+// Installs a printer with Windows.
+//
+// Note: this works one of two ways, depending on whether
+// there are drivers already installed for this printer.
+// If there are, then we can just create a port with XcvData,
+// and then call AddPrinter. If not, we use the printui.dll
+// to install the printer. Actually installing drivers that
+// are not currently installed is painful, and it's much
+// easier and less error prone to just let printui.dll do
+// the hard work for us.
+//
+
+OSStatus
+CPrinterSetupWizardSheet::InstallPrinter(Printer * printer)
+{
+ Logger log;
+ CUPSLibrary cupsLib;
+ Service * service = NULL;
+ BOOL ok;
+ OSStatus err = 0;
+
+ service = printer->services.front();
+ check( service );
+
+ if ( printer->isCUPSPrinter && cupsLib.IsInstalled() )
+ {
+ err = InstallPrinterCUPS( printer, service, cupsLib );
+ require_noerr( err, exit );
+ }
+ else
+ {
+ //
+ // if the driver isn't installed, then install it
+ //
+
+ if ( !printer->driverInstalled )
+ {
+ DWORD dwResult;
+ HANDLE hThread;
+ unsigned threadID;
+
+ m_driverThreadFinished = false;
+
+ //
+ // create the thread
+ //
+ hThread = (HANDLE) _beginthreadex_compat( NULL, 0, InstallDriverThread, printer, 0, &threadID );
+ err = translate_errno( hThread, (OSStatus) GetLastError(), kUnknownErr );
+ require_noerr_with_log( log, "_beginthreadex_compat()", err, exit );
+
+ //
+ // go modal
+ //
+ while (!m_driverThreadFinished)
+ {
+ MSG msg;
+
+ GetMessage( &msg, m_hWnd, 0, 0 );
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+
+ //
+ // Wait until child process exits.
+ //
+ dwResult = WaitForSingleObject( hThread, INFINITE );
+ err = translate_errno( dwResult == WAIT_OBJECT_0, errno_compat(), err = kUnknownErr );
+ require_noerr_with_log( log, "WaitForSingleObject()", err, exit );
+
+ //
+ // check the return value of thread
+ //
+ require_noerr_with_log( log, "thread exit code", m_driverThreadExitCode, exit );
+
+ //
+ // now we know that the driver was successfully installed
+ //
+ printer->driverInstalled = true;
+ }
+
+ if ( service->type == kPDLServiceType )
+ {
+ err = InstallPrinterPort( printer, service, PROTOCOL_RAWTCP_TYPE, log );
+ require_noerr_with_log( log, "InstallPrinterPort()", err, exit );
+ err = InstallPrinterPDLAndLPR( printer, service, log );
+ require_noerr_with_log( log, "InstallPrinterPDLAndLPR()", err, exit );
+ }
+ else if ( service->type == kLPRServiceType )
+ {
+ err = InstallPrinterPort( printer, service, PROTOCOL_LPR_TYPE, log );
+ require_noerr_with_log( log, "InstallPrinterPort()", err, exit );
+ err = InstallPrinterPDLAndLPR( printer, service, log );
+ require_noerr_with_log( log, "InstallPrinterPDLAndLPR()", err, exit );
+ }
+ else if ( service->type == kIPPServiceType )
+ {
+ // There's no need to install a printer port for IPP printers, because
+ // the call to AddPrinter() will do that for us.
+
+ err = InstallPrinterIPP( printer, service, log );
+ require_noerr_with_log( log, "InstallPrinterIPP()", err, exit );
+ }
+ else
+ {
+ require_action_with_log( log, ( service->type == kPDLServiceType ) || ( service->type == kLPRServiceType ) || ( service->type == kIPPServiceType ), exit, err = kUnknownErr );
+ }
+ }
+
+ printer->installed = true;
+
+ //
+ // if the user specified a default printer, set it
+ //
+ if (printer->deflt)
+ {
+ ok = SetDefaultPrinter( printer->actualName );
+ err = translate_errno( ok, errno_compat(), err = kUnknownErr );
+ require_noerr_with_log( log, "SetDefaultPrinter()", err, exit );
+ }
+
+exit:
+
+ return err;
+}
+
+
+OSStatus
+CPrinterSetupWizardSheet::InstallPrinterPort( Printer * printer, Service * service, DWORD protocol, Logger & log )
+{
+ PRINTER_DEFAULTS printerDefaults = { NULL, NULL, SERVER_ACCESS_ADMINISTER };
+ PORT_DATA_1 portData;
+ DWORD dwStatus;
+ DWORD cbInputData = 100;
+ PBYTE pOutputData = NULL;
+ DWORD cbOutputNeeded = 0;
+ HANDLE hXcv = NULL;
+ Queue * q;
+ BOOL ok;
+ OSStatus err;
+
+ ZeroMemory(&portData, sizeof(PORT_DATA_1));
+
+ require_action_with_log( log, wcslen(printer->portName) < sizeof_array(portData.sztPortName), exit, err = kSizeErr );
+ wcscpy_s(portData.sztPortName, printer->portName);
+
+ q = service->queues.front();
+ check( q );
+
+ ok = OpenPrinter(L",XcvMonitor Standard TCP/IP Port", &hXcv, &printerDefaults);
+ err = translate_errno( ok, errno_compat(), kUnknownErr );
+ require_noerr_with_log( log, "OpenPrinter()", err, exit );
+
+ //
+ // BUGBUG: MSDN said this is not required, but my experience shows it is required
+ //
+ try
+ {
+ pOutputData = new BYTE[cbInputData];
+ }
+ catch (...)
+ {
+ pOutputData = NULL;
+ }
+
+ require_action_with_log( log, pOutputData, exit, err = kNoMemoryErr );
+
+ portData.dwPortNumber = service->portNumber;
+ portData.dwVersion = 1;
+ portData.dwDoubleSpool = 1;
+
+ portData.dwProtocol = protocol;
+ portData.cbSize = sizeof PORT_DATA_1;
+ portData.dwReserved = 0L;
+
+ require_action_with_log( log, wcslen(q->name) < sizeof_array(portData.sztQueue), exit, err = kSizeErr );
+ wcscpy_s(portData.sztQueue, q->name);
+
+ require_action_with_log( log, wcslen( service->hostname ) < sizeof_array(portData.sztHostAddress), exit, err = kSizeErr );
+ wcscpy_s( portData.sztHostAddress, service->hostname );
+
+ ok = XcvData(hXcv, L"AddPort", (PBYTE) &portData, sizeof(PORT_DATA_1), pOutputData, cbInputData, &cbOutputNeeded, &dwStatus);
+ err = translate_errno( ok, errno_compat(), kUnknownErr );
+ require_noerr_with_log( log, "XcvData()", err, exit );
+
+exit:
+
+ if (hXcv != NULL)
+ {
+ ClosePrinter(hXcv);
+ }
+
+ if (pOutputData != NULL)
+ {
+ delete [] pOutputData;
+ }
+
+ return err;
+}
+
+
+OSStatus
+CPrinterSetupWizardSheet::InstallPrinterPDLAndLPR(Printer * printer, Service * service, Logger & log )
+{
+ PRINTER_INFO_2 pInfo;
+ HANDLE hPrinter = NULL;
+ Queue * q;
+ OSStatus err;
+
+ check(printer != NULL);
+ check(printer->installed == false);
+
+ q = service->queues.front();
+ check( q );
+
+ //
+ // add the printer
+ //
+ ZeroMemory(&pInfo, sizeof(pInfo));
+
+ pInfo.pPrinterName = printer->actualName.GetBuffer();
+ pInfo.pServerName = NULL;
+ pInfo.pShareName = NULL;
+ pInfo.pPortName = printer->portName.GetBuffer();
+ pInfo.pDriverName = printer->modelName.GetBuffer();
+ pInfo.pComment = printer->displayModelName.GetBuffer();
+ pInfo.pLocation = q->location.GetBuffer();
+ pInfo.pDevMode = NULL;
+ pInfo.pDevMode = NULL;
+ pInfo.pSepFile = L"";
+ pInfo.pPrintProcessor = L"winprint";
+ pInfo.pDatatype = L"RAW";
+ pInfo.pParameters = L"";
+ pInfo.pSecurityDescriptor = NULL;
+ pInfo.Attributes = PRINTER_ATTRIBUTE_QUEUED;
+ pInfo.Priority = 0;
+ pInfo.DefaultPriority = 0;
+ pInfo.StartTime = 0;
+ pInfo.UntilTime = 0;
+
+ hPrinter = AddPrinter(NULL, 2, (LPBYTE) &pInfo);
+ err = translate_errno( hPrinter, errno_compat(), kUnknownErr );
+ require_noerr_with_log( log, "AddPrinter()", err, exit );
+
+exit:
+
+ if (hPrinter != NULL)
+ {
+ ClosePrinter(hPrinter);
+ }
+
+ return err;
+}
+
+
+OSStatus
+CPrinterSetupWizardSheet::InstallPrinterIPP(Printer * printer, Service * service, Logger & log)
+{
+ DEBUG_UNUSED( service );
+
+ Queue * q = service->SelectedQueue();
+ HANDLE hPrinter = NULL;
+ PRINTER_INFO_2 pInfo;
+ OSStatus err;
+
+ check( q );
+
+ //
+ // add the printer
+ //
+ ZeroMemory(&pInfo, sizeof(PRINTER_INFO_2));
+
+ pInfo.pPrinterName = printer->actualName.GetBuffer();
+ pInfo.pPortName = printer->portName.GetBuffer();
+ pInfo.pDriverName = printer->modelName.GetBuffer();
+ pInfo.pPrintProcessor = L"winprint";
+ pInfo.pLocation = q->location.GetBuffer();
+ pInfo.pComment = printer->displayModelName.GetBuffer();
+ pInfo.Attributes = PRINTER_ATTRIBUTE_NETWORK | PRINTER_ATTRIBUTE_LOCAL;
+
+ hPrinter = AddPrinter(NULL, 2, (LPBYTE)&pInfo);
+ err = translate_errno( hPrinter, errno_compat(), kUnknownErr );
+ require_noerr_with_log( log, "AddPrinter()", err, exit );
+
+exit:
+
+ if ( hPrinter != NULL )
+ {
+ ClosePrinter(hPrinter);
+ }
+
+ return err;
+}
+
+
+OSStatus
+CPrinterSetupWizardSheet::InstallPrinterCUPS(Printer * printer, Service * service, CUPSLibrary & cupsLib )
+{
+ OSStatus err = kNoErr;
+
+ check( printer );
+ check( service );
+ check( cupsLib.IsInstalled() );
+
+ err = InstallPrinterCUPS( printer, service, cupsLib, TEXT( "Windows NT x86" ) );
+ require_noerr( err, exit );
+
+ if ( Is64BitWindows() )
+ {
+ err = InstallPrinterCUPS( printer, service, cupsLib, TEXT( "Windows x64" ) );
+ require_noerr( err, exit );
+ }
+
+exit:
+
+ return err;
+}
+
+
+OSStatus
+CPrinterSetupWizardSheet::InstallPrinterCUPS(Printer * printer, Service * service, CUPSLibrary & cupsLib, TCHAR * env )
+{
+
+ Queue * q;
+ CString ppdfile; // PPD file for printer drivers
+ TCHAR driverdir[1024]; // Directory for driver files
+ DWORD needed; // Bytes needed
+ DRIVER_INFO_3 driverinfo; // Driver information
+ PRINTER_INFO_2 printerinfo; // Printer information
+ HANDLE printerHandle = NULL; // Handle to printer
+ CString filename; // Driver filename
+ CString dependentFiles; // List of dependent files
+ CString portName; // Port Name
+ int bytes; // Bytes copied
+ TCHAR datadir[ MAX_PATH ]; // Driver files location
+ CFile in; // Input file
+ CFile out; // Output file
+ void * http; // Connection to server
+ char buffer[4096]; // Copy/error buffer
+ CString platform;
+ char hostname[ 1024 ];
+ CString dest;
+ char destANSI[ 1024 ];
+ int i;
+ DWORD num;
+ OSStatus err = 0;
+ BOOL ok;
+
+ check( printer );
+ check( service );
+ check( cupsLib.IsInstalled() );
+ check( env );
+
+ // What do we do here for multiple queues?
+ q = service->queues.front();
+ require_action( q != NULL, exit, err = kUnknownErr );
+
+ num = GetModuleFileName( NULL, datadir, MAX_PATH );
+ err = translate_errno( num > 0, GetLastError(), kUnknownErr );
+ require_noerr( err, exit );
+ ok = PathRemoveFileSpec( datadir );
+ require_action( ok, exit, err = kUnknownErr );
+
+ ok = GetPrinterDriverDirectory(NULL, env, 1, ( LPBYTE ) driverdir, sizeof( driverdir ), &needed );
+ err = translate_errno( ok, GetLastError(), kUnknownErr );
+ require_noerr( err, exit );
+
+ platform = env;
+ platform = platform.Right( 3 );
+
+ // Append the supported banner pages to the PPD file...
+ err = StringObjectToUTF8String( service->hostname, hostname, sizeof( hostname ) );
+ require_noerr( err, exit );
+ http = cupsLib.httpConnectEncrypt( hostname, service->portNumber, cupsLib.cupsEncryption() );
+ err = translate_errno( http != NULL, errno, kUnknownErr );
+ require_noerr( err, exit );
+
+ if ( ( service->portNumber == 443 ) || ( cupsLib.cupsEncryption() >= HTTP_ENCRYPT_REQUIRED ) )
+ {
+ // This forces the use the https: URLs below...
+ cupsLib.cupsSetEncryption( HTTP_ENCRYPT_ALWAYS );
+ }
+
+ // Strip the leading "printers/" or "classes/" from the beginning
+ // of the name
+
+ dest = q->name;
+ dest.Replace( TEXT( "printers/" ), TEXT( "" ) );
+ dest.Replace( TEXT( "classes/" ), TEXT( "" ) );
+
+ err = StringObjectToUTF8String( dest, destANSI, sizeof( destANSI ) );
+ require_noerr( err, exit );
+
+ // Get the PPD file...
+ for ( i = 0; i < 10; i++ )
+ {
+ char ppdfileANSI[ 1024 ];
+
+ if ( cupsLib.cupsAdminCreateWindowsPPD( http, destANSI, ppdfileANSI, sizeof( ppdfileANSI ) ) )
+ {
+ err = UTF8StringToStringObject( ppdfileANSI, ppdfile );
+ require_noerr( err, exit );
+ break;
+ }
+ }
+
+ err = translate_errno( i < 10, errno, kUnknownErr );
+ require_noerr( err, exit );
+
+ // Copy the PPD file to the Windows driver directory...
+ filename.Format( TEXT( "%s/%s.ppd" ), driverdir, dest );
+
+ ok = in.Open( ppdfile, CFile::modeRead | CFile::typeBinary );
+ translate_errno( ok, GetLastError(), kUnknownErr );
+ require_noerr( err, exit );
+
+ ok = out.Open( filename, CFile::modeCreate | CFile::modeWrite | CFile::typeBinary );
+ translate_errno( ok, GetLastError(), kUnknownErr );
+ require_noerr( err, exit );
+
+ while ( ( bytes = in.Read( buffer, sizeof(buffer) ) ) > 0 )
+ {
+ out.Write(buffer, bytes );
+ }
+
+ in.Close();
+ out.Close();
+
+ // Cleanup temp file...
+ CFile::Remove( ppdfile );
+
+ // Copy the driver files to the driver directory...
+ for ( i = 0; i < ( sizeof( g_printerDriverFiles ) / sizeof( g_printerDriverFiles[0] ) ); i++ )
+ {
+ filename.Format( TEXT( "%s/drivers/%s/%s" ), datadir, platform, g_printerDriverFiles[i]);
+
+ ok = in.Open(filename, CFile::modeRead | CFile::typeBinary );
+ err = translate_errno( ok, GetLastError(), kUnknownErr );
+ require_noerr( err, exit );
+
+ filename.Format( TEXT( "%s/%s" ), driverdir, g_printerDriverFiles[i] );
+ ok = out.Open(filename, CFile::modeCreate | CFile::modeWrite | CFile::typeBinary );
+ err = translate_errno( ok, errno, kUnknownErr );
+
+ while ( ( bytes = in.Read(buffer, sizeof( buffer ) ) ) > 0 )
+ {
+ out.Write( buffer, bytes );
+ }
+
+ in.Close();
+ out.Close();
+ }
+
+ // Do the Windows system calls needed to add the printer driver...
+ filename.Format( TEXT( "%s.ppd" ), dest);
+ dependentFiles.Format( TEXT( "pscript5.dll%c" ) TEXT( "%s.ppd%c" ) TEXT( "ps5ui.dll%c" ) TEXT( "pscript.hlp%c" ) TEXT( "pscript.ntf%c" ) TEXT( "cups6.ini%c" ) TEXT( "cupsps6.dll%c" ) TEXT( "cupsui6.dll%c" ), 0, dest, 0, 0, 0, 0, 0, 0, 0);
+
+ driverinfo.cVersion = 3;
+ driverinfo.pName = printer->actualName.GetBuffer();
+ driverinfo.pEnvironment = env;
+ driverinfo.pDriverPath = TEXT( "pscript5.dll" );
+ driverinfo.pDataFile = filename.GetBuffer();
+ driverinfo.pConfigFile = TEXT( "ps5ui.dll" );
+ driverinfo.pHelpFile = TEXT( "pscript.hlp" );
+ driverinfo.pDependentFiles = dependentFiles.GetBuffer();
+ driverinfo.pMonitorName = NULL;
+ driverinfo.pDefaultDataType = TEXT( "raw" );
+
+ ok = AddPrinterDriverEx(NULL, 3, (LPBYTE) &driverinfo, APD_COPY_ALL_FILES );
+ err = translate_errno( ok, GetLastError(), kUnknownErr );
+ require_noerr( err, exit );
+
+ // See if the printer has already been added?
+ if ( OpenPrinter( printer->actualName.GetBuffer(), &printerHandle, NULL ) )
+ {
+ // Printer already exists, so we are done now...
+ goto exit;
+ }
+
+ // Add the printer using the HTTP/IPP port...
+ portName.Format( TEXT( "%s://%s:%d/printers/%s" ), cupsLib.cupsEncryption() == HTTP_ENCRYPT_ALWAYS ? TEXT( "https" ) : TEXT( "http" ), service->hostname.GetBuffer(), service->portNumber, dest );
+
+ memset(&printerinfo, 0, sizeof(printerinfo));
+ printerinfo.pPrinterName = printer->actualName.GetBuffer();
+ printerinfo.pPortName = portName.GetBuffer();
+ printerinfo.pDriverName = printer->actualName.GetBuffer();
+ printerinfo.Attributes = PRINTER_ATTRIBUTE_NETWORK | PRINTER_ATTRIBUTE_LOCAL;
+ printerinfo.pComment = q->description.GetBuffer();
+ printerinfo.pLocation = q->location.GetBuffer();
+ printerinfo.pPrintProcessor = TEXT( "winprint" );
+
+ printerHandle = AddPrinter( NULL, 2, (LPBYTE) &printerinfo );
+ err = translate_errno( printerHandle, GetLastError(), kUnknownErr );
+ require_noerr( err, exit );
+
+exit:
+
+ if ( printerHandle != NULL )
+ {
+ ClosePrinter( printerHandle );
+ printerHandle = NULL;
+ }
+
+ return err;
+}
+
+BEGIN_MESSAGE_MAP(CPrinterSetupWizardSheet, CPropertySheet)
+ON_MESSAGE( WM_SOCKET_EVENT, OnSocketEvent )
+ON_MESSAGE( WM_PROCESS_EVENT, OnProcessEvent )
+ON_WM_SETCURSOR()
+ON_WM_TIMER()
+END_MESSAGE_MAP()
+
+
+// ------------------------------------------------------
+// OnCommand
+//
+// Traps when the user hits Finish
+//
+BOOL CPrinterSetupWizardSheet::OnCommand(WPARAM wParam, LPARAM lParam)
+{
+ //
+ // Check if this is OK
+ //
+ if (wParam == ID_WIZFINISH) // If OK is hit...
+ {
+ OnOK();
+ }
+
+ return CPropertySheet::OnCommand(wParam, lParam);
+}
+
+
+// ------------------------------------------------------
+// OnInitDialog
+//
+// Initializes this Dialog object.
+//
+BOOL CPrinterSetupWizardSheet::OnInitDialog()
+{
+ OSStatus err;
+
+ CPropertySheet::OnInitDialog();
+
+ err = StartBrowse();
+ require_noerr( err, exit );
+
+exit:
+
+ if ( err )
+ {
+ StopBrowse();
+
+ if ( err == kDNSServiceErr_Firewall )
+ {
+ CString text, caption;
+
+ text.LoadString( IDS_FIREWALL );
+ caption.LoadString( IDS_FIREWALL_CAPTION );
+
+ MessageBox(text, caption, MB_OK|MB_ICONEXCLAMATION);
+ }
+ else
+ {
+ CString text, caption;
+
+ text.LoadString( IDS_NO_MDNSRESPONDER_SERVICE_TEXT );
+ caption.LoadString( IDS_ERROR_CAPTION );
+
+ MessageBox(text, caption, MB_OK|MB_ICONEXCLAMATION);
+
+ _exit( 0 );
+ }
+ }
+
+ return TRUE;
+}
+
+
+// ------------------------------------------------------
+// OnSetCursor
+//
+// This is called when Windows wants to know what cursor
+// to display. So we tell it.
+//
+BOOL
+CPrinterSetupWizardSheet::OnSetCursor(CWnd * pWnd, UINT nHitTest, UINT message)
+{
+ DEBUG_UNUSED(pWnd);
+ DEBUG_UNUSED(nHitTest);
+ DEBUG_UNUSED(message);
+
+ SetCursor(m_active);
+ return TRUE;
+}
+
+
+// ------------------------------------------------------
+// OnContextMenu
+//
+// This is not fully implemented yet.
+//
+
+void
+CPrinterSetupWizardSheet::OnContextMenu(CWnd * pWnd, CPoint pos)
+{
+ DEBUG_UNUSED(pWnd);
+ DEBUG_UNUSED(pos);
+
+ CAbout dlg;
+
+ dlg.DoModal();
+}
+
+
+// ------------------------------------------------------
+// OnOK
+//
+// This is called when the user hits the "Finish" button
+//
+void
+CPrinterSetupWizardSheet::OnOK()
+{
+ CWnd * window;
+ OSStatus err;
+
+ check ( m_selectedPrinter != NULL );
+
+ SetWizardButtons( PSWIZB_DISABLEDFINISH );
+
+ window = GetDlgItem( IDCANCEL );
+
+ if ( window )
+ {
+ window->EnableWindow( FALSE );
+ }
+
+ m_pgFourth.StartActivityIndicator();
+
+ err = InstallPrinter( m_selectedPrinter );
+
+ m_pgFourth.StopActivityIndicator();
+
+ if ( err != kNoErr )
+ {
+ CString caption;
+ CString message;
+
+ caption.LoadString(IDS_INSTALL_ERROR_CAPTION);
+ caption.AppendFormat( TEXT( " (%d)" ), err );
+ message.LoadString(IDS_INSTALL_ERROR_MESSAGE);
+ MessageBox(message, caption, MB_OK|MB_ICONEXCLAMATION);
+ }
+
+ StopBrowse();
+}
+
+
+// CPrinterSetupWizardSheet message handlers
+
+void CPrinterSetupWizardSheet::Init(void)
+{
+ AddPage(&m_pgSecond);
+ AddPage(&m_pgThird);
+ AddPage(&m_pgFourth);
+
+ m_psh.dwFlags &= (~PSH_HASHELP);
+
+ m_psh.dwFlags |= PSH_WIZARD97|PSH_WATERMARK|PSH_HEADER;
+ m_psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK);
+ m_psh.pszbmHeader = MAKEINTRESOURCE(IDB_BANNER_ICON);
+
+ m_psh.hInstance = GetNonLocalizedResources();
+
+ SetWizardMode();
+}
+
+
+LRESULT
+CPrinterSetupWizardSheet::OnSocketEvent(WPARAM inWParam, LPARAM inLParam)
+{
+ if (WSAGETSELECTERROR(inLParam) && !(HIWORD(inLParam)))
+ {
+ dlog( kDebugLevelError, "OnServiceEvent: window error\n" );
+ }
+ else
+ {
+ SOCKET sock = (SOCKET) inWParam;
+
+ // iterate thru list
+ ServiceRefList::iterator begin = m_serviceRefList.begin();
+ ServiceRefList::iterator end = m_serviceRefList.end();
+
+ while (begin != end)
+ {
+ DNSServiceRef ref = *begin++;
+
+ check(ref != NULL);
+
+ if ((SOCKET) DNSServiceRefSockFD(ref) == sock)
+ {
+ DNSServiceProcessResult(ref);
+ break;
+ }
+ }
+ }
+
+ return ( 0 );
+}
+
+
+LRESULT
+CPrinterSetupWizardSheet::OnProcessEvent(WPARAM inWParam, LPARAM inLParam)
+{
+ DEBUG_UNUSED(inLParam);
+
+ m_driverThreadExitCode = (DWORD) inWParam;
+ m_driverThreadFinished = true;
+
+ return 0;
+}
+
+
+unsigned WINAPI
+CPrinterSetupWizardSheet::InstallDriverThread( LPVOID inParam )
+{
+ Printer * printer = (Printer*) inParam;
+ DWORD exitCode = 0;
+ DWORD dwResult;
+ OSStatus err;
+ STARTUPINFO si;
+ PROCESS_INFORMATION pi;
+ BOOL ok;
+
+ check( printer );
+ check( m_self );
+
+ //
+ // because we're calling endthreadex(), C++ objects won't be cleaned up
+ // correctly. we'll nest the CString 'command' inside a block so
+ // that it's destructor will be invoked.
+ //
+ {
+ CString command;
+
+ ZeroMemory( &si, sizeof(si) );
+ si.cb = sizeof(si);
+ ZeroMemory( &pi, sizeof(pi) );
+
+ command.Format(L"rundll32.exe printui.dll,PrintUIEntry /ia /m \"%s\" /f \"%s\"", (LPCTSTR) printer->modelName, (LPCTSTR) printer->infFileName );
+
+ ok = CreateProcess(NULL, command.GetBuffer(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+ err = translate_errno( ok, errno_compat(), kUnknownErr );
+ require_noerr( err, exit );
+
+ dwResult = WaitForSingleObject( pi.hProcess, INFINITE );
+ translate_errno( dwResult == WAIT_OBJECT_0, errno_compat(), err = kUnknownErr );
+ require_noerr( err, exit );
+
+ ok = GetExitCodeProcess( pi.hProcess, &exitCode );
+ err = translate_errno( ok, errno_compat(), kUnknownErr );
+ require_noerr( err, exit );
+ }
+
+exit:
+
+ //
+ // Close process and thread handles.
+ //
+ if ( pi.hProcess )
+ {
+ CloseHandle( pi.hProcess );
+ }
+
+ if ( pi.hThread )
+ {
+ CloseHandle( pi.hThread );
+ }
+
+ //
+ // alert the main thread
+ //
+ m_self->PostMessage( WM_PROCESS_EVENT, err, exitCode );
+
+ _endthreadex_compat( 0 );
+
+ return 0;
+}
+
+
+void DNSSD_API
+CPrinterSetupWizardSheet::OnBrowse(
+ DNSServiceRef inRef,
+ DNSServiceFlags inFlags,
+ uint32_t inInterfaceIndex,
+ DNSServiceErrorType inErrorCode,
+ const char * inName,
+ const char * inType,
+ const char * inDomain,
+ void * inContext )
+{
+ DEBUG_UNUSED(inRef);
+
+ CPrinterSetupWizardSheet * self;
+ bool moreComing = (bool) (inFlags & kDNSServiceFlagsMoreComing);
+ CPropertyPage * active;
+ Printer * printer = NULL;
+ Service * service = NULL;
+ OSStatus err = kNoErr;
+
+ require_noerr( inErrorCode, exit );
+
+ self = reinterpret_cast <CPrinterSetupWizardSheet*>( inContext );
+ require_quiet( self, exit );
+
+ active = self->GetActivePage();
+ require_quiet( active, exit );
+
+ // Have we seen this printer before?
+
+ printer = self->Lookup( inName );
+
+ if ( printer )
+ {
+ service = printer->LookupService( inType );
+ }
+
+ if ( inFlags & kDNSServiceFlagsAdd )
+ {
+ BOOL newPrinter = FALSE;
+
+ if ( !printer )
+ {
+ printer = self->OnAddPrinter( inInterfaceIndex, inName, inType, inDomain, moreComing );
+ require_action( printer, exit, err = kUnknownErr );
+ newPrinter = TRUE;
+ }
+
+ // If we're looking at the browse list on page 2, then we need to call
+ // CPage2::OnAddPrinter() regardless of whether we've seen the printer
+ // or not because the moreComing flag might have changed from a previous
+ // call. If we only call CPage2::OnAddPrinter() when there's a new printer,
+ // we might not correctly update our UI, so if we've seen the printer before,
+ // call OnAddPrinter with a NULL parameter.
+
+ if ( self->GetActivePage() == &self->m_pgSecond )
+ {
+ self->m_pgSecond.OnAddPrinter( newPrinter ? printer : NULL, moreComing );
+ }
+
+ if ( !service )
+ {
+ err = self->OnAddService( printer, inInterfaceIndex, inName, inType, inDomain );
+ require_noerr( err, exit );
+ }
+ else
+ {
+ service->refs++;
+ }
+ }
+ else if ( printer )
+ {
+ check( service );
+
+ err = self->OnRemoveService( service );
+ require_noerr( err, exit );
+
+ if ( printer->services.size() == 0 )
+ {
+ err = self->OnRemovePrinter( printer, moreComing );
+ require_noerr( err, exit );
+ }
+ }
+
+exit:
+
+ return;
+}
+
+
+void DNSSD_API
+CPrinterSetupWizardSheet::OnResolve(
+ DNSServiceRef inRef,
+ DNSServiceFlags inFlags,
+ uint32_t inInterfaceIndex,
+ DNSServiceErrorType inErrorCode,
+ const char * inFullName,
+ const char * inHostName,
+ uint16_t inPort,
+ uint16_t inTXTSize,
+ const char * inTXT,
+ void * inContext )
+{
+ DEBUG_UNUSED(inFullName);
+ DEBUG_UNUSED(inInterfaceIndex);
+ DEBUG_UNUSED(inFlags);
+ DEBUG_UNUSED(inRef);
+
+ CPrinterSetupWizardSheet * self;
+ Service * service;
+ Queue * q;
+ int idx;
+ OSStatus err;
+
+ require_noerr( inErrorCode, exit );
+
+ service = reinterpret_cast<Service*>( inContext );
+ require_quiet( service, exit);
+
+ check( service->refs != 0 );
+
+ self = service->printer->window;
+ require_quiet( self, exit );
+
+ err = self->StopOperation( service->serviceRef );
+ require_noerr( err, exit );
+
+ //
+ // hold on to the hostname...
+ //
+ err = UTF8StringToStringObject( inHostName, service->hostname );
+ require_noerr( err, exit );
+
+ //
+ // <rdar://problem/3739200> remove the trailing dot on hostname
+ //
+ idx = service->hostname.ReverseFind('.');
+
+ if ((idx > 1) && ((service->hostname.GetLength() - 1) == idx))
+ {
+ service->hostname.Delete(idx, 1);
+ }
+
+ //
+ // hold on to the port
+ //
+ service->portNumber = ntohs(inPort);
+
+ if ( service->qtotal == 1 )
+ {
+ //
+ // create a new queue
+ //
+ try
+ {
+ q = new Queue;
+ }
+ catch (...)
+ {
+ q = NULL;
+ }
+
+ require_action( q, exit, err = E_OUTOFMEMORY );
+
+ //
+ // parse the text record.
+ //
+
+ err = self->ParseTextRecord( service, q, inTXTSize, inTXT );
+ require_noerr( err, exit );
+
+ service->queues.push_back( q );
+
+ //
+ // we've completely resolved this service
+ //
+
+ self->OnResolveService( service );
+ }
+ else
+ {
+ //
+ // if qtotal is more than 1, then we need to get additional
+ // text records. if not, then this service is considered
+ // resolved
+ //
+
+ err = DNSServiceQueryRecord(&service->serviceRef, 0, inInterfaceIndex, inFullName, kDNSServiceType_TXT, kDNSServiceClass_IN, OnQuery, (void*) service );
+ require_noerr( err, exit );
+
+ err = self->StartOperation( service->serviceRef );
+ require_noerr( err, exit );
+ }
+
+exit:
+
+ return;
+}
+
+
+void DNSSD_API
+CPrinterSetupWizardSheet::OnQuery(
+ DNSServiceRef inRef,
+ DNSServiceFlags inFlags,
+ uint32_t inInterfaceIndex,
+ DNSServiceErrorType inErrorCode,
+ const char * inFullName,
+ uint16_t inRRType,
+ uint16_t inRRClass,
+ uint16_t inRDLen,
+ const void * inRData,
+ uint32_t inTTL,
+ void * inContext)
+{
+ DEBUG_UNUSED( inTTL );
+ DEBUG_UNUSED( inRRClass );
+ DEBUG_UNUSED( inRRType );
+ DEBUG_UNUSED( inFullName );
+ DEBUG_UNUSED( inInterfaceIndex );
+ DEBUG_UNUSED( inRef );
+
+ Service * service = NULL;
+ Queue * q;
+ CPrinterSetupWizardSheet * self;
+ OSStatus err = kNoErr;
+
+ require_noerr( inErrorCode, exit );
+
+ service = reinterpret_cast<Service*>( inContext );
+ require_quiet( service, exit);
+
+ self = service->printer->window;
+ require_quiet( self, exit );
+
+ if ( ( inFlags & kDNSServiceFlagsAdd ) && ( inRDLen > 0 ) && ( inRData != NULL ) )
+ {
+ const char * inTXT = ( const char * ) inRData;
+
+ //
+ // create a new queue
+ //
+ try
+ {
+ q = new Queue;
+ }
+ catch (...)
+ {
+ q = NULL;
+ }
+
+ require_action( q, exit, err = E_OUTOFMEMORY );
+
+ err = service->printer->window->ParseTextRecord( service, q, inRDLen, inTXT );
+ require_noerr( err, exit );
+
+ //
+ // add this queue
+ //
+
+ service->queues.push_back( q );
+
+ if ( service->queues.size() == service->qtotal )
+ {
+ //
+ // else if moreComing is not set, then we're going
+ // to assume that we're done
+ //
+
+ self->StopOperation( service->serviceRef );
+
+ //
+ // sort the queues
+ //
+
+ service->queues.sort( OrderQueueFunc );
+
+ //
+ // we've completely resolved this service
+ //
+
+ self->OnResolveService( service );
+ }
+ }
+
+exit:
+
+ if ( err && service && ( service->serviceRef != NULL ) )
+ {
+ service->printer->window->StopOperation( service->serviceRef );
+ }
+
+ return;
+}
+
+
+Printer*
+CPrinterSetupWizardSheet::OnAddPrinter(
+ uint32_t inInterfaceIndex,
+ const char * inName,
+ const char * inType,
+ const char * inDomain,
+ bool moreComing)
+{
+ Printer * printer = NULL;
+ DWORD printerNameCount;
+ OSStatus err;
+
+ DEBUG_UNUSED( inInterfaceIndex );
+ DEBUG_UNUSED( inType );
+ DEBUG_UNUSED( inDomain );
+ DEBUG_UNUSED( moreComing );
+
+ try
+ {
+ printer = new Printer;
+ }
+ catch (...)
+ {
+ printer = NULL;
+ }
+
+ require_action( printer, exit, err = E_OUTOFMEMORY );
+
+ printer->window = this;
+ printer->name = inName;
+
+ err = UTF8StringToStringObject(inName, printer->displayName);
+ check_noerr( err );
+ printer->actualName = printer->displayName;
+ printer->installed = false;
+ printer->deflt = false;
+ printer->resolving = 0;
+
+ // Compare this name against printers that are already installed
+ // to avoid name clashes. Rename as necessary
+ // to come up with a unique name.
+
+ printerNameCount = 2;
+
+ for (;;)
+ {
+ CPrinterSetupWizardSheet::PrinterNames::iterator it;
+
+ // <rdar://problem/4141221> Don't use find to do comparisons because we need to
+ // do a case insensitive string comparison
+
+ for ( it = m_printerNames.begin(); it != m_printerNames.end(); it++ )
+ {
+ if ( (*it).CompareNoCase( printer->actualName ) == 0 )
+ {
+ break;
+ }
+ }
+
+ if (it != m_printerNames.end())
+ {
+ printer->actualName.Format(L"%s (%d)", printer->displayName, printerNameCount);
+ }
+ else
+ {
+ break;
+ }
+
+ printerNameCount++;
+ }
+
+ m_printers.push_back( printer );
+
+exit:
+
+ return printer;
+}
+
+
+OSStatus
+CPrinterSetupWizardSheet::OnAddService(
+ Printer * printer,
+ uint32_t inInterfaceIndex,
+ const char * inName,
+ const char * inType,
+ const char * inDomain)
+{
+ Service * service = NULL;
+ OSStatus err = kNoErr;
+
+ DEBUG_UNUSED( inName );
+ DEBUG_UNUSED( inDomain );
+
+ try
+ {
+ service = new Service;
+ }
+ catch (...)
+ {
+ service = NULL;
+ }
+
+ require_action( service, exit, err = E_OUTOFMEMORY );
+
+ service->printer = printer;
+ service->ifi = inInterfaceIndex;
+ service->type = inType;
+ service->domain = inDomain;
+ service->qtotal = 1;
+ service->refs = 1;
+ service->serviceRef = NULL;
+
+ printer->services.push_back( service );
+
+ //
+ // if the printer is selected, then we'll want to start a
+ // resolve on this guy
+ //
+
+ if ( printer == m_selectedPrinter )
+ {
+ StartResolve( service );
+ }
+
+exit:
+
+ return err;
+}
+
+
+OSStatus
+CPrinterSetupWizardSheet::OnRemovePrinter( Printer * printer, bool moreComing )
+{
+ CPropertyPage * active = GetActivePage();
+ OSStatus err = kNoErr;
+
+ if ( active == &m_pgSecond )
+ {
+ m_pgSecond.OnRemovePrinter( printer, moreComing );
+ }
+
+ m_printers.remove( printer );
+
+ if ( m_selectedPrinter == printer )
+ {
+ m_selectedPrinter = NULL;
+
+ if ( ( active == &m_pgThird ) || ( active == &m_pgFourth ) )
+ {
+ CString caption;
+ CString message;
+
+ caption.LoadString( IDS_ERROR_CAPTION );
+ message.LoadString( IDS_PRINTER_UNAVAILABLE );
+
+ MessageBox(message, caption, MB_OK|MB_ICONEXCLAMATION);
+
+ SetActivePage( &m_pgSecond );
+ }
+ }
+
+ delete printer;
+
+ return err;
+}
+
+
+OSStatus
+CPrinterSetupWizardSheet::OnRemoveService( Service * service )
+{
+ OSStatus err = kNoErr;
+
+ if ( service && ( --service->refs == 0 ) )
+ {
+ if ( service->serviceRef != NULL )
+ {
+ err = StopResolve( service );
+ require_noerr( err, exit );
+ }
+
+ service->printer->services.remove( service );
+
+ delete service;
+ }
+
+exit:
+
+ return err;
+}
+
+
+void
+CPrinterSetupWizardSheet::OnResolveService( Service * service )
+{
+ // Make sure that the active page is page 2
+
+ require_quiet( GetActivePage() == &m_pgSecond, exit );
+
+ if ( !--service->printer->resolving )
+ {
+ // sort the services now. we want the service that
+ // has the highest priority queue to be first in
+ // the list.
+
+ service->printer->services.sort( OrderServiceFunc );
+
+ // Now we can hit next
+
+ SetWizardButtons( PSWIZB_BACK|PSWIZB_NEXT );
+
+ // Reset the cursor
+
+ m_active = m_arrow;
+
+ // And tell page 2 about it
+
+ m_pgSecond.OnResolveService( service );
+ }
+
+exit:
+
+ return;
+}
+
+
+OSStatus
+CPrinterSetupWizardSheet::StartBrowse()
+{
+ OSStatus err;
+
+ //
+ // setup the DNS-SD browsing
+ //
+ err = DNSServiceBrowse( &m_pdlBrowser, 0, 0, kPDLServiceType, NULL, OnBrowse, this );
+ require_noerr( err, exit );
+
+ err = StartOperation( m_pdlBrowser );
+ require_noerr( err, exit );
+
+ err = DNSServiceBrowse( &m_lprBrowser, 0, 0, kLPRServiceType, NULL, OnBrowse, this );
+ require_noerr( err, exit );
+
+ err = StartOperation( m_lprBrowser );
+ require_noerr( err, exit );
+
+ err = DNSServiceBrowse( &m_ippBrowser, 0, 0, kIPPServiceType, NULL, OnBrowse, this );
+ require_noerr( err, exit );
+
+ err = StartOperation( m_ippBrowser );
+ require_noerr( err, exit );
+
+exit:
+
+ return err;
+}
+
+
+OSStatus
+CPrinterSetupWizardSheet::StopBrowse()
+{
+ OSStatus err;
+
+ err = StopOperation( m_pdlBrowser );
+ require_noerr( err, exit );
+
+ err = StopOperation( m_lprBrowser );
+ require_noerr( err, exit );
+
+ err = StopOperation( m_ippBrowser );
+ require_noerr( err, exit );
+
+ while ( m_printers.size() > 0 )
+ {
+ Printer * printer = m_printers.front();
+
+ m_printers.pop_front();
+
+ if ( printer->resolving )
+ {
+ StopResolve( printer );
+ }
+
+ delete printer;
+ }
+
+exit:
+
+ return err;
+}
+
+
+OSStatus
+CPrinterSetupWizardSheet::StartResolve( Printer * printer )
+{
+ OSStatus err = kNoErr;
+ Services::iterator it;
+
+ check( printer );
+
+ for ( it = printer->services.begin(); it != printer->services.end(); it++ )
+ {
+ if ( (*it)->serviceRef == NULL )
+ {
+ err = StartResolve( *it );
+ require_noerr( err, exit );
+ }
+ }
+
+ m_selectedPrinter = printer;
+
+exit:
+
+ return err;
+}
+
+
+OSStatus
+CPrinterSetupWizardSheet::StartResolve( Service * service )
+{
+ OSStatus err = kNoErr;
+
+ check( service->serviceRef == NULL );
+
+ //
+ // clean out any queues that were collected during a previous
+ // resolve
+ //
+
+ service->EmptyQueues();
+
+ //
+ // now start the new resolve
+ //
+
+ err = DNSServiceResolve( &service->serviceRef, 0, 0, service->printer->name.c_str(), service->type.c_str(), service->domain.c_str(), (DNSServiceResolveReply) OnResolve, service );
+ require_noerr( err, exit );
+
+ err = StartOperation( service->serviceRef );
+ require_noerr( err, exit );
+
+ //
+ // If we're not currently resolving, then disable the next button
+ // and set the cursor to hourglass
+ //
+
+ if ( !service->printer->resolving )
+ {
+ SetWizardButtons( PSWIZB_BACK );
+
+ m_active = m_wait;
+ SetCursor(m_active);
+ }
+
+ service->printer->resolving++;
+
+exit:
+
+ return err;
+}
+
+
+OSStatus
+CPrinterSetupWizardSheet::StopResolve(Printer * printer)
+{
+ OSStatus err = kNoErr;
+
+ check( printer );
+
+ Services::iterator it;
+
+ for ( it = printer->services.begin(); it != printer->services.end(); it++ )
+ {
+ if ( (*it)->serviceRef )
+ {
+ err = StopResolve( *it );
+ require_noerr( err, exit );
+ }
+ }
+
+exit:
+
+ return err;
+}
+
+
+OSStatus
+CPrinterSetupWizardSheet::StopResolve( Service * service )
+{
+ OSStatus err;
+
+ check( service->serviceRef );
+
+ err = StopOperation( service->serviceRef );
+ require_noerr( err, exit );
+
+ service->printer->resolving--;
+
+exit:
+
+ return err;
+}
+
+
+OSStatus
+CPrinterSetupWizardSheet::StartOperation( DNSServiceRef ref )
+{
+ OSStatus err;
+
+ err = WSAAsyncSelect((SOCKET) DNSServiceRefSockFD(ref), m_hWnd, WM_SOCKET_EVENT, FD_READ|FD_CLOSE);
+ require_noerr( err, exit );
+
+ m_serviceRefList.push_back( ref );
+
+exit:
+
+ return err;
+}
+
+
+OSStatus
+CPrinterSetupWizardSheet::StopOperation( DNSServiceRef & ref )
+{
+ OSStatus err = kNoErr;
+
+ if ( ref )
+ {
+ m_serviceRefList.remove( ref );
+
+ if ( IsWindow( m_hWnd ) )
+ {
+ err = WSAAsyncSelect((SOCKET) DNSServiceRefSockFD( ref ), m_hWnd, 0, 0 );
+ require_noerr( err, exit );
+ }
+
+ DNSServiceRefDeallocate( ref );
+ ref = NULL;
+ }
+
+exit:
+
+ return err;
+}
+
+
+OSStatus
+CPrinterSetupWizardSheet::ParseTextRecord( Service * service, Queue * q, uint16_t inTXTSize, const char * inTXT )
+{
+ check( service );
+ check( q );
+
+ // <rdar://problem/3946587> Use TXTRecord APIs declared in dns_sd.h
+
+ bool qtotalDefined = false;
+ const void * val;
+ char buf[256];
+ uint8_t len;
+ OSStatus err = kNoErr;
+
+ // <rdar://problem/3987680> Default to queue "lp"
+
+ q->name = L"lp";
+
+ // <rdar://problem/4003710> Default pdl key to be "application/postscript"
+
+ q->pdl = L"application/postscript";
+
+ if ( ( val = TXTRecordGetValuePtr( inTXTSize, inTXT, "rp", &len ) ) != NULL )
+ {
+ // Stringize val ( doesn't have trailing '\0' yet )
+
+ memcpy( buf, val, len );
+ buf[len] = '\0';
+
+ err = UTF8StringToStringObject( buf, q->name );
+ require_noerr( err, exit );
+ }
+
+ if ( ( val = TXTRecordGetValuePtr( inTXTSize, inTXT, "pdl", &len ) ) != NULL )
+ {
+ // Stringize val ( doesn't have trailing '\0' yet )
+
+ memcpy( buf, val, len );
+ buf[len] = '\0';
+
+ err = UTF8StringToStringObject( buf, q->pdl );
+ require_noerr( err, exit );
+ }
+
+ if ( ( ( val = TXTRecordGetValuePtr( inTXTSize, inTXT, "usb_mfg", &len ) ) != NULL ) ||
+ ( ( val = TXTRecordGetValuePtr( inTXTSize, inTXT, "usb_manufacturer", &len ) ) != NULL ) )
+ {
+ // Stringize val ( doesn't have trailing '\0' yet )
+
+ memcpy( buf, val, len );
+ buf[len] = '\0';
+
+ err = UTF8StringToStringObject( buf, q->usb_MFG );
+ require_noerr( err, exit );
+ }
+
+ if ( ( ( val = TXTRecordGetValuePtr( inTXTSize, inTXT, "usb_mdl", &len ) ) != NULL ) ||
+ ( ( val = TXTRecordGetValuePtr( inTXTSize, inTXT, "usb_model", &len ) ) != NULL ) )
+ {
+ // Stringize val ( doesn't have trailing '\0' yet )
+
+ memcpy( buf, val, len );
+ buf[len] = '\0';
+
+ err = UTF8StringToStringObject( buf, q->usb_MDL );
+ require_noerr( err, exit );
+ }
+
+ if ( ( val = TXTRecordGetValuePtr( inTXTSize, inTXT, "ty", &len ) ) != NULL )
+ {
+ // Stringize val ( doesn't have trailing '\0' yet )
+
+ memcpy( buf, val, len );
+ buf[len] = '\0';
+
+ err = UTF8StringToStringObject( buf, q->description );
+ require_noerr( err, exit );
+ }
+
+ if ( ( val = TXTRecordGetValuePtr( inTXTSize, inTXT, "product", &len ) ) != NULL )
+ {
+ // Stringize val ( doesn't have trailing '\0' yet )
+
+ memcpy( buf, val, len );
+ buf[len] = '\0';
+
+ err = UTF8StringToStringObject( buf, q->product );
+ require_noerr( err, exit );
+ }
+
+ if ( ( val = TXTRecordGetValuePtr( inTXTSize, inTXT, "note", &len ) ) != NULL )
+ {
+ // Stringize val ( doesn't have trailing '\0' yet )
+
+ memcpy( buf, val, len );
+ buf[len] = '\0';
+
+ err = UTF8StringToStringObject( buf, q->location );
+ require_noerr( err, exit );
+ }
+
+ if ( ( val = TXTRecordGetValuePtr( inTXTSize, inTXT, "qtotal", &len ) ) != NULL )
+ {
+ // Stringize val ( doesn't have trailing '\0' yet )
+
+ memcpy( buf, val, len );
+ buf[len] = '\0';
+
+ service->qtotal = (unsigned short) atoi( buf );
+ qtotalDefined = true;
+ }
+
+ if ( ( val = TXTRecordGetValuePtr( inTXTSize, inTXT, "priority", &len ) ) != NULL )
+ {
+ // Stringize val ( doesn't have trailing '\0' yet )
+
+ memcpy( buf, val, len );
+ buf[len] = '\0';
+
+ q->priority = atoi( buf );
+ }
+
+ // <rdar://problem/4124524> Was this printer discovered via OS X Printer Sharing?
+
+ if ( TXTRecordContainsKey( inTXTSize, inTXT, "printer-state" ) || TXTRecordContainsKey( inTXTSize, inTXT, "printer-type" ) )
+ {
+ service->printer->isCUPSPrinter = true;
+ }
+
+exit:
+
+ // The following code is to fix a problem with older HP
+ // printers that don't include "qtotal" in their text
+ // record. We'll check to see if the q->name is "TEXT"
+ // and if so, we're going to modify it to be "lp" so
+ // that we don't use the wrong queue
+
+ if ( !err && !qtotalDefined && ( q->name == L"TEXT" ) )
+ {
+ q->name = "lp";
+ }
+
+ return err;
+}
+
+
+Printer*
+CPrinterSetupWizardSheet::Lookup(const char * inName)
+{
+ check( inName );
+
+ Printer * printer = NULL;
+ Printers::iterator it;
+
+ for ( it = m_printers.begin(); it != m_printers.end(); it++ )
+ {
+ if ( (*it)->name == inName )
+ {
+ printer = *it;
+ break;
+ }
+ }
+
+ return printer;
+}
+
+
+bool
+CPrinterSetupWizardSheet::OrderServiceFunc( const Service * a, const Service * b )
+{
+ Queue * q1, * q2;
+
+ q1 = (a->queues.size() > 0) ? a->queues.front() : NULL;
+
+ q2 = (b->queues.size() > 0) ? b->queues.front() : NULL;
+
+ if ( !q1 && !q2 )
+ {
+ return true;
+ }
+ else if ( q1 && !q2 )
+ {
+ return true;
+ }
+ else if ( !q1 && q2 )
+ {
+ return false;
+ }
+ else if ( q1->priority < q2->priority )
+ {
+ return true;
+ }
+ else if ( q1->priority > q2->priority )
+ {
+ return false;
+ }
+ else if ( ( a->type == kPDLServiceType ) || ( ( a->type == kLPRServiceType ) && ( b->type == kIPPServiceType ) ) )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+
+bool
+CPrinterSetupWizardSheet::OrderQueueFunc( const Queue * q1, const Queue * q2 )
+{
+ return ( q1->priority <= q2->priority ) ? true : false;
+}
+
+
+
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardSheet.h b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardSheet.h
new file mode 100644
index 00000000..45110434
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/PrinterSetupWizardSheet.h
@@ -0,0 +1,352 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+
+#include "secondpage.h"
+#include "thirdpage.h"
+#include "fourthpage.h"
+#include "UtilTypes.h"
+#include "Logger.h"
+#include "dns_sd.h"
+#include <stdexcept>
+#include <map>
+
+using namespace PrinterSetupWizard;
+
+// CPrinterSetupWizardSheet
+
+class CPrinterSetupWizardSheet : public CPropertySheet
+{
+DECLARE_DYNAMIC(CPrinterSetupWizardSheet)
+
+public:
+
+struct WizardException
+{
+ CString text;
+ CString caption;
+};
+
+public:
+
+CPrinterSetupWizardSheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
+virtual ~CPrinterSetupWizardSheet();
+
+CPropertyPage*
+GetLastPage();
+
+void
+SetLastPage(CPropertyPage * page );
+
+void
+SetSelectedPrinter(Printer * printer);
+
+Printer*
+GetSelectedPrinter();
+
+OSStatus
+LoadPrinterDriver(const CString & filename);
+
+HCURSOR
+GetCursor();
+
+//
+// handles end of process event
+//
+virtual LRESULT
+OnProcessEvent(WPARAM inWParam, LPARAM inLParam);
+
+virtual LRESULT
+OnSocketEvent(WPARAM inWParam, LPARAM inLParam);
+
+virtual BOOL
+OnCommand(WPARAM wParam, LPARAM lParam);
+
+virtual BOOL
+OnInitDialog();
+
+virtual BOOL
+OnSetCursor(CWnd * pWnd, UINT nHitTest, UINT message);
+
+virtual void
+OnContextMenu(CWnd * pWnd, CPoint pos);
+
+afx_msg void
+OnOK();
+
+OSStatus
+StartResolve( Printer * printer );
+
+OSStatus
+StopResolve( Printer * printer );
+
+Printers m_printers;
+
+HCURSOR m_active;
+HCURSOR m_arrow;
+HCURSOR m_wait;
+
+protected:
+DECLARE_MESSAGE_MAP()
+CSecondPage m_pgSecond;
+CThirdPage m_pgThird;
+CFourthPage m_pgFourth;
+
+void
+OnServiceResolved(
+ Service * service);
+
+void Init(void);
+
+private:
+
+// This is from <cups/http.h>
+typedef enum http_encryption_e /**** HTTP encryption values ****/
+{
+ HTTP_ENCRYPT_IF_REQUESTED, /* Encrypt if requested (TLS upgrade) */
+ HTTP_ENCRYPT_NEVER, /* Never encrypt */
+ HTTP_ENCRYPT_REQUIRED, /* Encryption is required (TLS upgrade) */
+ HTTP_ENCRYPT_ALWAYS /* Always encrypt (SSL) */
+} http_encryption_t;
+
+typedef void* ( *httpConnectEncryptFunc )( const char* host, int port, http_encryption_t encryption );
+typedef http_encryption_t ( *cupsEncryptionFunc )( void );
+typedef void ( *cupsSetEncryptionFunc )( http_encryption_t e );
+typedef char* ( *cupsAdminCreateWindowsPPDFunc )( void * http, const char *dest, char *buffer, int bufsize );
+
+class CUPSLibrary
+{
+public:
+
+CUPSLibrary()
+ :
+ httpConnectEncrypt( NULL ),
+ cupsEncryption( NULL ),
+ cupsSetEncryption( NULL ),
+ cupsAdminCreateWindowsPPD( NULL ),
+ library( NULL )
+{
+#if defined( LIBCUPS_ENABLED )
+ if ( ( library = LoadLibrary( TEXT( "libcups2.dll" ) ) ) != NULL )
+ {
+ httpConnectEncrypt = ( httpConnectEncryptFunc ) GetProcAddress( library, "httpConnectEncrypt" );
+ cupsEncryption = ( cupsEncryptionFunc ) GetProcAddress( library, "cupsEncryption" );
+ cupsSetEncryption = ( cupsSetEncryptionFunc ) GetProcAddress( library, "cupsSetEncryption" );
+ cupsAdminCreateWindowsPPD = ( cupsAdminCreateWindowsPPDFunc ) GetProcAddress( library, "cupsAdminCreateWindowsPPD" );
+ }
+#endif
+}
+
+~CUPSLibrary()
+{
+ if ( library )
+ {
+ FreeLibrary( library );
+ library = NULL;
+ }
+}
+
+BOOL
+IsInstalled()
+{
+ return ( ( httpConnectEncrypt != NULL ) && ( cupsEncryption != NULL ) && ( cupsSetEncryption != NULL ) && ( cupsAdminCreateWindowsPPD != NULL ) );
+}
+
+httpConnectEncryptFunc httpConnectEncrypt;
+cupsEncryptionFunc cupsEncryption;
+cupsSetEncryptionFunc cupsSetEncryption;
+cupsAdminCreateWindowsPPDFunc cupsAdminCreateWindowsPPD;
+
+private:
+
+HMODULE library;
+};
+
+
+static void DNSSD_API
+OnBrowse(
+ DNSServiceRef inRef,
+ DNSServiceFlags inFlags,
+ uint32_t inInterfaceIndex,
+ DNSServiceErrorType inErrorCode,
+ const char * inName,
+ const char * inType,
+ const char * inDomain,
+ void * inContext );
+
+static void DNSSD_API
+OnResolve(
+ DNSServiceRef inRef,
+ DNSServiceFlags inFlags,
+ uint32_t inInterfaceIndex,
+ DNSServiceErrorType inErrorCode,
+ const char * inFullName,
+ const char * inHostName,
+ uint16_t inPort,
+ uint16_t inTXTSize,
+ const char * inTXT,
+ void * inContext );
+
+static void DNSSD_API
+OnQuery(
+ DNSServiceRef inRef,
+ DNSServiceFlags inFlags,
+ uint32_t inInterfaceIndex,
+ DNSServiceErrorType inErrorCode,
+ const char * inFullName,
+ uint16_t inRRType,
+ uint16_t inRRClass,
+ uint16_t inRDLen,
+ const void * inRData,
+ uint32_t inTTL,
+ void * inContext);
+
+Printer*
+OnAddPrinter(
+ uint32_t inInterfaceIndex,
+ const char * inName,
+ const char * inType,
+ const char * inDomain,
+ bool moreComing);
+
+OSStatus
+OnRemovePrinter(
+ Printer * printer,
+ bool moreComing);
+
+OSStatus
+OnAddService(
+ Printer * printer,
+ uint32_t inInterfaceIndex,
+ const char * inName,
+ const char * inType,
+ const char * inDomain);
+
+OSStatus
+OnRemoveService(
+ Service * service);
+
+void
+OnResolveService(
+ Service * service );
+
+static bool
+OrderServiceFunc( const Service * a, const Service * b );
+
+static bool
+OrderQueueFunc( const Queue * q1, const Queue * q2 );
+
+OSStatus
+StartOperation( DNSServiceRef ref );
+
+OSStatus
+StopOperation( DNSServiceRef & ref );
+
+OSStatus
+StartBrowse();
+
+OSStatus
+StopBrowse();
+
+OSStatus
+StartResolve( Service * service );
+
+OSStatus
+StopResolve( Service * service );
+
+OSStatus
+ParseTextRecord( Service * service, Queue * q, uint16_t inTXTSize, const char * inTXT );
+
+OSStatus
+LoadPrinterNames();
+
+Printer*
+Lookup( const char * name );
+
+OSStatus
+InstallPrinter(Printer * printer);
+
+OSStatus
+InstallPrinterPort( Printer * printer, Service * service, DWORD protocol, Logger & log );
+
+OSStatus
+InstallPrinterPDLAndLPR(Printer * printer, Service * service, Logger & log);
+
+OSStatus
+InstallPrinterIPP(Printer * printer, Service * service, Logger & log);
+
+OSStatus
+InstallPrinterCUPS( Printer * printer, Service * service, CUPSLibrary & cupsLib );
+
+OSStatus
+InstallPrinterCUPS(Printer * printer, Service * service, CUPSLibrary & cupsLib, TCHAR * env );
+
+static unsigned WINAPI
+InstallDriverThread( LPVOID inParam );
+
+typedef std::list<CString> PrinterNames;
+typedef std::list<DNSServiceRef> ServiceRefList;
+static CPrinterSetupWizardSheet * m_self;
+PrinterNames m_printerNames;
+Printer * m_selectedPrinter;
+bool m_driverThreadFinished;
+DWORD m_driverThreadExitCode;
+ServiceRefList m_serviceRefList;
+DNSServiceRef m_pdlBrowser;
+DNSServiceRef m_lprBrowser;
+DNSServiceRef m_ippBrowser;
+DNSServiceRef m_resolver;
+
+CPropertyPage * m_lastPage;
+};
+
+
+inline Printer*
+CPrinterSetupWizardSheet::GetSelectedPrinter()
+{
+ return m_selectedPrinter;
+}
+
+
+inline HCURSOR
+CPrinterSetupWizardSheet::GetCursor()
+{
+ return m_active;
+}
+
+
+inline CPropertyPage*
+CPrinterSetupWizardSheet::GetLastPage()
+{
+ return m_lastPage;
+}
+
+
+inline void
+CPrinterSetupWizardSheet::SetLastPage(CPropertyPage * lastPage)
+{
+ m_lastPage = lastPage;
+}
+
+
+// Service Types
+
+#define kPDLServiceType "_pdl-datastream._tcp."
+#define kLPRServiceType "_printer._tcp."
+#define kIPPServiceType "_ipp._tcp."
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/ReadMe.txt b/mDNSResponder/Clients/PrinterSetupWizard/ReadMe.txt
new file mode 100644
index 00000000..9b5eb412
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/ReadMe.txt
@@ -0,0 +1,94 @@
+================================================================================
+ MICROSOFT FOUNDATION CLASS LIBRARY : Wiz97_3 Project Overview
+===============================================================================
+
+The application wizard has created this Wiz97_3 application for
+you. This application not only demonstrates the basics of using the Microsoft
+Foundation Classes but is also a starting point for writing your application.
+
+This file contains a summary of what you will find in each of the files that
+make up your Wiz97_3 application.
+
+Wiz97_3.vcproj
+ This is the main project file for VC++ projects generated using an application wizard.
+ It contains information about the version of Visual C++ that generated the file, and
+ information about the platforms, configurations, and project features selected with the
+ application wizard.
+
+Wiz97_3.h
+ This is the main header file for the application. It includes other
+ project specific headers (including Resource.h) and declares the
+ CWiz97_3App application class.
+
+Wiz97_3.cpp
+ This is the main application source file that contains the application
+ class CWiz97_3App.
+
+Wiz97_3.rc
+ This is a listing of all of the Microsoft Windows resources that the
+ program uses. It includes the icons, bitmaps, and cursors that are stored
+ in the RES subdirectory. This file can be directly edited in Microsoft
+ Visual C++. Your project resources are in 1033.
+
+res\Wiz97_3.ico
+ This is an icon file, which is used as the application's icon. This
+ icon is included by the main resource file Wiz97_3.rc.
+
+res\Wiz97_3.rc2
+ This file contains resources that are not edited by Microsoft
+ Visual C++. You should place all resources not editable by
+ the resource editor in this file.
+
+/////////////////////////////////////////////////////////////////////////////
+
+The application wizard creates one dialog class:
+Wiz97_3Dlg.h, Wiz97_3Dlg.cpp - the dialog
+ These files contain your CWiz97_3Dlg class. This class defines
+ the behavior of your application's main dialog. The dialog's template is
+ in Wiz97_3.rc, which can be edited in Microsoft Visual C++.
+/////////////////////////////////////////////////////////////////////////////
+
+Other Features:
+
+ActiveX Controls
+ The application includes support to use ActiveX controls.
+
+Printing and Print Preview support
+ The application wizard has generated code to handle the print, print setup, and print preview
+ commands by calling member functions in the CView class from the MFC library.
+/////////////////////////////////////////////////////////////////////////////
+
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+ These files are used to build a precompiled header (PCH) file
+ named Wiz97_3.pch and a precompiled types file named StdAfx.obj.
+
+Resource.h
+ This is the standard header file, which defines new resource IDs.
+ Microsoft Visual C++ reads and updates this file.
+
+Wiz97_3.manifest
+ Application manifest files are used by Windows XP to describe an applications
+ dependency on specific versions of Side-by-Side assemblies. The loader uses this
+ information to load the appropriate assembly from the assembly cache or private
+ from the application. The Application manifest maybe included for redistribution
+ as an external .manifest file that is installed in the same folder as the application
+ executable or it may be included in the executable in the form of a resource.
+/////////////////////////////////////////////////////////////////////////////
+
+Other notes:
+
+The application wizard uses "TODO:" to indicate parts of the source code you
+should add to or customize.
+
+If your application uses MFC in a shared DLL, and your application is in a
+language other than the operating system's current language, you will need
+to copy the corresponding localized resources MFC70XXX.DLL from the Microsoft
+Visual C++ CD-ROM under the Win\System directory to your computer's system or
+system32 directory, and rename it to be MFCLOC.DLL. ("XXX" stands for the
+language abbreviation. For example, MFC70DEU.DLL contains resources
+translated to German.) If you don't do this, some of the UI elements of
+your application will remain in the language of the operating system.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/SecondPage.cpp b/mDNSResponder/Clients/PrinterSetupWizard/SecondPage.cpp
new file mode 100644
index 00000000..1521d0d9
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/SecondPage.cpp
@@ -0,0 +1,513 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "stdafx.h"
+#include "PrinterSetupWizardApp.h"
+#include "PrinterSetupWizardSheet.h"
+#include "SecondPage.h"
+#include "DebugServices.h"
+#include "WinServices.h"
+#include <winspool.h>
+
+// local variable is initialize but not referenced
+#pragma warning(disable:4189)
+
+// CSecondPage dialog
+
+IMPLEMENT_DYNAMIC(CSecondPage, CPropertyPage)
+CSecondPage::CSecondPage()
+ : CPropertyPage(CSecondPage::IDD)
+{
+ m_psp.dwFlags &= ~(PSP_HASHELP);
+ m_psp.dwFlags |= PSP_DEFAULT|PSP_USEHEADERTITLE|PSP_USEHEADERSUBTITLE;
+
+ m_psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_BROWSE_TITLE);
+ m_psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_BROWSE_SUBTITLE);
+
+ m_emptyListItem = NULL;
+ m_initialized = false;
+ m_waiting = false;
+}
+
+
+CSecondPage::~CSecondPage()
+{
+}
+
+
+void
+CSecondPage::InitBrowseList()
+{
+ CPrinterSetupWizardSheet * psheet;
+ CString text;
+
+ psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent());
+ require_quiet( psheet, exit );
+
+ // Initialize so that nothing is selected when we add to the list
+
+ psheet->SetSelectedPrinter( NULL );
+ m_gotChoice = false;
+ m_browseList.Select( NULL, TVGN_FIRSTVISIBLE );
+
+ //
+ // load the no printers message until something shows up in the browse list
+ //
+ text.LoadString(IDS_NO_PRINTERS);
+
+ LoadTextAndDisableWindow( text );
+
+ //
+ // disable the next button until there's a printer to select
+ //
+ psheet->SetWizardButtons(PSWIZB_BACK);
+
+ //
+ // disable the printer information box
+ //
+ SetPrinterInformationState( FALSE );
+ m_descriptionField.SetWindowText( L"" );
+ m_locationField.SetWindowText( L"" );
+
+exit:
+
+ return;
+}
+
+
+void CSecondPage::DoDataExchange(CDataExchange* pDX)
+{
+ CPropertyPage::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_BROWSE_LIST, m_browseList);
+ DDX_Control(pDX, IDC_PRINTER_INFORMATION, m_printerInformation);
+
+ DDX_Control(pDX, IDC_DESCRIPTION_LABEL, m_descriptionLabel);
+
+ DDX_Control(pDX, IDC_DESCRIPTION_FIELD, m_descriptionField);
+
+ DDX_Control(pDX, IDC_LOCATION_LABEL, m_locationLabel);
+
+ DDX_Control(pDX, IDC_LOCATION_FIELD, m_locationField);
+
+}
+
+
+afx_msg BOOL
+CSecondPage::OnSetCursor(CWnd * pWnd, UINT nHitTest, UINT message)
+{
+ DEBUG_UNUSED(pWnd);
+ DEBUG_UNUSED(nHitTest);
+ DEBUG_UNUSED(message);
+
+ CPrinterSetupWizardSheet * psheet;
+
+ psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent());
+ require_quiet( psheet, exit );
+
+ SetCursor(psheet->GetCursor());
+
+exit:
+
+ return TRUE;
+}
+
+
+BOOL
+CSecondPage::OnSetActive()
+{
+ CPrinterSetupWizardSheet * psheet;
+ Printer * printer;
+ CWnd * pWnd;
+ Printers::iterator it;
+ OSStatus err = kNoErr;
+ BOOL b;
+
+ b = CPropertyPage::OnSetActive();
+
+ psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent());
+ require_action( psheet, exit, err = kUnknownErr );
+
+ // Stash the selected printer if any
+
+ printer = psheet->GetSelectedPrinter();
+
+ // initialize the browse list...this will remove everything currently
+ // in it, and add the no printers item
+
+ InitBrowseList();
+
+ // Populate the list with any printers that we currently know about
+
+ for ( it = psheet->m_printers.begin(); it != psheet->m_printers.end(); it++ )
+ {
+ OnAddPrinter( *it, false );
+ }
+
+ if ( ( !printer && ( psheet->m_printers.size() > 0 ) ) || ( printer != psheet->GetSelectedPrinter() ) )
+ {
+ if ( !printer )
+ {
+ printer = psheet->m_printers.front();
+ }
+
+ psheet->SetSelectedPrinter( printer );
+ }
+
+ if ( printer )
+ {
+ m_browseList.SelectItem( printer->item );
+ ::SetFocus( m_browseList );
+ }
+
+ // Hide the back button
+ pWnd = ((CPropertySheet*)GetParent())->GetDlgItem(ID_WIZBACK);
+ if ( pWnd != NULL )
+ {
+ pWnd->ShowWindow(SW_HIDE);
+ }
+
+exit:
+
+ return b;
+}
+
+
+BOOL
+CSecondPage::OnKillActive()
+{
+ CPrinterSetupWizardSheet * psheet;
+ CWnd * pWnd;
+
+ psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent());
+ require_quiet( psheet, exit );
+
+ psheet->SetLastPage(this);
+
+ // Show the back button
+ pWnd = ((CPropertySheet*)GetParent())->GetDlgItem(ID_WIZBACK);
+ if ( pWnd != NULL )
+ {
+ pWnd->ShowWindow(SW_SHOW);
+ }
+
+exit:
+
+ return CPropertyPage::OnKillActive();
+}
+
+
+BEGIN_MESSAGE_MAP(CSecondPage, CPropertyPage)
+ ON_NOTIFY(TVN_SELCHANGED, IDC_BROWSE_LIST, OnTvnSelchangedBrowseList)
+ ON_NOTIFY(NM_CLICK, IDC_BROWSE_LIST, OnNmClickBrowseList)
+ ON_NOTIFY(TVN_KEYDOWN, IDC_BROWSE_LIST, OnTvnKeyDownBrowseList)
+ ON_WM_SETCURSOR()
+END_MESSAGE_MAP()
+
+
+// Printer::EventHandler implementation
+OSStatus
+CSecondPage::OnAddPrinter(
+ Printer * printer,
+ bool moreComing )
+{
+ CPrinterSetupWizardSheet * psheet;
+ Printer * selectedPrinter;
+ OSStatus err = kNoErr;
+
+ check( IsWindow( m_hWnd ) );
+
+ m_browseList.SetRedraw(FALSE);
+
+ psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent());
+ require_quiet( psheet, exit );
+
+ if ( printer )
+ {
+ selectedPrinter = psheet->GetSelectedPrinter();
+
+ printer->item = m_browseList.InsertItem(printer->displayName);
+
+ m_browseList.SetItemData( printer->item, (DWORD_PTR) printer );
+
+ m_browseList.SortChildren(TVI_ROOT);
+
+ //
+ // if the searching item is still in the list
+ // get rid of it
+ //
+ // note that order is important here. Insert the printer
+ // item before removing the placeholder so we always have
+ // an item in the list to avoid experiencing the bug
+ // in Microsoft's implementation of CTreeCtrl
+ //
+ if (m_emptyListItem != NULL)
+ {
+ m_browseList.DeleteItem(m_emptyListItem);
+ m_emptyListItem = NULL;
+ m_browseList.EnableWindow(TRUE);
+ }
+
+ if ( !selectedPrinter )
+ {
+ psheet->SetSelectedPrinter( printer );
+ m_browseList.SelectItem( printer->item );
+ ::SetFocus( m_browseList );
+ }
+ }
+
+exit:
+
+ if (!moreComing)
+ {
+ m_browseList.SetRedraw(TRUE);
+ m_browseList.Invalidate();
+ }
+
+ return err;
+}
+
+
+OSStatus
+CSecondPage::OnRemovePrinter(
+ Printer * printer,
+ bool moreComing)
+{
+ CPrinterSetupWizardSheet * psheet;
+ OSStatus err = kNoErr;
+
+ check( IsWindow( m_hWnd ) );
+ check( printer );
+
+ psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent());
+ require_quiet( psheet, exit );
+
+ m_browseList.SetRedraw(FALSE);
+
+ if ( printer )
+ {
+ //
+ // check to make sure if we're the only item in the control...i.e.
+ // the list size is 1.
+ //
+ if (m_browseList.GetCount() > 1)
+ {
+ //
+ // if we're not the only thing in the list, then
+ // simply remove it from the list
+ //
+ m_browseList.DeleteItem( printer->item );
+ }
+ else
+ {
+ //
+ // if we're the only thing in the list, then redisplay
+ // it with the no printers message
+ //
+ InitBrowseList();
+ }
+ }
+
+exit:
+
+ if ( !moreComing )
+ {
+ m_browseList.SetRedraw(TRUE);
+ m_browseList.Invalidate();
+ }
+
+ return err;
+}
+
+
+void
+CSecondPage::OnResolveService( Service * service )
+{
+ CPrinterSetupWizardSheet * psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent());
+ require_quiet( psheet, exit );
+
+ check( service );
+
+ Queue * q = service->SelectedQueue();
+
+ check( q );
+
+
+ //
+ // and set it to selected
+ //
+
+ m_selectedName = service->printer->name;
+
+ //
+ // and update the printer information box
+ //
+ SetPrinterInformationState( TRUE );
+
+ m_descriptionField.SetWindowText( q->description );
+ m_locationField.SetWindowText( q->location );
+
+ //
+ // reset the cursor
+ //
+
+ SetCursor(psheet->m_active);
+
+exit:
+
+ return;
+}
+
+
+void CSecondPage::OnTvnSelchangedBrowseList(NMHDR *pNMHDR, LRESULT *pResult)
+{
+ LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
+ CPrinterSetupWizardSheet * psheet;
+ Printer * printer;
+ int err = 0;
+
+ psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent());
+ require_action( psheet, exit, err = kUnknownErr );
+
+ // The strange code here is to workaround a bug in the CTreeCtrl, whereupon the item
+ // we selected isn't passed through correctly to this callback routine.
+
+ if ( !m_gotChoice )
+ {
+ printer = psheet->GetSelectedPrinter();
+
+ // If we really haven't selected a printer, then re-select NULL and exit
+
+ if ( !printer )
+ {
+ m_browseList.SelectItem( NULL );
+
+ goto exit;
+ }
+
+ // If we already have selected a printer, fake like we've clicked on it, but only
+ // if the CTreeCtrl hasn't already selected it
+
+ else if ( printer->item != m_browseList.GetSelectedItem() )
+ {
+ m_gotChoice = true;
+
+ m_browseList.SelectItem( printer->item );
+
+ goto exit;
+ }
+ }
+
+ HTREEITEM item = m_browseList.GetSelectedItem();
+ require_quiet( item, exit );
+
+ printer = reinterpret_cast<Printer*>(m_browseList.GetItemData( item ) );
+ require_quiet( printer, exit );
+
+ //
+ // this call will trigger a resolve. When the resolve is complete,
+ // our OnResolve will be called.
+ //
+ err = psheet->StartResolve( printer );
+ require_noerr( err, exit );
+
+ //
+ // And clear out the printer information box
+ //
+ SetPrinterInformationState( FALSE );
+ m_descriptionField.SetWindowText(L"");
+ m_locationField.SetWindowText(L"");
+
+exit:
+
+ if (err != 0)
+ {
+ CString text;
+ CString caption;
+
+ text.LoadString(IDS_ERROR_SELECTING_PRINTER_TEXT);
+ caption.LoadString(IDS_ERROR_SELECTING_PRINTER_CAPTION);
+
+ MessageBox(text, caption, MB_OK|MB_ICONEXCLAMATION);
+ }
+
+ *pResult = 0;
+}
+
+
+void CSecondPage::OnNmClickBrowseList(NMHDR *pNMHDR, LRESULT *pResult)
+{
+ DEBUG_UNUSED( pNMHDR );
+
+ m_gotChoice = true;
+
+ *pResult = 0;
+}
+
+
+void CSecondPage::OnTvnKeyDownBrowseList( NMHDR * pNMHDR, LRESULT * pResult)
+{
+ DEBUG_UNUSED( pNMHDR );
+
+ m_gotChoice = true;
+
+ *pResult = 0;
+}
+
+
+void
+CSecondPage::LoadTextAndDisableWindow( CString & text )
+{
+ m_emptyListItem = m_browseList.InsertItem( text, 0, 0, NULL, TVI_FIRST );
+ m_browseList.SelectItem( NULL );
+
+ //
+ // this will remove everything else in the list...we might be navigating
+ // back to this window, and the browse list might have changed since
+ // we last displayed it.
+ //
+ if ( m_emptyListItem )
+ {
+ HTREEITEM item = m_browseList.GetNextVisibleItem( m_emptyListItem );
+
+ while ( item )
+ {
+ m_browseList.DeleteItem( item );
+ item = m_browseList.GetNextVisibleItem( m_emptyListItem );
+ }
+ }
+
+ m_browseList.EnableWindow( FALSE );
+}
+
+
+void
+CSecondPage::SetPrinterInformationState( BOOL state )
+{
+ m_printerInformation.EnableWindow( state );
+
+ m_descriptionLabel.EnableWindow( state );
+
+ m_descriptionField.EnableWindow( state );
+
+ m_locationLabel.EnableWindow( state );
+
+ m_locationField.EnableWindow( state );
+
+}
+
+
+
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/SecondPage.h b/mDNSResponder/Clients/PrinterSetupWizard/SecondPage.h
new file mode 100644
index 00000000..3fb4c462
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/SecondPage.h
@@ -0,0 +1,105 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "PrinterSetupWizardSheet.h"
+#include "CommonServices.h"
+#include "UtilTypes.h"
+#include "afxcmn.h"
+#include "dns_sd.h"
+#include "afxwin.h"
+#include <map>
+
+using namespace PrinterSetupWizard;
+
+// CSecondPage dialog
+
+class CSecondPage : public CPropertyPage
+{
+DECLARE_DYNAMIC(CSecondPage)
+
+public:
+CSecondPage();
+virtual ~CSecondPage();
+
+// Dialog Data
+enum { IDD = IDD_SECOND_PAGE };
+
+protected:
+
+void InitBrowseList();
+virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+afx_msg BOOL OnSetCursor(CWnd * pWnd, UINT nHitTest, UINT message);
+virtual BOOL OnSetActive();
+virtual BOOL OnKillActive();
+
+DECLARE_MESSAGE_MAP()
+
+public:
+
+HTREEITEM m_emptyListItem;
+bool m_selectOkay;
+CTreeCtrl m_browseList;
+bool m_initialized;
+bool m_waiting;
+
+afx_msg void OnTvnSelchangedBrowseList(NMHDR *pNMHDR, LRESULT *pResult);
+afx_msg void OnNmClickBrowseList(NMHDR * pNMHDR, LRESULT * pResult);
+afx_msg void OnTvnKeyDownBrowseList(NMHDR * pNMHDR, LRESULT * pResult );
+
+OSStatus
+OnAddPrinter(
+ Printer * printer,
+ bool moreComing);
+
+OSStatus
+OnRemovePrinter(
+ Printer * printer,
+ bool moreComing);
+
+void
+OnResolveService( Service * service );
+
+private:
+
+void
+LoadTextAndDisableWindow( CString & text );
+
+void
+SetPrinterInformationState( BOOL state );
+
+std::string m_selectedName;
+
+
+private:
+
+
+
+CStatic m_printerInformation;
+
+CStatic m_descriptionLabel;
+
+CStatic m_descriptionField;
+
+CStatic m_locationLabel;
+
+CStatic m_locationField;
+
+
+bool m_gotChoice;
+};
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/ThirdPage.cpp b/mDNSResponder/Clients/PrinterSetupWizard/ThirdPage.cpp
new file mode 100644
index 00000000..6caf55cb
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/ThirdPage.cpp
@@ -0,0 +1,1583 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "stdafx.h"
+#include "PrinterSetupWizardApp.h"
+#include "PrinterSetupWizardSheet.h"
+#include "ThirdPage.h"
+#include "tcpxcv.h"
+#include <dns_sd.h>
+#include <winspool.h>
+#include <setupapi.h>
+
+// local variable is initialize but not referenced
+#pragma warning(disable:4189)
+
+//
+// This is the printer description file that is shipped
+// with Windows XP and below
+//
+#define kNTPrintFile L"inf\\ntprint.inf"
+
+//
+// Windows Vista ships with a set of prn*.inf files
+//
+#define kVistaPrintFiles L"inf\\prn*.inf"
+
+//
+// These are pre-defined names for Generic manufacturer and model
+//
+#define kGenericManufacturer L"Generic"
+#define kGenericText L"Generic / Text Only"
+#define kGenericPostscript L"Generic / Postscript"
+#define kGenericPCL L"Generic / PCL"
+#define kPDLPostscriptKey L"application/postscript"
+#define kPDLPCLKey L"application/vnd.hp-pcl"
+#define kGenericPSColorDriver L"HP Color LaserJet 4550 PS"
+#define kGenericPSDriver L"HP LaserJet 4050 Series PS"
+#define kGenericPCLColorDriver L"HP Color LaserJet 4550 PCL"
+#define kGenericPCLDriver L"HP LaserJet 4050 Series PCL"
+
+
+// CThirdPage dialog
+
+IMPLEMENT_DYNAMIC(CThirdPage, CPropertyPage)
+CThirdPage::CThirdPage()
+ : CPropertyPage(CThirdPage::IDD),
+ m_manufacturerSelected( NULL ),
+ m_modelSelected( NULL ),
+ m_genericPostscript( NULL ),
+ m_genericPCL( NULL ),
+ m_initialized(false),
+ m_printerImage( NULL )
+{
+ static const int bufferSize = 32768;
+ TCHAR windowsDirectory[bufferSize];
+ CString header;
+ WIN32_FIND_DATA findFileData;
+ HANDLE findHandle;
+ CString prnFiles;
+ CString ntPrint;
+ OSStatus err;
+ BOOL ok;
+
+ m_psp.dwFlags &= ~(PSP_HASHELP);
+ m_psp.dwFlags |= PSP_DEFAULT|PSP_USEHEADERTITLE|PSP_USEHEADERSUBTITLE;
+
+ m_psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_INSTALL_TITLE);
+ m_psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_INSTALL_SUBTITLE);
+
+ //
+ // load printers from ntprint.inf
+ //
+ ok = GetWindowsDirectory( windowsDirectory, bufferSize );
+ err = translate_errno( ok, errno_compat(), kUnknownErr );
+ require_noerr( err, exit );
+
+ //
+ // <rdar://problem/4826126>
+ //
+ // If there are no *prn.inf files, we'll assume that the information
+ // is in ntprint.inf
+ //
+ prnFiles.Format( L"%s\\%s", windowsDirectory, kVistaPrintFiles );
+ findHandle = FindFirstFile( prnFiles, &findFileData );
+
+ if ( findHandle != INVALID_HANDLE_VALUE )
+ {
+ CString absolute;
+
+ absolute.Format( L"%s\\inf\\%s", windowsDirectory, findFileData.cFileName );
+ err = LoadPrintDriverDefsFromFile( m_manufacturers, absolute, false );
+ require_noerr( err, exit );
+
+ while ( FindNextFile( findHandle, &findFileData ) )
+ {
+ absolute.Format( L"%s\\inf\\%s", windowsDirectory, findFileData.cFileName );
+ err = LoadPrintDriverDefsFromFile( m_manufacturers, absolute, false );
+ require_noerr( err, exit );
+ }
+
+ FindClose( findHandle );
+ }
+ else
+ {
+ ntPrint.Format(L"%s\\%s", windowsDirectory, kNTPrintFile);
+ err = LoadPrintDriverDefsFromFile( m_manufacturers, ntPrint, false );
+ require_noerr(err, exit);
+ }
+
+ //
+ // load printer drivers that have been installed on this machine
+ //
+ err = LoadPrintDriverDefs( m_manufacturers );
+ require_noerr(err, exit);
+
+ //
+ // load our own special generic printer defs
+ //
+ err = LoadGenericPrintDriverDefs( m_manufacturers );
+ require_noerr( err, exit );
+
+exit:
+
+ return;
+}
+
+
+void
+CThirdPage::FreeManufacturers( Manufacturers & manufacturers )
+{
+ for ( Manufacturers::iterator it = manufacturers.begin(); it != manufacturers.end(); it++ )
+ {
+ for ( Models::iterator it2 = it->second->models.begin(); it2 != it->second->models.end(); it2++ )
+ {
+ delete *it2;
+ }
+
+ delete it->second;
+ }
+}
+
+
+CThirdPage::~CThirdPage()
+{
+ FreeManufacturers( m_manufacturers );
+}
+
+// ----------------------------------------------------
+// SelectMatch
+//
+// SelectMatch will do all the UI work associated with
+// selected a manufacturer and model of printer. It also
+// makes sure the printer object is update with the
+// latest settings
+//
+// ----------------------------------------------------
+void
+CThirdPage::SelectMatch(Printer * printer, Service * service, Manufacturer * manufacturer, Model * model)
+{
+ LVFINDINFO info;
+ int nIndex;
+
+ check( printer != NULL );
+ check( manufacturer != NULL );
+ check( model != NULL );
+
+ //
+ // select the manufacturer
+ //
+ info.flags = LVFI_STRING;
+ info.psz = manufacturer->name;
+
+ nIndex = m_manufacturerListCtrl.FindItem(&info);
+
+ if (nIndex != -1)
+ {
+ m_manufacturerListCtrl.SetItemState(nIndex, LVIS_SELECTED, LVIS_SELECTED);
+ //
+ //<rdar://problem/4528853> mDNS: When auto-highlighting items in lists, scroll list so highlighted item is in the middle
+ //
+ AutoScroll(m_manufacturerListCtrl, nIndex);
+ }
+
+ //
+ // select the model
+ //
+ info.flags = LVFI_STRING;
+ info.psz = model->displayName;
+
+ nIndex = m_modelListCtrl.FindItem(&info);
+
+ if (nIndex != -1)
+ {
+ m_modelListCtrl.SetItemState(nIndex, LVIS_SELECTED, LVIS_SELECTED);
+ AutoScroll( m_modelListCtrl, nIndex );
+
+ m_modelListCtrl.SetFocus();
+ }
+
+ CopyPrinterSettings( printer, service, manufacturer, model );
+}
+
+void
+CThirdPage::SelectMatch(Manufacturers & manufacturers, Printer * printer, Service * service, Manufacturer * manufacturer, Model * model)
+{
+ PopulateUI( manufacturers );
+
+ SelectMatch( printer, service, manufacturer, model );
+}
+
+// --------------------------------------------------------
+// CopyPrinterSettings
+//
+// This function makes sure that the printer object has the
+// latest settings from the manufacturer and model objects
+// --------------------------------------------------------
+
+void
+CThirdPage::CopyPrinterSettings( Printer * printer, Service * service, Manufacturer * manufacturer, Model * model )
+{
+ DWORD portNameLen;
+
+ printer->manufacturer = manufacturer->name;
+ printer->displayModelName = model->displayName;
+ printer->modelName = model->name;
+ printer->driverInstalled = model->driverInstalled;
+ printer->infFileName = model->infFileName;
+
+ if ( service->type == kPDLServiceType )
+ {
+ printer->portName.Format(L"IP_%s.%d", static_cast<LPCTSTR>(service->hostname), service->portNumber);
+ service->protocol = L"Raw";
+ }
+ else if ( service->type == kLPRServiceType )
+ {
+ Queue * q = service->queues.front();
+ check( q );
+
+ if ( q->name.GetLength() > 0 )
+ {
+ printer->portName.Format(L"LPR_%s.%d.%s", static_cast<LPCTSTR>(service->hostname), service->portNumber, static_cast<LPCTSTR>(q->name) );
+ }
+ else
+ {
+ printer->portName.Format(L"LPR_%s.%d", static_cast<LPCTSTR>(service->hostname), service->portNumber);
+ }
+
+ service->protocol = L"LPR";
+ }
+ else if ( service->type == kIPPServiceType )
+ {
+ Queue * q = service->queues.front();
+ check( q );
+
+ if ( q->name.GetLength() > 0 )
+ {
+ printer->portName.Format(L"http://%s:%d/%s", static_cast<LPCTSTR>(service->hostname), service->portNumber, static_cast<LPCTSTR>(q->name) );
+ }
+ else
+ {
+ printer->portName.Format(L"http://%s:%d/", static_cast<LPCTSTR>(service->hostname), service->portNumber );
+ }
+
+ service->protocol = L"IPP";
+ }
+
+ // If it's not an IPP printr, truncate the portName so that it's valid
+
+ if ( service->type != kIPPServiceType )
+ {
+ portNameLen = printer->portName.GetLength() + 1;
+
+ if ( portNameLen > MAX_PORTNAME_LEN )
+ {
+ printer->portName.Delete( MAX_PORTNAME_LEN - 1, ( portNameLen - MAX_PORTNAME_LEN ) );
+ }
+ }
+}
+
+// --------------------------------------------------------
+// DefaultPrinterExists
+//
+// Checks to see if a default printer has been configured
+// on this machine
+// --------------------------------------------------------
+BOOL
+CThirdPage::DefaultPrinterExists()
+{
+ CPrintDialog dlg(FALSE);
+
+ dlg.m_pd.Flags |= PD_RETURNDEFAULT;
+
+ return dlg.GetDefaults();
+}
+
+// --------------------------------------------------------
+// AutoScroll
+//
+// Ensure selected item is in middle of list
+// --------------------------------------------------------
+void
+CThirdPage::AutoScroll( CListCtrl & list, int nIndex )
+{
+ //
+ //<rdar://problem/4528853> mDNS: When auto-highlighting items in lists, scroll list so highlighted item is in the middle
+ //
+
+ int top;
+ int count;
+
+ list.EnsureVisible( nIndex, FALSE );
+
+ top = list.GetTopIndex();
+ count = list.GetCountPerPage();
+
+ if ( ( nIndex == top ) || ( ( nIndex + 1 ) == ( top + count ) ) )
+ {
+ CRect rect;
+ int rows;
+
+ rows = ( count / 2 );
+
+ if ( nIndex == top )
+ {
+ list.GetItemRect(0, rect, LVIR_BOUNDS);
+ list.Scroll( CPoint( 0, rows * rect.Height() * -1 ) );
+ }
+ else
+ {
+ list.GetItemRect(0, rect, LVIR_BOUNDS);
+ list.Scroll( CPoint( 0, rows * rect.Height() ) );
+ }
+ }
+}
+
+// ------------------------------------------------------
+// LoadPrintDriverDefsFromFile
+//
+// The only potentially opaque thing about this function is the
+// checkForDuplicateModels flag. The problem here is that ntprint.inf
+// doesn't contain duplicate models, and it has hundreds of models
+// listed. You wouldn't check for duplicates there. But oftentimes,
+// loading different windows print driver files contain multiple
+// entries for the same printer. You don't want the UI to display
+// the same printer multiple times, so in that case, you would ask
+// this function to check for multiple models.
+
+OSStatus
+CThirdPage::LoadPrintDriverDefsFromFile(Manufacturers & manufacturers, const CString & filename, bool checkForDuplicateModels )
+{
+ HINF handle = INVALID_HANDLE_VALUE;
+ const TCHAR * section = TEXT( "Manufacturer" );
+ LONG sectionCount;
+ TCHAR line[ 1000 ];
+ CString klass;
+ INFCONTEXT manufacturerContext;
+ BOOL ok;
+ OSStatus err = 0;
+
+ // Make sure we can open the file
+ handle = SetupOpenInfFile( filename, NULL, INF_STYLE_WIN4, NULL );
+ translate_errno( handle != INVALID_HANDLE_VALUE, GetLastError(), kUnknownErr );
+ require_noerr( err, exit );
+
+ // Make sure it's a printer file
+ ok = SetupGetLineText( NULL, handle, TEXT( "Version" ), TEXT( "Class" ), line, sizeof( line ), NULL );
+ translate_errno( ok, GetLastError(), kUnknownErr );
+ require_noerr( err, exit );
+ klass = line;
+ require_action( klass == TEXT( "Printer" ), exit, err = kUnknownErr );
+
+ sectionCount = SetupGetLineCount( handle, section );
+ translate_errno( sectionCount != -1, GetLastError(), kUnknownErr );
+ require_noerr( err, exit );
+
+ memset( &manufacturerContext, 0, sizeof( manufacturerContext ) );
+
+ for ( LONG i = 0; i < sectionCount; i++ )
+ {
+ Manufacturers::iterator iter;
+ Manufacturer * manufacturer;
+ CString manufacturerName;
+ CString temp;
+ CStringList modelSectionNameDecl;
+ CString modelSectionName;
+ CString baseModelName;
+ CString model;
+ INFCONTEXT modelContext;
+ LONG modelCount;
+ POSITION p;
+
+ if ( i == 0 )
+ {
+ ok = SetupFindFirstLine( handle, section, NULL, &manufacturerContext );
+ err = translate_errno( ok, GetLastError(), kUnknownErr );
+ require_noerr( err, exit );
+ }
+ else
+ {
+ ok = SetupFindNextLine( &manufacturerContext, &manufacturerContext );
+ err = translate_errno( ok, GetLastError(), kUnknownErr );
+ require_noerr( err, exit );
+ }
+
+ ok = SetupGetStringField( &manufacturerContext, 0, line, sizeof( line ), NULL );
+ err = translate_errno( ok, GetLastError(), kUnknownErr );
+ require_noerr( err, exit );
+ manufacturerName = line;
+
+ ok = SetupGetLineText( &manufacturerContext, handle, NULL, NULL, line, sizeof( line ), NULL );
+ err = translate_errno( ok, GetLastError(), kUnknownErr );
+ require_noerr( err, exit );
+
+ // Try to find some model section name that has entries. Explanation of int file structure
+ // can be found at:
+ //
+ // <http://msdn.microsoft.com/en-us/library/ms794359.aspx>
+ Split( line, ',', modelSectionNameDecl );
+
+ p = modelSectionNameDecl.GetHeadPosition();
+ modelSectionName = modelSectionNameDecl.GetNext( p );
+ modelCount = SetupGetLineCount( handle, modelSectionName );
+ baseModelName = modelSectionName;
+
+ while ( modelCount <= 0 && p )
+ {
+ CString targetOSVersion;
+
+ targetOSVersion = modelSectionNameDecl.GetNext( p );
+ modelSectionName = baseModelName + TEXT( "." ) + targetOSVersion;
+ modelCount = SetupGetLineCount( handle, modelSectionName );
+ }
+
+ if ( modelCount > 0 )
+ {
+ manufacturerName = NormalizeManufacturerName( manufacturerName );
+
+ iter = manufacturers.find( manufacturerName );
+
+ if ( iter != manufacturers.end() )
+ {
+ manufacturer = iter->second;
+ require_action( manufacturer, exit, err = kUnknownErr );
+ }
+ else
+ {
+ try
+ {
+ manufacturer = new Manufacturer;
+ }
+ catch (...)
+ {
+ manufacturer = NULL;
+ }
+
+ require_action( manufacturer, exit, err = kNoMemoryErr );
+
+ manufacturer->name = manufacturerName;
+ manufacturers[ manufacturerName ] = manufacturer;
+ }
+
+ memset( &modelContext, 0, sizeof( modelContext ) );
+
+ for ( LONG j = 0; j < modelCount; j++ )
+ {
+ CString modelName;
+ Model * model;
+
+ if ( j == 0 )
+ {
+ ok = SetupFindFirstLine( handle, modelSectionName, NULL, &modelContext );
+ err = translate_errno( ok, GetLastError(), kUnknownErr );
+ require_noerr( err, exit );
+ }
+ else
+ {
+ SetupFindNextLine( &modelContext, &modelContext );
+ err = translate_errno( ok, GetLastError(), kUnknownErr );
+ require_noerr( err, exit );
+ }
+
+ ok = SetupGetStringField( &modelContext, 0, line, sizeof( line ), NULL );
+ err = translate_errno( ok, GetLastError(), kUnknownErr );
+ require_noerr( err, exit );
+
+ modelName = line;
+
+ if (checkForDuplicateModels == true)
+ {
+ if ( MatchModel( manufacturer, ConvertToModelName( modelName ) ) != NULL )
+ {
+ continue;
+ }
+ }
+
+ //
+ // Stock Vista printer inf files embed guids in the model
+ // declarations for Epson printers. Let's ignore those.
+ //
+ if ( modelName.Find( TEXT( "{" ), 0 ) != -1 )
+ {
+ continue;
+ }
+
+ try
+ {
+ model = new Model;
+ }
+ catch (...)
+ {
+ model = NULL;
+ }
+
+ require_action( model, exit, err = kNoMemoryErr );
+
+ model->infFileName = filename;
+ model->displayName = modelName;
+ model->name = modelName;
+ model->driverInstalled = false;
+
+ manufacturer->models.push_back(model);
+ }
+ }
+ }
+
+exit:
+
+ if ( handle != INVALID_HANDLE_VALUE )
+ {
+ SetupCloseInfFile( handle );
+ handle = NULL;
+ }
+
+ return err;
+}
+
+
+// -------------------------------------------------------
+// LoadPrintDriverDefs
+//
+// This function is responsible for loading the print driver
+// definitions of all print drivers that have been installed
+// on this machine.
+// -------------------------------------------------------
+OSStatus
+CThirdPage::LoadPrintDriverDefs( Manufacturers & manufacturers )
+{
+ BYTE * buffer = NULL;
+ DWORD bytesReceived = 0;
+ DWORD numPrinters = 0;
+ OSStatus err = 0;
+ BOOL ok;
+
+ //
+ // like a lot of win32 calls, we call this first to get the
+ // size of the buffer we need.
+ //
+ EnumPrinterDrivers(NULL, L"all", 6, NULL, 0, &bytesReceived, &numPrinters);
+
+ if (bytesReceived > 0)
+ {
+ try
+ {
+ buffer = new BYTE[bytesReceived];
+ }
+ catch (...)
+ {
+ buffer = NULL;
+ }
+
+ require_action( buffer, exit, err = kNoMemoryErr );
+
+ //
+ // this call gets the real info
+ //
+ ok = EnumPrinterDrivers(NULL, L"all", 6, buffer, bytesReceived, &bytesReceived, &numPrinters);
+ err = translate_errno( ok, errno_compat(), kUnknownErr );
+ require_noerr( err, exit );
+
+ DRIVER_INFO_6 * info = (DRIVER_INFO_6*) buffer;
+
+ for (DWORD i = 0; i < numPrinters; i++)
+ {
+ Manufacturer * manufacturer;
+ Model * model;
+ CString name;
+
+ //
+ // skip over anything that doesn't have a manufacturer field. This
+ // fixes a bug that I noticed that occurred after I installed
+ // ProComm. This program add a print driver with no manufacturer
+ // that screwed up this wizard.
+ //
+ if (info[i].pszMfgName == NULL)
+ {
+ continue;
+ }
+
+ //
+ // look for manufacturer
+ //
+ Manufacturers::iterator iter;
+
+ //
+ // save the name
+ //
+ name = NormalizeManufacturerName( info[i].pszMfgName );
+
+ iter = manufacturers.find(name);
+
+ if (iter != manufacturers.end())
+ {
+ manufacturer = iter->second;
+ }
+ else
+ {
+ try
+ {
+ manufacturer = new Manufacturer;
+ }
+ catch (...)
+ {
+ manufacturer = NULL;
+ }
+
+ require_action( manufacturer, exit, err = kNoMemoryErr );
+
+ manufacturer->name = name;
+
+ manufacturers[name] = manufacturer;
+ }
+
+ //
+ // now look to see if we have already seen this guy. this could
+ // happen if we have already installed printers that are described
+ // in ntprint.inf. the extant drivers will show up in EnumPrinterDrivers
+ // but we have already loaded their info
+ //
+ //
+ if ( MatchModel( manufacturer, ConvertToModelName( info[i].pName ) ) == NULL )
+ {
+ try
+ {
+ model = new Model;
+ }
+ catch (...)
+ {
+ model = NULL;
+ }
+
+ require_action( model, exit, err = kNoMemoryErr );
+
+ model->displayName = info[i].pName;
+ model->name = info[i].pName;
+ model->driverInstalled = true;
+
+ manufacturer->models.push_back(model);
+ }
+ }
+ }
+
+exit:
+
+ if (buffer != NULL)
+ {
+ delete [] buffer;
+ }
+
+ return err;
+}
+
+// -------------------------------------------------------
+// LoadGenericPrintDriverDefs
+//
+// This function is responsible for loading polymorphic
+// generic print drivers defs. The UI will read
+// something like "Generic / Postscript" and we can map
+// that to any print driver we want.
+// -------------------------------------------------------
+OSStatus
+CThirdPage::LoadGenericPrintDriverDefs( Manufacturers & manufacturers )
+{
+ Manufacturer * manufacturer;
+ Model * model;
+ Manufacturers::iterator iter;
+ CString psDriverName;
+ CString pclDriverName;
+ OSStatus err = 0;
+
+ // <rdar://problem/4030388> Generic drivers don't do color
+
+ // First try and find our generic driver names
+
+ iter = m_manufacturers.find(L"HP");
+ require_action( iter != m_manufacturers.end(), exit, err = kUnknownErr );
+ manufacturer = iter->second;
+
+ // Look for Postscript
+
+ model = manufacturer->find( kGenericPSColorDriver );
+
+ if ( !model )
+ {
+ model = manufacturer->find( kGenericPSDriver );
+ }
+
+ if ( model )
+ {
+ psDriverName = model->name;
+ }
+
+ // Look for PCL
+
+ model = manufacturer->find( kGenericPCLColorDriver );
+
+ if ( !model )
+ {
+ model = manufacturer->find( kGenericPCLDriver );
+ }
+
+ if ( model )
+ {
+ pclDriverName = model->name;
+ }
+
+ // If we found either a generic PS driver, or a generic PCL driver,
+ // then add them to the list
+
+ if ( psDriverName.GetLength() || pclDriverName.GetLength() )
+ {
+ // Try and find generic manufacturer if there is one
+
+ iter = manufacturers.find(L"Generic");
+
+ if (iter != manufacturers.end())
+ {
+ manufacturer = iter->second;
+ }
+ else
+ {
+ try
+ {
+ manufacturer = new Manufacturer;
+ }
+ catch (...)
+ {
+ manufacturer = NULL;
+ }
+
+ require_action( manufacturer, exit, err = kNoMemoryErr );
+
+ manufacturer->name = "Generic";
+ manufacturers[manufacturer->name] = manufacturer;
+ }
+
+ if ( psDriverName.GetLength() > 0 )
+ {
+ try
+ {
+ m_genericPostscript = new Model;
+ }
+ catch (...)
+ {
+ m_genericPostscript = NULL;
+ }
+
+ require_action( m_genericPostscript, exit, err = kNoMemoryErr );
+
+ m_genericPostscript->displayName = kGenericPostscript;
+ m_genericPostscript->name = psDriverName;
+ m_genericPostscript->driverInstalled = false;
+
+ manufacturer->models.push_back( m_genericPostscript );
+ }
+
+ if ( pclDriverName.GetLength() > 0 )
+ {
+ try
+ {
+ m_genericPCL = new Model;
+ }
+ catch (...)
+ {
+ m_genericPCL = NULL;
+ }
+
+ require_action( m_genericPCL, exit, err = kNoMemoryErr );
+
+ m_genericPCL->displayName = kGenericPCL;
+ m_genericPCL->name = pclDriverName;
+ m_genericPCL->driverInstalled = false;
+
+ manufacturer->models.push_back( m_genericPCL );
+ }
+ }
+
+exit:
+
+ return err;
+}
+
+// ------------------------------------------------------
+// ConvertToManufacturerName
+//
+// This function is responsible for tweaking the
+// name so that subsequent string operations won't fail because
+// of capitalizations/different names for the same manufacturer
+// (i.e. Hewlett-Packard/HP/Hewlett Packard)
+//
+CString
+CThirdPage::ConvertToManufacturerName( const CString & name )
+{
+ //
+ // first we're going to convert all the characters to lower
+ // case
+ //
+ CString lower = name;
+ lower.MakeLower();
+
+ //
+ // now we're going to check to see if the string says "hewlett-packard",
+ // because sometimes they refer to themselves as "hewlett-packard", and
+ // sometimes they refer to themselves as "hp".
+ //
+ if ( lower == L"hewlett-packard")
+ {
+ lower = "hp";
+ }
+
+ //
+ // tweak for Xerox Phaser, which doesn't announce itself
+ // as a xerox
+ //
+ else if ( lower.Find( L"phaser", 0 ) != -1 )
+ {
+ lower = "xerox";
+ }
+
+ return lower;
+}
+
+// ------------------------------------------------------
+// ConvertToModelName
+//
+// This function is responsible for ensuring that subsequent
+// string operations don't fail because of differing capitalization
+// schemes and the like
+// ------------------------------------------------------
+
+CString
+CThirdPage::ConvertToModelName( const CString & name )
+{
+ //
+ // convert it to lowercase
+ //
+ CString lower = name;
+ lower.MakeLower();
+
+ return lower;
+}
+
+// ------------------------------------------------------
+// NormalizeManufacturerName
+//
+// This function is responsible for tweaking the manufacturer
+// name so that there are no aliases for vendors
+//
+CString
+CThirdPage::NormalizeManufacturerName( const CString & name )
+{
+ CString normalized = name;
+
+ //
+ // now we're going to check to see if the string says "hewlett-packard",
+ // because sometimes they refer to themselves as "hewlett-packard", and
+ // sometimes they refer to themselves as "hp".
+ //
+ if ( normalized == L"Hewlett-Packard")
+ {
+ normalized = "HP";
+ }
+
+ return normalized;
+}
+
+// -------------------------------------------------------
+// MatchPrinter
+//
+// This function is responsible for matching a printer
+// to a list of manufacturers and models. It calls
+// MatchManufacturer and MatchModel in turn.
+//
+
+OSStatus CThirdPage::MatchPrinter(Manufacturers & manufacturers, Printer * printer, Service * service, bool useCUPSWorkaround)
+{
+ CString normalizedProductName;
+ Manufacturer * manufacturer = NULL;
+ Manufacturer * genericManufacturer = NULL;
+ Model * model = NULL;
+ Model * genericModel = NULL;
+ bool found = false;
+ CString text;
+ OSStatus err = kNoErr;
+
+ check( printer );
+ check( service );
+
+ Queue * q = service->SelectedQueue();
+
+ check( q );
+
+ //
+ // first look to see if we have a usb_MFG descriptor
+ //
+ if ( q->usb_MFG.GetLength() > 0)
+ {
+ manufacturer = MatchManufacturer( manufacturers, ConvertToManufacturerName ( q->usb_MFG ) );
+ }
+
+ if ( manufacturer == NULL )
+ {
+ q->product.Remove('(');
+ q->product.Remove(')');
+
+ manufacturer = MatchManufacturer( manufacturers, ConvertToManufacturerName ( q->product ) );
+ }
+
+ //
+ // if we found the manufacturer, then start looking for the model
+ //
+ if ( manufacturer != NULL )
+ {
+ if ( q->usb_MDL.GetLength() > 0 )
+ {
+ model = MatchModel ( manufacturer, ConvertToModelName ( q->usb_MDL ) );
+ }
+
+ if ( ( model == NULL ) && ( q->product.GetLength() > 0 ) )
+ {
+ q->product.Remove('(');
+ q->product.Remove(')');
+
+ model = MatchModel ( manufacturer, ConvertToModelName ( q->product ) );
+ }
+
+ if ( model != NULL )
+ {
+ // <rdar://problem/4124524> Offer Generic printers if printer advertises Postscript or PCL. Workaround
+ // bug in OS X CUPS printer sharing by selecting Generic driver instead of matched printer.
+
+ bool hasGenericDriver = false;
+
+ if ( MatchGeneric( manufacturers, printer, service, &genericManufacturer, &genericModel ) )
+ {
+ hasGenericDriver = true;
+ }
+
+ // <rdar://problem/4190104> Use "application/octet-stream" to determine if CUPS
+ // shared queue supports raw
+
+ if ( q->pdl.Find( L"application/octet-stream" ) != -1 )
+ {
+ useCUPSWorkaround = false;
+ }
+
+ if ( useCUPSWorkaround && printer->isCUPSPrinter && hasGenericDriver )
+ {
+ //
+ // <rdar://problem/4496652> mDNS: Don't allow user to choose non-working driver
+ //
+ Manufacturers genericManufacturers;
+
+ LoadGenericPrintDriverDefs( genericManufacturers );
+
+ SelectMatch( genericManufacturers, printer, service, genericManufacturer, genericModel );
+
+ FreeManufacturers( genericManufacturers );
+ }
+ else
+ {
+ SelectMatch(manufacturers, printer, service, manufacturer, model);
+ }
+
+ found = true;
+ }
+ }
+
+ //
+ // display a message to the user based on whether we could match
+ // this printer
+ //
+ if (found)
+ {
+ text.LoadString(IDS_PRINTER_MATCH_GOOD);
+ err = kNoErr;
+ }
+ else if ( MatchGeneric( manufacturers, printer, service, &genericManufacturer, &genericModel ) )
+ {
+ if ( printer->isCUPSPrinter )
+ {
+ //
+ // <rdar://problem/4496652> mDNS: Don't allow user to choose non-working driver
+ //
+ Manufacturers genericManufacturers;
+
+ LoadGenericPrintDriverDefs( genericManufacturers );
+
+ SelectMatch( genericManufacturers, printer, service, genericManufacturer, genericModel );
+
+ text.LoadString(IDS_PRINTER_MATCH_GOOD);
+
+ FreeManufacturers( genericManufacturers );
+ }
+ else
+ {
+ SelectMatch( manufacturers, printer, service, genericManufacturer, genericModel );
+ text.LoadString(IDS_PRINTER_MATCH_MAYBE);
+ }
+
+ err = kNoErr;
+ }
+ else
+ {
+ text.LoadString(IDS_PRINTER_MATCH_BAD);
+
+ //
+ // if there was any crud in this list from before, get rid of it now
+ //
+ m_modelListCtrl.DeleteAllItems();
+
+ //
+ // select the manufacturer if we found one
+ //
+ if (manufacturer != NULL)
+ {
+ LVFINDINFO info;
+ int nIndex;
+
+ //
+ // select the manufacturer
+ //
+ info.flags = LVFI_STRING;
+ info.psz = manufacturer->name;
+
+ nIndex = m_manufacturerListCtrl.FindItem(&info);
+
+ if (nIndex != -1)
+ {
+ m_manufacturerListCtrl.SetItemState(nIndex, LVIS_SELECTED, LVIS_SELECTED);
+
+ //
+ //<rdar://problem/4528853> mDNS: When auto-highlighting items in lists, scroll list so highlighted item is in the middle
+ //
+ AutoScroll(m_manufacturerListCtrl, nIndex);
+ }
+ }
+
+ err = kUnknownErr;
+ }
+
+ m_printerSelectionText.SetWindowText(text);
+
+ return err;
+}
+
+// ------------------------------------------------------
+// MatchManufacturer
+//
+// This function is responsible for finding a manufacturer
+// object from a string name. It does a CString::Find, which
+// is like strstr, so it doesn't have to do an exact match
+//
+// If it can't find a match, NULL is returned
+// ------------------------------------------------------
+
+Manufacturer*
+CThirdPage::MatchManufacturer( Manufacturers & manufacturers, const CString & name)
+{
+ Manufacturers::iterator iter;
+
+ for (iter = manufacturers.begin(); iter != manufacturers.end(); iter++)
+ {
+ //
+ // we're going to convert all the manufacturer names to lower case,
+ // so we match the name passed in.
+ //
+ CString lower = iter->second->name;
+ lower.MakeLower();
+
+ //
+ // now try and find the lowered string in the name passed in.
+ //
+ if (name.Find(lower) != -1)
+ {
+ return iter->second;
+ }
+ }
+
+ return NULL;
+}
+
+// -------------------------------------------------------
+// MatchModel
+//
+// This function is responsible for matching a model from
+// a name. It does a CString::Find(), which works like strstr,
+// so it doesn't rely on doing an exact string match.
+//
+
+Model*
+CThirdPage::MatchModel(Manufacturer * manufacturer, const CString & name)
+{
+ Models::iterator iter;
+
+ iter = manufacturer->models.begin();
+
+ for (iter = manufacturer->models.begin(); iter != manufacturer->models.end(); iter++)
+ {
+ Model * model = *iter;
+
+ //
+ // convert the model name to lower case
+ //
+ CString lowered = model->name;
+ lowered.MakeLower();
+
+ if (lowered.Find( name ) != -1)
+ {
+ return model;
+ }
+
+ //
+ // <rdar://problem/3841218>
+ // try removing the first substring and search again
+ //
+
+ if ( name.Find(' ') != -1 )
+ {
+ CString altered = name;
+ altered.Delete( 0, altered.Find(' ') + 1 );
+
+ if ( lowered.Find( altered ) != -1 )
+ {
+ return model;
+ }
+ }
+ }
+
+ return NULL;
+}
+
+// -------------------------------------------------------
+// MatchGeneric
+//
+// This function will attempt to find a generic printer
+// driver for a printer that we weren't able to match
+// specifically
+//
+BOOL
+CThirdPage::MatchGeneric( Manufacturers & manufacturers, Printer * printer, Service * service, Manufacturer ** manufacturer, Model ** model )
+{
+ CString pdl;
+ BOOL ok = FALSE;
+
+ DEBUG_UNUSED( printer );
+
+ check( service );
+
+ Queue * q = service->SelectedQueue();
+
+ check( q );
+
+ Manufacturers::iterator iter = manufacturers.find( kGenericManufacturer );
+ require_action_quiet( iter != manufacturers.end(), exit, ok = FALSE );
+
+ *manufacturer = iter->second;
+
+ pdl = q->pdl;
+ pdl.MakeLower();
+
+ if ( m_genericPCL && ( pdl.Find( kPDLPCLKey ) != -1 ) )
+ {
+ *model = m_genericPCL;
+ ok = TRUE;
+ }
+ else if ( m_genericPostscript && ( pdl.Find( kPDLPostscriptKey ) != -1 ) )
+ {
+ *model = m_genericPostscript;
+ ok = TRUE;
+ }
+
+exit:
+
+ return ok;
+}
+
+// -----------------------------------------------------------
+// OnInitPage
+//
+// This function is responsible for doing initialization that
+// only occurs once during a run of the wizard
+//
+
+OSStatus CThirdPage::OnInitPage()
+{
+ CString header;
+ CString ntPrint;
+ OSStatus err = kNoErr;
+
+ // Load printer icon
+ check( m_printerImage == NULL );
+
+ m_printerImage = (CStatic*) GetDlgItem( 1 ); // 1 == IDR_MANIFEST
+ check( m_printerImage );
+
+ if ( m_printerImage != NULL )
+ {
+ m_printerImage->SetIcon( LoadIcon( GetNonLocalizedResources(), MAKEINTRESOURCE( IDI_PRINTER ) ) );
+ }
+
+ //
+ // The CTreeCtrl widget automatically sends a selection changed
+ // message which initially we want to ignore, because the user
+ // hasn't selected anything
+ //
+ // this flag gets reset in the message handler. Every subsequent
+ // message gets handled.
+ //
+
+ //
+ // we have to make sure that we only do this once. Typically,
+ // we would do this in something like OnInitDialog, but we don't
+ // have this in Wizards, because the window is a PropertySheet.
+ // We're considered fully initialized when we receive the first
+ // selection notice
+ //
+ header.LoadString(IDS_MANUFACTURER_HEADING);
+ m_manufacturerListCtrl.InsertColumn(0, header, LVCFMT_LEFT, -1 );
+ m_manufacturerSelected = NULL;
+
+ header.LoadString(IDS_MODEL_HEADING);
+ m_modelListCtrl.InsertColumn(0, header, LVCFMT_LEFT, -1 );
+ m_modelSelected = NULL;
+
+ return (err);
+}
+
+void CThirdPage::DoDataExchange(CDataExchange* pDX)
+{
+ CPropertyPage::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_PRINTER_MANUFACTURER, m_manufacturerListCtrl);
+ DDX_Control(pDX, IDC_PRINTER_MODEL, m_modelListCtrl);
+ DDX_Control(pDX, IDC_PRINTER_NAME, m_printerName);
+ DDX_Control(pDX, IDC_DEFAULT_PRINTER, m_defaultPrinterCtrl);
+ DDX_Control(pDX, IDC_PRINTER_SELECTION_TEXT, m_printerSelectionText);
+
+}
+
+// ----------------------------------------------------------
+// OnSetActive
+//
+// This function is called by MFC after the window has been
+// activated.
+//
+
+BOOL
+CThirdPage::OnSetActive()
+{
+ CPrinterSetupWizardSheet * psheet;
+ Printer * printer;
+ Service * service;
+
+ psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent());
+ require_quiet( psheet, exit );
+
+ psheet->SetWizardButtons( PSWIZB_BACK );
+
+ printer = psheet->GetSelectedPrinter();
+ require_quiet( printer, exit );
+
+ service = printer->services.front();
+ require_quiet( service, exit );
+
+ //
+ // call OnInitPage once
+ //
+ if (!m_initialized)
+ {
+ OnInitPage();
+ m_initialized = true;
+ }
+
+ //
+ // <rdar://problem/4580061> mDNS: Printers added using Bonjour should be set as the default printer.
+ //
+ if ( DefaultPrinterExists() )
+ {
+ m_defaultPrinterCtrl.SetCheck( BST_UNCHECKED );
+ printer->deflt = false;
+ }
+ else
+ {
+ m_defaultPrinterCtrl.SetCheck( BST_CHECKED );
+ printer->deflt = true;
+ }
+
+ //
+ // update the UI with the printer name
+ //
+ m_printerName.SetWindowText(printer->displayName);
+
+ //
+ // populate the list controls with the manufacturers and models
+ // from ntprint.inf
+ //
+ PopulateUI( m_manufacturers );
+
+ //
+ // and try and match the printer
+ //
+
+ if ( psheet->GetLastPage() == psheet->GetPage(0) )
+ {
+ MatchPrinter( m_manufacturers, printer, service, true );
+
+ if ( ( m_manufacturerSelected != NULL ) && ( m_modelSelected != NULL ) )
+ {
+ GetParent()->PostMessage(PSM_SETCURSEL, 2 );
+ }
+ }
+ else
+ {
+ SelectMatch(printer, service, m_manufacturerSelected, m_modelSelected);
+ }
+
+exit:
+
+ return CPropertyPage::OnSetActive();
+}
+
+BOOL
+CThirdPage::OnKillActive()
+{
+ CPrinterSetupWizardSheet * psheet;
+
+ psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent());
+ require_quiet( psheet, exit );
+
+ psheet->SetLastPage(this);
+
+exit:
+
+ return CPropertyPage::OnKillActive();
+}
+
+// -------------------------------------------------------
+// PopulateUI
+//
+// This function is called to populate the list of manufacturers
+//
+OSStatus
+CThirdPage::PopulateUI(Manufacturers & manufacturers)
+{
+ Manufacturers::iterator iter;
+
+ m_manufacturerListCtrl.DeleteAllItems();
+
+ for (iter = manufacturers.begin(); iter != manufacturers.end(); iter++)
+ {
+ int nIndex;
+
+ Manufacturer * manufacturer = iter->second;
+
+ nIndex = m_manufacturerListCtrl.InsertItem(0, manufacturer->name);
+
+ m_manufacturerListCtrl.SetItemData(nIndex, (DWORD_PTR) manufacturer);
+
+ m_manufacturerListCtrl.SetColumnWidth( 0, LVSCW_AUTOSIZE_USEHEADER );
+ }
+
+ return 0;
+}
+
+BEGIN_MESSAGE_MAP(CThirdPage, CPropertyPage)
+ ON_NOTIFY(LVN_ITEMCHANGED, IDC_PRINTER_MANUFACTURER, OnLvnItemchangedManufacturer)
+ ON_NOTIFY(LVN_ITEMCHANGED, IDC_PRINTER_MODEL, OnLvnItemchangedPrinterModel)
+ ON_BN_CLICKED(IDC_DEFAULT_PRINTER, OnBnClickedDefaultPrinter)
+ ON_BN_CLICKED(IDC_HAVE_DISK, OnBnClickedHaveDisk)
+END_MESSAGE_MAP()
+
+// CThirdPage message handlers
+void CThirdPage::OnLvnItemchangedManufacturer(NMHDR *pNMHDR, LRESULT *pResult)
+{
+ LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
+
+ POSITION p = m_manufacturerListCtrl.GetFirstSelectedItemPosition();
+ int nSelected = m_manufacturerListCtrl.GetNextSelectedItem(p);
+
+ if (nSelected != -1)
+ {
+ m_manufacturerSelected = (Manufacturer*) m_manufacturerListCtrl.GetItemData(nSelected);
+
+ m_modelListCtrl.SetRedraw(FALSE);
+
+ m_modelListCtrl.DeleteAllItems();
+ m_modelSelected = NULL;
+
+ Models::iterator iter;
+
+ for (iter = m_manufacturerSelected->models.begin(); iter != m_manufacturerSelected->models.end(); iter++)
+ {
+ Model * model = *iter;
+
+ int nItem = m_modelListCtrl.InsertItem( 0, model->displayName );
+
+ m_modelListCtrl.SetItemData(nItem, (DWORD_PTR) model);
+
+ m_modelListCtrl.SetColumnWidth( 0, LVSCW_AUTOSIZE_USEHEADER );
+ }
+
+ m_modelListCtrl.SetRedraw(TRUE);
+ }
+
+ *pResult = 0;
+}
+
+void CThirdPage::OnLvnItemchangedPrinterModel(NMHDR *pNMHDR, LRESULT *pResult)
+{
+ LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
+
+ CPrinterSetupWizardSheet * psheet;
+ Printer * printer;
+ Service * service;
+
+ psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent());
+ require_quiet( psheet, exit );
+
+ printer = psheet->GetSelectedPrinter();
+ require_quiet( printer, exit );
+
+ service = printer->services.front();
+ require_quiet( service, exit );
+
+ check ( m_manufacturerSelected );
+
+ POSITION p = m_modelListCtrl.GetFirstSelectedItemPosition();
+ int nSelected = m_modelListCtrl.GetNextSelectedItem(p);
+
+ if (nSelected != -1)
+ {
+ m_modelSelected = (Model*) m_modelListCtrl.GetItemData(nSelected);
+
+ CopyPrinterSettings( printer, service, m_manufacturerSelected, m_modelSelected );
+
+ psheet->SetWizardButtons(PSWIZB_BACK|PSWIZB_NEXT);
+ }
+ else
+ {
+ psheet->SetWizardButtons(PSWIZB_BACK);
+ }
+
+exit:
+
+ *pResult = 0;
+}
+
+void CThirdPage::OnBnClickedDefaultPrinter()
+{
+ CPrinterSetupWizardSheet * psheet;
+ Printer * printer;
+
+ psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent());
+ require_quiet( psheet, exit );
+
+ printer = psheet->GetSelectedPrinter();
+ require_quiet( printer, exit );
+
+ printer->deflt = ( m_defaultPrinterCtrl.GetCheck() == BST_CHECKED ) ? true : false;
+
+exit:
+
+ return;
+}
+
+void CThirdPage::OnBnClickedHaveDisk()
+{
+ CPrinterSetupWizardSheet * psheet;
+ Printer * printer;
+ Service * service;
+ Manufacturers manufacturers;
+
+ CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY|OFN_FILEMUSTEXIST, L"Setup Information (*.inf)|*.inf||", this);
+
+ psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent());
+ require_quiet( psheet, exit );
+
+ printer = psheet->GetSelectedPrinter();
+ require_quiet( printer, exit );
+
+ service = printer->services.front();
+ require_quiet( service, exit );
+
+ for ( ;; )
+ {
+ if ( dlg.DoModal() == IDOK )
+ {
+ CString filename = dlg.GetPathName();
+
+ LoadPrintDriverDefsFromFile( manufacturers, filename, true );
+
+ // Sanity check
+
+ if ( manufacturers.size() > 0 )
+ {
+ PopulateUI( manufacturers );
+
+ if ( MatchPrinter( manufacturers, printer, service, false ) != kNoErr )
+ {
+ CString errorMessage;
+ CString errorCaption;
+
+ errorMessage.LoadString( IDS_NO_MATCH_INF_FILE );
+ errorCaption.LoadString( IDS_NO_MATCH_INF_FILE_CAPTION );
+
+ MessageBox( errorMessage, errorCaption, MB_OK );
+ }
+
+ break;
+ }
+ else
+ {
+ CString errorMessage;
+ CString errorCaption;
+
+ errorMessage.LoadString( IDS_BAD_INF_FILE );
+ errorCaption.LoadString( IDS_BAD_INF_FILE_CAPTION );
+
+ MessageBox( errorMessage, errorCaption, MB_OK );
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+
+exit:
+
+ FreeManufacturers( manufacturers );
+ return;
+}
+
+
+void
+CThirdPage::Split( const CString & string, TCHAR ch, CStringList & components )
+{
+ CString temp;
+ int n;
+
+ temp = string;
+
+ while ( ( n = temp.Find( ch ) ) != -1 )
+ {
+ components.AddTail( temp.Left( n ) );
+ temp = temp.Right( temp.GetLength() - ( n + 1 ) );
+ }
+
+ components.AddTail( temp );
+}
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/ThirdPage.h b/mDNSResponder/Clients/PrinterSetupWizard/ThirdPage.h
new file mode 100644
index 00000000..476e2337
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/ThirdPage.h
@@ -0,0 +1,159 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+#include "afxcmn.h"
+#include "UtilTypes.h"
+#include <CommonServices.h>
+#include <DebugServices.h>
+#include <dns_sd.h>
+#include <map>
+#include "afxwin.h"
+
+
+// CThirdPage dialog
+
+class CThirdPage : public CPropertyPage
+{
+DECLARE_DYNAMIC(CThirdPage)
+
+public:
+CThirdPage();
+virtual ~CThirdPage();
+
+// Dialog Data
+enum { IDD = IDD_THIRD_PAGE };
+
+protected:
+virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+virtual BOOL OnSetActive();
+virtual BOOL OnKillActive();
+
+DECLARE_MESSAGE_MAP()
+
+private:
+
+//
+//<rdar://problem/4189721> mDNS: Epson shows up twice in the list. Use case insensitive compare
+//
+struct compare_func
+{
+ bool operator()( const CString & s1, const CString & s2 ) const
+ {
+ return s1.CompareNoCase( s2 ) < 0;
+ }
+};
+
+typedef std::map<CString, Manufacturer*, compare_func> Manufacturers;
+
+//
+// LoadPrintDriverDefsFromFile
+//
+// Parses INF file and populates manufacturers
+//
+OSStatus LoadPrintDriverDefsFromFile(Manufacturers & manufacturers, const CString & filename, bool checkForDuplicateModels );
+
+//
+// LoadPrintDriverDefs
+//
+// Loads extant print driver definitions
+//
+OSStatus LoadPrintDriverDefs(Manufacturers & manufacturers);
+
+//
+// LoadGenericPrintDriversDefs
+//
+// Loads generic postscript and pcl print driver defs
+//
+OSStatus LoadGenericPrintDriverDefs( Manufacturers & manufacturers );
+
+//
+// PopulateUI
+//
+// Load print driver defs into UI for browsing/selection
+//
+OSStatus PopulateUI(Manufacturers & manufacturers);
+
+//
+// MatchPrinter
+//
+// Tries to match printer based on manufacturer and model
+//
+OSStatus MatchPrinter(Manufacturers & manufacturers, Printer * printer, Service * service, bool useCUPSWorkaround);
+
+//
+// OnInitPage
+//
+// Called first time page is activated.
+OSStatus OnInitPage();
+
+//
+// these functions will tweak the names so that everything is
+// consistent
+//
+CString ConvertToManufacturerName( const CString & name );
+CString ConvertToModelName( const CString & name );
+CString NormalizeManufacturerName( const CString & name );
+
+Manufacturer * MatchManufacturer( Manufacturers & manufacturer, const CString & name );
+Model * MatchModel( Manufacturer * manufacturer, const CString & name );
+BOOL MatchGeneric( Manufacturers & manufacturers, Printer * printer, Service * service, Manufacturer ** manufacturer, Model ** model );
+void SelectMatch(Printer * printer, Service * service, Manufacturer * manufacturer, Model * model);
+void SelectMatch(Manufacturers & manufacturers, Printer * printer, Service * service, Manufacturer * manufacturer, Model * model);
+void CopyPrinterSettings(Printer * printer, Service * service, Manufacturer * manufacturer, Model * model);
+//
+// <rdar://problem/4580061> mDNS: Printers added using Bonjour should be set as the default printer.
+//
+BOOL DefaultPrinterExists();
+//
+//<rdar://problem/4528853> mDNS: When auto-highlighting items in lists, scroll list so highlighted item is in the middle
+//
+void AutoScroll(CListCtrl & list, int nIndex);
+
+void FreeManufacturers( Manufacturers & manufacturers );
+
+Manufacturers m_manufacturers;
+
+CListCtrl m_manufacturerListCtrl;
+Manufacturer * m_manufacturerSelected;
+
+CListCtrl m_modelListCtrl;
+Model * m_modelSelected;
+
+Model * m_genericPostscript;
+Model * m_genericPCL;
+
+bool m_initialized;
+
+public:
+
+afx_msg void OnLvnItemchangedManufacturer(NMHDR *pNMHDR, LRESULT *pResult);
+CStatic m_printerName;
+afx_msg void OnLvnItemchangedPrinterModel(NMHDR *pNMHDR, LRESULT *pResult);
+afx_msg void OnBnClickedDefaultPrinter();
+private:
+
+void
+Split( const CString & string, TCHAR ch, CStringList & components );
+
+CButton m_defaultPrinterCtrl;
+
+public:
+CStatic m_printerSelectionText;
+CStatic * m_printerImage;
+afx_msg void OnBnClickedHaveDisk();
+};
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/UtilTypes.h b/mDNSResponder/Clients/PrinterSetupWizard/UtilTypes.h
new file mode 100644
index 00000000..dc0ae10e
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/UtilTypes.h
@@ -0,0 +1,280 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <dns_sd.h>
+#include <string>
+#include <list>
+#include <DebugServices.h>
+
+class CPrinterSetupWizardSheet;
+
+#define kDefaultPriority 50
+#define kDefaultQTotal 1
+
+namespace PrinterSetupWizard
+{
+struct Printer;
+struct Service;
+struct Queue;
+struct Manufacturer;
+struct Model;
+
+typedef std::list<Queue*> Queues;
+typedef std::list<Printer*> Printers;
+typedef std::list<Service*> Services;
+typedef std::list<Model*> Models;
+
+struct Printer
+{
+ Printer();
+
+ ~Printer();
+
+ Service*
+ LookupService
+ (
+ const std::string & type
+ );
+
+ CPrinterSetupWizardSheet * window;
+ HTREEITEM item;
+
+ //
+ // These are from the browse reply
+ //
+ std::string name;
+ CString displayName;
+ CString actualName;
+
+ //
+ // These keep track of the different services associated with this printer.
+ // the services are ordered according to preference.
+ //
+ Services services;
+
+ //
+ // these are derived from the printer matching code
+ //
+ // if driverInstalled is false, then infFileName should
+ // have an absolute path to the printers inf file. this
+ // is used to install the printer from printui.dll
+ //
+ // if driverInstalled is true, then model is the name
+ // of the driver to use in AddPrinter
+ //
+ bool driverInstalled;
+ CString infFileName;
+ CString manufacturer;
+ CString displayModelName;
+ CString modelName;
+ CString portName;
+ bool deflt;
+
+ // This let's us know that this printer was discovered via OSX Printer Sharing.
+ // We use this knowledge to workaround a problem with OS X Printer sharing.
+
+ bool isCUPSPrinter;
+
+ //
+ // state
+ //
+ unsigned resolving;
+ bool installed;
+};
+
+
+struct Service
+{
+ Service();
+
+ ~Service();
+
+ Queue*
+ SelectedQueue();
+
+ void
+ EmptyQueues();
+
+ Printer * printer;
+ uint32_t ifi;
+ std::string type;
+ std::string domain;
+
+ //
+ // these are from the resolve
+ //
+ DNSServiceRef serviceRef;
+ CString hostname;
+ unsigned short portNumber;
+ CString protocol;
+ unsigned short qtotal;
+
+ //
+ // There will usually one be one of these, however
+ // this will handle printers that have multiple
+ // queues. These are ordered according to preference.
+ //
+ Queues queues;
+
+ //
+ // Reference count
+ //
+ unsigned refs;
+};
+
+
+struct Queue
+{
+ Queue();
+
+ ~Queue();
+
+ CString name;
+ uint32_t priority;
+ CString pdl;
+ CString usb_MFG;
+ CString usb_MDL;
+ CString description;
+ CString location;
+ CString product;
+};
+
+
+struct Manufacturer
+{
+ CString name;
+ Models models;
+
+ Model*
+ find( const CString & name );
+};
+
+
+struct Model
+{
+ bool driverInstalled;
+ CString infFileName;
+ CString displayName;
+ CString name;
+};
+
+
+inline
+Printer::Printer()
+ :
+ isCUPSPrinter( false )
+{
+}
+
+inline
+Printer::~Printer()
+{
+ while ( services.size() > 0 )
+ {
+ Service * service = services.front();
+ services.pop_front();
+ delete service;
+ }
+}
+
+inline Service*
+Printer::LookupService
+(
+ const std::string & type
+)
+{
+ Services::iterator it;
+
+ for ( it = services.begin(); it != services.end(); it++ )
+ {
+ Service * service = *it;
+
+ if ( strcmp(service->type.c_str(), type.c_str()) == 0 )
+ {
+ return service;
+ }
+ }
+
+ return NULL;
+}
+
+inline
+Service::Service()
+ :
+ qtotal(kDefaultQTotal)
+{
+}
+
+inline
+Service::~Service()
+{
+ check( serviceRef == NULL );
+
+ EmptyQueues();
+}
+
+inline Queue*
+Service::SelectedQueue()
+{
+ return queues.front();
+}
+
+inline void
+Service::EmptyQueues()
+{
+ while ( queues.size() > 0 )
+ {
+ Queue * q = queues.front();
+ queues.pop_front();
+ delete q;
+ }
+}
+
+inline
+Queue::Queue()
+ :
+ priority(kDefaultPriority)
+{
+}
+
+inline
+Queue::~Queue()
+{
+}
+
+inline Model*
+Manufacturer::find( const CString & name )
+{
+ Models::iterator it;
+
+ for ( it = models.begin(); it != models.end(); it++ )
+ {
+ Model * model = *it;
+
+ if ( model->name == name )
+ {
+ return model;
+ }
+ }
+
+ return NULL;
+}
+}
+
+
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/res/Info.ico b/mDNSResponder/Clients/PrinterSetupWizard/res/Info.ico
new file mode 100644
index 00000000..1a532189
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/res/Info.ico
Binary files differ
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/res/NetworkPrinter.ico b/mDNSResponder/Clients/PrinterSetupWizard/res/NetworkPrinter.ico
new file mode 100644
index 00000000..d2926def
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/res/NetworkPrinter.ico
Binary files differ
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/res/Print.ico b/mDNSResponder/Clients/PrinterSetupWizard/res/Print.ico
new file mode 100644
index 00000000..b737f473
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/res/Print.ico
Binary files differ
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizard.ico b/mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizard.ico
new file mode 100644
index 00000000..22130b3d
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizard.ico
Binary files differ
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizard.manifest b/mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizard.manifest
new file mode 100644
index 00000000..a72bccad
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizard.manifest
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="Apple.Bonjour.PrinterSetupWizard" type="win32"/>
+ <description>Printer Setup Wizard</description>
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+ <security>
+ <requestedPrivileges>
+ <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
+ <dependency>
+ <dependentAssembly>
+ <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"/>
+ </dependentAssembly>
+ </dependency>
+</assembly>
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizard.rc2 b/mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizard.rc2
new file mode 100644
index 00000000..27e049a6
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizard.rc2
@@ -0,0 +1,13 @@
+//
+// Wiz97_3.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+#error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizard64.manifest b/mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizard64.manifest
new file mode 100644
index 00000000..f535d80c
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizard64.manifest
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <assemblyIdentity version="1.0.0.0" processorArchitecture="amd64" name="Apple.Bonjour.PrinterSetupWizard" type="win32"/>
+ <description>Printer Setup Wizard</description>
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+ <security>
+ <requestedPrivileges>
+ <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
+ <dependency>
+ <dependentAssembly>
+ <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="amd64" publicKeyToken="6595b64144ccf1df" language="*"/>
+ </dependentAssembly>
+ </dependency>
+</assembly>
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizardLocRes.rc2 b/mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizardLocRes.rc2
new file mode 100755
index 00000000..27e049a6
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizardLocRes.rc2
@@ -0,0 +1,13 @@
+//
+// Wiz97_3.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+#error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizardRes.rc2 b/mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizardRes.rc2
new file mode 100755
index 00000000..27e049a6
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/res/PrinterSetupWizardRes.rc2
@@ -0,0 +1,13 @@
+//
+// Wiz97_3.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+#error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/res/Thumbs.db b/mDNSResponder/Clients/PrinterSetupWizard/res/Thumbs.db
new file mode 100644
index 00000000..f9f63303
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/res/Thumbs.db
Binary files differ
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/res/about.bmp b/mDNSResponder/Clients/PrinterSetupWizard/res/about.bmp
new file mode 100644
index 00000000..83e0bb08
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/res/about.bmp
Binary files differ
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/res/banner_icon.bmp b/mDNSResponder/Clients/PrinterSetupWizard/res/banner_icon.bmp
new file mode 100644
index 00000000..8e62c35c
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/res/banner_icon.bmp
Binary files differ
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/res/watermark.bmp b/mDNSResponder/Clients/PrinterSetupWizard/res/watermark.bmp
new file mode 100644
index 00000000..e76046b6
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/res/watermark.bmp
Binary files differ
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/resource.h b/mDNSResponder/Clients/PrinterSetupWizard/resource.h
new file mode 100644
index 00000000..b1190fb9
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/resource.h
@@ -0,0 +1,29 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+// Include resources for Wizard app
+
+#include "resource_exe.h"
+
+// Include resources for non-localizable resource DLL
+
+#include "resource_res.h"
+
+// Include resources for localizable resource DLL
+
+#include "resource_loc_res.h"
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/resource_exe.h b/mDNSResponder/Clients/PrinterSetupWizard/resource_exe.h
new file mode 100755
index 00000000..33c0c288
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/resource_exe.h
@@ -0,0 +1,94 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by PrinterSetupWizard.rc
+//
+#define IDM_ABOUTBOX 0x0010
+#define IDD_ABOUTBOX 100
+#define IDS_ABOUTBOX 101
+#define IDD_PRINTERSETUPWIZARD_DIALOG 102
+#define IDS_GOODBYE 102
+#define IDS_GREETING 103
+#define IDS_BROWSE_TITLE 104
+#define IDS_BROWSE_SUBTITLE 105
+#define IDS_CAPTION 106
+#define IDD_FIRST_PAGE 107
+#define IDS_GOODBYE_GOOD1 107
+#define IDS_SEARCHING 108
+#define IDD_SECOND_PAGE 109
+#define IDS_GOODBYTE_GOOD2 109
+#define IDS_INSTALL_TITLE 110
+#define IDS_INSTALL_SUBTITLE 111
+#define IDS_ERROR_SELECTING_PRINTER_TEXT 112
+#define IDS_ERROR_SELECTING_PRINTER_CAPTION 113
+#define IDS_INSTALL_ERROR_CAPTION 114
+#define IDS_INSTALL_ERROR_MESSAGE 115
+#define IDS_MANUFACTURER_HEADING 116
+#define IDS_MODEL_HEADING 117
+#define IDS_NO_PRINTERS 118
+#define IDS_NO_MDNSRESPONDER_SERVICE_TEXT 119
+#define IDS_NO_MDNSRESPONDER_SERVICE_CAPTION 120
+#define IDS_PRINTER_MATCH_GOOD 121
+#define IDS_PRINTER_MATCH_BAD 122
+#define IDS_YES 123
+#define IDS_NO 124
+#define IDS_LARGE_FONT 125
+#define IDS_FIREWALL 126
+#define IDS_ERROR_CAPTION 127
+#define IDR_MAINFRAME 128
+#define IDS_FIREWALL_CAPTION 128
+#define IDB_BANNER_ICON 129
+#define IDD_THIRD_PAGE 130
+#define IDB_WATERMARK 131
+#define IDD_FOURTH_PAGE 132
+#define IDI_INFO 136
+#define IDB_ABOUT 138
+#define IDD_DIALOG1 139
+#define IDI_ICON2 141
+#define IDI_PRINTER 141
+#define IDS_REINSTALL 142
+#define IDS_REINSTALL_CAPTION 143
+#define IDC_INFO 144
+#define IDS_PRINTER_UNAVAILABLE 145
+#define IDS_BAD_INF_FILE 150
+#define IDS_BAD_INF_FILE_CAPTION 151
+#define IDS_NO_MATCH_INF_FILE 152
+#define IDS_NO_MATCH_INF_FILE_CAPTION 153
+#define IDC_BUTTON1 1000
+#define IDC_LIST1 1000
+#define IDC_BROWSE_LIST 1000
+#define IDC_RADIO1 1001
+#define IDC_COMBO1 1001
+#define IDC_RADIO2 1002
+#define IDC_GREETING 1003
+#define IDC_CHECK1 1016
+#define IDC_DEFAULT_PRINTER 1016
+#define IDC_PRINTER_IMAGE 1017
+#define IDC_PRINTER_NAME 1018
+#define IDC_PRINTER_MANUFACTURER 1019
+#define IDC_PRINTER_MODEL 1020
+#define IDC_GOODBYE 1021
+#define IDC_PRINTER_PORT 1022
+#define IDC_PRINTER_PROTOCOL 1022
+#define IDC_PRINTER_DEFAULT 1023
+#define IDC_PRINTER_SELECTION_TEXT 1024
+#define IDC_HAVE_DISK 1025
+#define IDC_PRINTER_INFORMATION 1026
+#define IDC_LOCATION_LABEL 1029
+#define IDC_DESCRIPTION_FIELD 1030
+#define IDC_LOCATION_FIELD 1032
+#define IDC_DESCRIPTION_LABEL 1033
+#define IDC_COMPLETE1 1034
+#define IDC_COMPLETE2 1035
+#define IDC_INSTALLING 1036
+#define IDC_PROGRESS 1037
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 142
+#define _APS_NEXT_COMMAND_VALUE 32771
+#define _APS_NEXT_CONTROL_VALUE 1034
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/resource_loc_res.h b/mDNSResponder/Clients/PrinterSetupWizard/resource_loc_res.h
new file mode 100755
index 00000000..deb2e6e6
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/resource_loc_res.h
@@ -0,0 +1,95 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by PrinterSetupWizardLocRes.rc
+//
+#define IDM_ABOUTBOX 0x0010
+#define IDD_ABOUTBOX 100
+#define IDS_ABOUTBOX 101
+#define IDD_PRINTERSETUPWIZARD_DIALOG 102
+#define IDS_GOODBYE 102
+#define IDS_GREETING 103
+#define IDS_BROWSE_TITLE 104
+#define IDS_BROWSE_SUBTITLE 105
+#define IDS_CAPTION 106
+#define IDD_FIRST_PAGE 107
+#define IDS_GOODBYE_GOOD1 107
+#define IDS_SEARCHING 108
+#define IDD_SECOND_PAGE 109
+#define IDS_GOODBYTE_GOOD2 109
+#define IDS_INSTALL_TITLE 110
+#define IDS_INSTALL_SUBTITLE 111
+#define IDS_ERROR_SELECTING_PRINTER_TEXT 112
+#define IDS_ERROR_SELECTING_PRINTER_CAPTION 113
+#define IDS_INSTALL_ERROR_CAPTION 114
+#define IDS_INSTALL_ERROR_MESSAGE 115
+#define IDS_MANUFACTURER_HEADING 116
+#define IDS_MODEL_HEADING 117
+#define IDS_NO_PRINTERS 118
+#define IDS_NO_MDNSRESPONDER_SERVICE_TEXT 119
+#define IDS_NO_MDNSRESPONDER_SERVICE_CAPTION 120
+#define IDS_PRINTER_MATCH_GOOD 121
+#define IDS_PRINTER_MATCH_BAD 122
+#define IDS_PRINTER_MATCH_MAYBE 146
+#define IDS_YES 123
+#define IDS_NO 124
+#define IDS_LARGE_FONT 125
+#define IDS_FIREWALL 126
+#define IDS_ERROR_CAPTION 127
+#define IDR_MAINFRAME 128
+#define IDS_FIREWALL_CAPTION 128
+#define IDB_BANNER_ICON 129
+#define IDD_THIRD_PAGE 130
+#define IDB_WATERMARK 131
+#define IDD_FOURTH_PAGE 132
+#define IDI_INFO 136
+#define IDB_ABOUT 138
+#define IDD_DIALOG1 139
+#define IDI_ICON2 141
+#define IDI_PRINTER 141
+#define IDS_REINSTALL 142
+#define IDS_REINSTALL_CAPTION 143
+#define IDC_INFO 144
+#define IDS_PRINTER_UNAVAILABLE 145
+#define IDS_BAD_INF_FILE 150
+#define IDS_BAD_INF_FILE_CAPTION 151
+#define IDS_NO_MATCH_INF_FILE 152
+#define IDS_NO_MATCH_INF_FILE_CAPTION 153
+#define IDC_BUTTON1 1000
+#define IDC_LIST1 1000
+#define IDC_BROWSE_LIST 1000
+#define IDC_RADIO1 1001
+#define IDC_COMBO1 1001
+#define IDC_RADIO2 1002
+#define IDC_GREETING 1003
+#define IDC_CHECK1 1016
+#define IDC_DEFAULT_PRINTER 1016
+#define IDC_PRINTER_IMAGE 1017
+#define IDC_PRINTER_NAME 1018
+#define IDC_PRINTER_MANUFACTURER 1019
+#define IDC_PRINTER_MODEL 1020
+#define IDC_GOODBYE 1021
+#define IDC_PRINTER_PORT 1022
+#define IDC_PRINTER_PROTOCOL 1022
+#define IDC_PRINTER_DEFAULT 1023
+#define IDC_PRINTER_SELECTION_TEXT 1024
+#define IDC_HAVE_DISK 1025
+#define IDC_PRINTER_INFORMATION 1026
+#define IDC_LOCATION_LABEL 1029
+#define IDC_DESCRIPTION_FIELD 1030
+#define IDC_LOCATION_FIELD 1032
+#define IDC_DESCRIPTION_LABEL 1033
+#define IDC_COMPLETE1 1034
+#define IDC_COMPLETE2 1035
+#define IDC_INSTALLING 1036
+#define IDC_PROGRESS 1037
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 142
+#define _APS_NEXT_COMMAND_VALUE 32771
+#define _APS_NEXT_CONTROL_VALUE 1034
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/resource_res.h b/mDNSResponder/Clients/PrinterSetupWizard/resource_res.h
new file mode 100755
index 00000000..33c0c288
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/resource_res.h
@@ -0,0 +1,94 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by PrinterSetupWizard.rc
+//
+#define IDM_ABOUTBOX 0x0010
+#define IDD_ABOUTBOX 100
+#define IDS_ABOUTBOX 101
+#define IDD_PRINTERSETUPWIZARD_DIALOG 102
+#define IDS_GOODBYE 102
+#define IDS_GREETING 103
+#define IDS_BROWSE_TITLE 104
+#define IDS_BROWSE_SUBTITLE 105
+#define IDS_CAPTION 106
+#define IDD_FIRST_PAGE 107
+#define IDS_GOODBYE_GOOD1 107
+#define IDS_SEARCHING 108
+#define IDD_SECOND_PAGE 109
+#define IDS_GOODBYTE_GOOD2 109
+#define IDS_INSTALL_TITLE 110
+#define IDS_INSTALL_SUBTITLE 111
+#define IDS_ERROR_SELECTING_PRINTER_TEXT 112
+#define IDS_ERROR_SELECTING_PRINTER_CAPTION 113
+#define IDS_INSTALL_ERROR_CAPTION 114
+#define IDS_INSTALL_ERROR_MESSAGE 115
+#define IDS_MANUFACTURER_HEADING 116
+#define IDS_MODEL_HEADING 117
+#define IDS_NO_PRINTERS 118
+#define IDS_NO_MDNSRESPONDER_SERVICE_TEXT 119
+#define IDS_NO_MDNSRESPONDER_SERVICE_CAPTION 120
+#define IDS_PRINTER_MATCH_GOOD 121
+#define IDS_PRINTER_MATCH_BAD 122
+#define IDS_YES 123
+#define IDS_NO 124
+#define IDS_LARGE_FONT 125
+#define IDS_FIREWALL 126
+#define IDS_ERROR_CAPTION 127
+#define IDR_MAINFRAME 128
+#define IDS_FIREWALL_CAPTION 128
+#define IDB_BANNER_ICON 129
+#define IDD_THIRD_PAGE 130
+#define IDB_WATERMARK 131
+#define IDD_FOURTH_PAGE 132
+#define IDI_INFO 136
+#define IDB_ABOUT 138
+#define IDD_DIALOG1 139
+#define IDI_ICON2 141
+#define IDI_PRINTER 141
+#define IDS_REINSTALL 142
+#define IDS_REINSTALL_CAPTION 143
+#define IDC_INFO 144
+#define IDS_PRINTER_UNAVAILABLE 145
+#define IDS_BAD_INF_FILE 150
+#define IDS_BAD_INF_FILE_CAPTION 151
+#define IDS_NO_MATCH_INF_FILE 152
+#define IDS_NO_MATCH_INF_FILE_CAPTION 153
+#define IDC_BUTTON1 1000
+#define IDC_LIST1 1000
+#define IDC_BROWSE_LIST 1000
+#define IDC_RADIO1 1001
+#define IDC_COMBO1 1001
+#define IDC_RADIO2 1002
+#define IDC_GREETING 1003
+#define IDC_CHECK1 1016
+#define IDC_DEFAULT_PRINTER 1016
+#define IDC_PRINTER_IMAGE 1017
+#define IDC_PRINTER_NAME 1018
+#define IDC_PRINTER_MANUFACTURER 1019
+#define IDC_PRINTER_MODEL 1020
+#define IDC_GOODBYE 1021
+#define IDC_PRINTER_PORT 1022
+#define IDC_PRINTER_PROTOCOL 1022
+#define IDC_PRINTER_DEFAULT 1023
+#define IDC_PRINTER_SELECTION_TEXT 1024
+#define IDC_HAVE_DISK 1025
+#define IDC_PRINTER_INFORMATION 1026
+#define IDC_LOCATION_LABEL 1029
+#define IDC_DESCRIPTION_FIELD 1030
+#define IDC_LOCATION_FIELD 1032
+#define IDC_DESCRIPTION_LABEL 1033
+#define IDC_COMPLETE1 1034
+#define IDC_COMPLETE2 1035
+#define IDC_INSTALLING 1036
+#define IDC_PROGRESS 1037
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 142
+#define _APS_NEXT_COMMAND_VALUE 32771
+#define _APS_NEXT_CONTROL_VALUE 1034
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/stdafx.cpp b/mDNSResponder/Clients/PrinterSetupWizard/stdafx.cpp
new file mode 100644
index 00000000..e05ec3d1
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/stdafx.cpp
@@ -0,0 +1,20 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "stdafx.h"
+
+
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/stdafx.h b/mDNSResponder/Clients/PrinterSetupWizard/stdafx.h
new file mode 100644
index 00000000..1eec4c39
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/stdafx.h
@@ -0,0 +1,61 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
+#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#endif
+
+#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
+#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#endif
+
+#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
+#endif
+
+// Step 3: We want to see one image, but not a tile
+#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
+#define _WIN32_IE 0x0500 // Change this to the appropriate value to target IE 5.0 or later.
+#endif
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+// turns off MFC's hiding of some common and often safely ignored warning messages
+#define _AFX_ALL_WARNINGS
+
+#if !defined(_WSPIAPI_COUNTOF)
+# define _WSPIAPI_COUNTOF(_Array) (sizeof(_Array) / sizeof(_Array[0]))
+#endif
+
+#include <afxwin.h> // MFC core and standard components
+#include <afxext.h> // MFC extensions
+#include <afxdisp.h> // MFC Automation classes
+
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h> // MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+#include <afxdlgs.h>
+
diff --git a/mDNSResponder/Clients/PrinterSetupWizard/tcpxcv.h b/mDNSResponder/Clients/PrinterSetupWizard/tcpxcv.h
new file mode 100755
index 00000000..a4b7b5f3
--- /dev/null
+++ b/mDNSResponder/Clients/PrinterSetupWizard/tcpxcv.h
@@ -0,0 +1,107 @@
+/*++
+
+ Copyright (c) 1997 - 1999 Hewlett-Packard Company.
+ Copyright (c) 1997 - 1999 Microsoft Corporation
+ All rights reserved
+
+ Module Name:
+
+ tcpxcv.h
+
+ --*/
+/*
+ * This file is contained in WinDDK 6001.18002
+ */
+
+#ifndef _TCPXCV_
+#define _TCPXCV_
+
+#if (!defined(UNKNOWN_PROTOCOL))
+ #define UNKNOWN_PROTOCOL 0
+ #define PROTOCOL_UNKNOWN_TYPE UNKNOWN_PROTOCOL
+#endif
+
+#if (!defined(RAWTCP))
+#define RAWTCP 1
+#define PROTOCOL_RAWTCP_TYPE RAWTCP
+#endif
+
+#if (!defined(LPR))
+#define LPR 2
+#define PROTOCOL_LPR_TYPE LPR
+#endif
+
+#define MAX_PORTNAME_LEN 63 +1 // port name length
+#define MAX_NETWORKNAME_LEN 48 +1 // host name length
+#define MAX_NETWORKNAME2_LEN 128 // host name or IPv6 address
+#define MAX_SNMP_COMMUNITY_STR_LEN 32 +1 // SNMP Community String Name
+#define MAX_QUEUENAME_LEN 32 +1 // lpr print que name
+#define MAX_IPADDR_STR_LEN 15 +1 // ip address; string version
+#define MAX_ADDRESS_STR_LEN 12 +1 // hw address length
+#define MAX_DEVICEDESCRIPTION_STR_LEN 256+1
+
+
+
+typedef struct _PORT_DATA_1
+{
+ WCHAR sztPortName[MAX_PORTNAME_LEN];
+ DWORD dwVersion;
+ DWORD dwProtocol;
+ DWORD cbSize;
+ DWORD dwReserved;
+ WCHAR sztHostAddress[MAX_NETWORKNAME_LEN];
+ WCHAR sztSNMPCommunity[MAX_SNMP_COMMUNITY_STR_LEN];
+ DWORD dwDoubleSpool;
+ WCHAR sztQueue[MAX_QUEUENAME_LEN];
+ WCHAR sztIPAddress[MAX_IPADDR_STR_LEN];
+ BYTE Reserved[540];
+ DWORD dwPortNumber;
+ DWORD dwSNMPEnabled;
+ DWORD dwSNMPDevIndex;
+} PORT_DATA_1, *PPORT_DATA_1;
+
+typedef struct _PORT_DATA_2
+{
+ WCHAR sztPortName[MAX_PORTNAME_LEN];
+ DWORD dwVersion;
+ DWORD dwProtocol;
+ DWORD cbSize;
+ DWORD dwReserved;
+ WCHAR sztHostAddress [MAX_NETWORKNAME2_LEN];
+ WCHAR sztSNMPCommunity[MAX_SNMP_COMMUNITY_STR_LEN];
+ DWORD dwDoubleSpool;
+ WCHAR sztQueue[MAX_QUEUENAME_LEN];
+ BYTE Reserved[514];
+ DWORD dwPortNumber;
+ DWORD dwSNMPEnabled;
+ DWORD dwSNMPDevIndex;
+ DWORD dwPortMonitorMibIndex;
+} PORT_DATA_2, *PPORT_DATA_2;
+
+
+typedef struct _PORT_DATA_LIST_1
+{
+ DWORD dwVersion;
+ DWORD cPortData;
+ PORT_DATA_2 pPortData[1];
+} PORT_DATA_LIST_1, *PPORT_DATA_LIST_1;
+
+
+typedef struct _DELETE_PORT_DATA_1
+{
+ WCHAR psztPortName[MAX_PORTNAME_LEN];
+ BYTE Reserved[98];
+ DWORD dwVersion;
+ DWORD dwReserved;
+} DELETE_PORT_DATA_1, *PDELETE_PORT_DATA_1;
+
+
+typedef struct _CONFIG_INFO_DATA_1
+{
+ BYTE Reserved[128];
+ DWORD dwVersion;
+} CONFIG_INFO_DATA_1, *PCONFIG_INFO_DATA_1;
+
+
+
+#endif