diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-01-30 13:52:13 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-01-30 16:23:04 +0100 |
commit | 9449f151d0ccf3ac755d5f2bd9b4057ae2b03157 (patch) | |
tree | ada21dc6aa0b146c62a7561a08fb51fe4a8922ee /mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows | |
parent | DHCPCD(8): Add MASTER_ONLY option (diff) | |
download | rtems-libbsd-9449f151d0ccf3ac755d5f2bd9b4057ae2b03157.tar.bz2 |
mDNS: Import
The sources can be obtained via:
http://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-544.tar.gz
Diffstat (limited to 'mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows')
18 files changed, 3055 insertions, 0 deletions
diff --git a/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/ApplicationVS2002.sln b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/ApplicationVS2002.sln new file mode 100644 index 00000000..5ce1a0a2 --- /dev/null +++ b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/ApplicationVS2002.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Application", "ApplicationVS2002.vcproj", "{EDE4B529-4CF5-4A49-9B6F-C10F0EA24278}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {EDE4B529-4CF5-4A49-9B6F-C10F0EA24278}.Debug.ActiveCfg = Debug|Win32 + {EDE4B529-4CF5-4A49-9B6F-C10F0EA24278}.Debug.Build.0 = Debug|Win32 + {EDE4B529-4CF5-4A49-9B6F-C10F0EA24278}.Release.ActiveCfg = Release|Win32 + {EDE4B529-4CF5-4A49-9B6F-C10F0EA24278}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/ApplicationVS2002.vcproj b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/ApplicationVS2002.vcproj new file mode 100644 index 00000000..c1a24241 --- /dev/null +++ b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/ApplicationVS2002.vcproj @@ -0,0 +1,253 @@ +<?xml version="1.0" encoding = "Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="7.00" + Name="Application" + ProjectGUID="{EDE4B529-4CF5-4A49-9B6F-C10F0EA24278}" + Keyword="MFCProj"> + <Platforms> + <Platform + Name="Win32"/> + </Platforms> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="1" + UseOfMFC="1" + CharacterSet="1"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories=".\Resources;..\;..\..\..\;..\..\..\..\mDNSCore;..\..\..\DNSServices" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;DEBUG=1" + StringPooling="TRUE" + MinimalRebuild="FALSE" + BasicRuntimeChecks="3" + SmallerTypeCheck="FALSE" + RuntimeLibrary="1" + BufferSecurityCheck="TRUE" + EnableFunctionLevelLinking="FALSE" + ForceConformanceInForLoopScope="TRUE" + RuntimeTypeInfo="TRUE" + UsePrecompiledHeader="2" + PrecompiledHeaderThrough="StdAfx.h" + PrecompiledHeaderFile=".\Debug/Application.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + BrowseInformation="1" + WarningLevel="4" + WarnAsError="TRUE" + SuppressStartupBanner="TRUE" + Detect64BitPortabilityProblems="TRUE" + DebugInformationFormat="3" + CompileAs="2"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + AdditionalOptions="/MACHINE:I386 /IGNORE:4089" + AdditionalDependencies="ws2_32.lib" + OutputFile="DNSServiceBrowser Debug.exe" + LinkIncremental="1" + SuppressStartupBanner="TRUE" + IgnoreDefaultLibraryNames="wsock32.lib" + GenerateDebugInformation="TRUE" + ProgramDatabaseFile=".\Debug/Application.pdb" + SubSystem="2"/> + <Tool + Name="VCMIDLTool" + PreprocessorDefinitions="_DEBUG" + MkTypLibCompatible="FALSE" + SuppressStartupBanner="TRUE" + TargetEnvironment="1" + TypeLibraryName=".\Debug/Application.tlb"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_AFXDLL;_DEBUG" + Culture="1033"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + UseOfMFC="1" + CharacterSet="1" + WholeProgramOptimization="FALSE"> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + GlobalOptimizations="TRUE" + InlineFunctionExpansion="0" + FavorSizeOrSpeed="2" + OmitFramePointers="TRUE" + OptimizeForWindowsApplication="FALSE" + AdditionalIncludeDirectories=".\Resources;..\;..\..\..\;..\..\..\..\mDNSCore;..\..\..\DNSServices" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + StringPooling="TRUE" + MinimalRebuild="FALSE" + RuntimeLibrary="0" + BufferSecurityCheck="FALSE" + EnableFunctionLevelLinking="FALSE" + ForceConformanceInForLoopScope="TRUE" + RuntimeTypeInfo="TRUE" + UsePrecompiledHeader="2" + PrecompiledHeaderThrough="stdafx.h" + PrecompiledHeaderFile=".\Release/Application.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + BrowseInformation="1" + WarningLevel="4" + WarnAsError="TRUE" + SuppressStartupBanner="TRUE" + Detect64BitPortabilityProblems="TRUE" + CompileAs="2"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + AdditionalOptions="/MACHINE:I386 /IGNORE:4089" + AdditionalDependencies="ws2_32.lib" + OutputFile="DNSServiceBrowser.exe" + LinkIncremental="1" + SuppressStartupBanner="TRUE" + IgnoreDefaultLibraryNames="wsock32.lib" + ProgramDatabaseFile=".\Release/Application.pdb" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2"/> + <Tool + Name="VCMIDLTool" + PreprocessorDefinitions="NDEBUG" + MkTypLibCompatible="TRUE" + SuppressStartupBanner="TRUE" + TargetEnvironment="1" + TypeLibraryName=".\Release/Application.tlb"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_AFXDLL;NDEBUG" + Culture="1033"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + </Configuration> + </Configurations> + <Files> + <Filter + Name="Source Files" + Filter=""> + <File + RelativePath="Sources\AboutDialog.cpp"> + </File> + <File + RelativePath="Sources\AboutDialog.h"> + </File> + <File + RelativePath="Sources\Application.cpp"> + </File> + <File + RelativePath="Sources\Application.h"> + </File> + <File + RelativePath="Sources\ChooserDialog.cpp"> + </File> + <File + RelativePath="Sources\ChooserDialog.h"> + </File> + <File + RelativePath="Sources\LoginDialog.cpp"> + </File> + <File + RelativePath="Sources\LoginDialog.h"> + </File> + <File + RelativePath="Sources\StdAfx.cpp"> + </File> + <File + RelativePath="Sources\StdAfx.h"> + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;rc"> + <File + RelativePath="Resources\Application.ico"> + </File> + <File + RelativePath="Resources\Application.rc"> + </File> + <File + RelativePath="Resources\Application.rc2"> + </File> + <File + RelativePath=".\Resources\Resource.h"> + </File> + </Filter> + <Filter + Name="Support" + Filter=""> + <File + RelativePath="..\..\..\CommonServices.h"> + </File> + <File + RelativePath="..\..\..\..\mDNSCore\DNSCommon.c"> + </File> + <File + RelativePath="..\..\..\..\mDNSCore\DNSCommon.h"> + </File> + <File + RelativePath="..\..\..\..\mDNSCore\DNSDigest.c"> + </File> + <File + RelativePath="..\..\..\DNSServices\DNSServices.c"> + </File> + <File + RelativePath="..\..\..\DebugServices.c"> + </File> + <File + RelativePath="..\..\..\DebugServices.h"> + </File> + <File + RelativePath="..\..\..\..\mDNSCore\mDNS.c"> + </File> + <File + RelativePath="..\..\..\..\mDNSCore\mDNSClientAPI.h"> + </File> + <File + RelativePath="..\..\..\..\mDNSCore\mDNSDebug.h"> + </File> + <File + RelativePath="..\..\..\mDNSWin32.c"> + </File> + <File + RelativePath="..\..\..\..\mDNSCore\uDNS.c"> + </File> + <File + RelativePath="..\..\..\..\mDNSCore\uDNS.h"> + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/ApplicationVS2003.sln b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/ApplicationVS2003.sln new file mode 100644 index 00000000..bdaaa3be --- /dev/null +++ b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/ApplicationVS2003.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Application", "ApplicationVS2003.vcproj", "{EDE4B529-4CF5-4A49-9B6F-C10F0EA24278}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {EDE4B529-4CF5-4A49-9B6F-C10F0EA24278}.Debug.ActiveCfg = Debug|Win32 + {EDE4B529-4CF5-4A49-9B6F-C10F0EA24278}.Debug.Build.0 = Debug|Win32 + {EDE4B529-4CF5-4A49-9B6F-C10F0EA24278}.Release.ActiveCfg = Release|Win32 + {EDE4B529-4CF5-4A49-9B6F-C10F0EA24278}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/ApplicationVS2003.vcproj b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/ApplicationVS2003.vcproj new file mode 100644 index 00000000..3c8cb1c1 --- /dev/null +++ b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/ApplicationVS2003.vcproj @@ -0,0 +1,267 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="7.10" + Name="Application" + ProjectGUID="{EDE4B529-4CF5-4A49-9B6F-C10F0EA24278}" + Keyword="MFCProj"> + <Platforms> + <Platform + Name="Win32"/> + </Platforms> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="1" + UseOfMFC="1" + CharacterSet="1"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories=".\Resources;..\;..\..\..\;..\..\..\..\mDNSCore;..\..\..\DNSServices" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;DEBUG=1" + StringPooling="TRUE" + MinimalRebuild="FALSE" + BasicRuntimeChecks="3" + SmallerTypeCheck="FALSE" + RuntimeLibrary="1" + BufferSecurityCheck="TRUE" + EnableFunctionLevelLinking="FALSE" + ForceConformanceInForLoopScope="TRUE" + RuntimeTypeInfo="TRUE" + UsePrecompiledHeader="2" + PrecompiledHeaderThrough="StdAfx.h" + PrecompiledHeaderFile=".\Debug/Application.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + BrowseInformation="1" + WarningLevel="4" + WarnAsError="TRUE" + SuppressStartupBanner="TRUE" + Detect64BitPortabilityProblems="TRUE" + DebugInformationFormat="3" + CompileAs="0"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + AdditionalOptions="/MACHINE:I386 /IGNORE:4089" + AdditionalDependencies="ws2_32.lib" + OutputFile="DNSServiceBrowser Debug.exe" + LinkIncremental="1" + SuppressStartupBanner="TRUE" + IgnoreDefaultLibraryNames="wsock32.lib" + GenerateDebugInformation="TRUE" + ProgramDatabaseFile=".\Debug/Application.pdb" + SubSystem="2"/> + <Tool + Name="VCMIDLTool" + PreprocessorDefinitions="_DEBUG" + MkTypLibCompatible="FALSE" + SuppressStartupBanner="TRUE" + TargetEnvironment="1" + TypeLibraryName=".\Debug/Application.tlb"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_AFXDLL;_DEBUG" + Culture="1033"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + UseOfMFC="1" + CharacterSet="1" + WholeProgramOptimization="FALSE"> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + GlobalOptimizations="TRUE" + InlineFunctionExpansion="0" + FavorSizeOrSpeed="2" + OmitFramePointers="TRUE" + OptimizeForWindowsApplication="FALSE" + AdditionalIncludeDirectories=".\Resources;..\;..\..\..\;..\..\..\..\mDNSCore;..\..\..\DNSServices" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + StringPooling="TRUE" + MinimalRebuild="FALSE" + RuntimeLibrary="0" + BufferSecurityCheck="FALSE" + EnableFunctionLevelLinking="FALSE" + ForceConformanceInForLoopScope="TRUE" + RuntimeTypeInfo="TRUE" + UsePrecompiledHeader="2" + PrecompiledHeaderThrough="stdafx.h" + PrecompiledHeaderFile=".\Release/Application.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + BrowseInformation="1" + WarningLevel="4" + WarnAsError="TRUE" + SuppressStartupBanner="TRUE" + Detect64BitPortabilityProblems="TRUE" + CompileAs="0"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + AdditionalOptions="/MACHINE:I386 /IGNORE:4089" + AdditionalDependencies="ws2_32.lib" + OutputFile="DNSServiceBrowser.exe" + LinkIncremental="1" + SuppressStartupBanner="TRUE" + IgnoreDefaultLibraryNames="wsock32.lib" + ProgramDatabaseFile=".\Release/Application.pdb" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2"/> + <Tool + Name="VCMIDLTool" + PreprocessorDefinitions="NDEBUG" + MkTypLibCompatible="TRUE" + SuppressStartupBanner="TRUE" + TargetEnvironment="1" + TypeLibraryName=".\Release/Application.tlb"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_AFXDLL;NDEBUG" + Culture="1033"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter=""> + <File + RelativePath="Sources\AboutDialog.cpp"> + </File> + <File + RelativePath="Sources\AboutDialog.h"> + </File> + <File + RelativePath="Sources\Application.cpp"> + </File> + <File + RelativePath="Sources\Application.h"> + </File> + <File + RelativePath="Sources\ChooserDialog.cpp"> + </File> + <File + RelativePath="Sources\ChooserDialog.h"> + </File> + <File + RelativePath="Sources\LoginDialog.cpp"> + </File> + <File + RelativePath="Sources\LoginDialog.h"> + </File> + <File + RelativePath="Sources\StdAfx.cpp"> + </File> + <File + RelativePath="Sources\StdAfx.h"> + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;rc"> + <File + RelativePath="Resources\Application.ico"> + </File> + <File + RelativePath="Resources\Application.rc"> + </File> + <File + RelativePath="Resources\Application.rc2"> + </File> + <File + RelativePath=".\Resources\Resource.h"> + </File> + </Filter> + <Filter + Name="Support" + Filter=""> + <File + RelativePath="..\..\..\CommonServices.h"> + </File> + <File + RelativePath="..\..\..\..\mDNSCore\DNSCommon.c"> + </File> + <File + RelativePath="..\..\..\..\mDNSCore\DNSCommon.h"> + </File> + <File + RelativePath="..\..\..\..\mDNSCore\DNSDigest.c"> + </File> + <File + RelativePath="..\..\..\DNSServices\DNSServices.c"> + </File> + <File + RelativePath="..\..\..\DebugServices.c"> + </File> + <File + RelativePath="..\..\..\DebugServices.h"> + </File> + <File + RelativePath="..\..\..\..\mDNSCore\mDNS.c"> + </File> + <File + RelativePath="..\..\..\..\mDNSCore\mDNSClientAPI.h"> + </File> + <File + RelativePath="..\..\..\..\mDNSCore\mDNSDebug.h"> + </File> + <File + RelativePath="..\..\..\mDNSWin32.c"> + </File> + <File + RelativePath="..\..\..\..\mDNSCore\uDNS.c"> + </File> + <File + RelativePath="..\..\..\..\mDNSCore\uDNS.h"> + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Resources/Application.ico b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Resources/Application.ico Binary files differnew file mode 100644 index 00000000..b0a86399 --- /dev/null +++ b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Resources/Application.ico diff --git a/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Resources/Application.rc b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Resources/Application.rc new file mode 100644 index 00000000..39431396 --- /dev/null +++ b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Resources/Application.rc @@ -0,0 +1,323 @@ +// Microsoft Visual C++ generated resource script. +// +#include "Resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// 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 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "Resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.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" + "#ifdef _WIN32\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#endif //_WIN32\r\n" + "#include ""Resources\\Application.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAIN_ICON ICON "Application.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_CHOOSER_DIALOG DIALOGEX 0, 0, 512, 316 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | + WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "DNSServiceBrowser" +MENU IDR_CHOOSER_DIALOG_MENU +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + CONTROL "",IDC_SERVICE_LIST,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | + LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,8,8,268,256 + CONTROL "",IDC_CHOOSER_LIST,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | + LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,282,8,224,170 + CONTROL "",IDC_DOMAIN_LIST,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | + LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,8,272,268,38 + GROUPBOX "Information",IDC_STATIC,282,182,224,128 + RTEXT "Name:",IDC_STATIC,288,195,38,8 + EDITTEXT IDC_INFO_NAME_TEXT,330,195,168,10,ES_AUTOHSCROLL | + ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE + RTEXT "IP address:",IDC_STATIC,288,208,38,8 + EDITTEXT IDC_INFO_IP_TEXT,330,208,168,10,ES_AUTOHSCROLL | + ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE + RTEXT "Interface:",IDC_STATIC,288,221,38,8 + EDITTEXT IDC_INFO_INTERFACE_TEXT,330,221,168,10,ES_AUTOHSCROLL | + ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE + RTEXT "Host Name:",IDC_STATIC,287,234,38,8 + EDITTEXT IDC_INFO_HOST_NAME_TEXT,330,234,168,10,ES_AUTOHSCROLL | + ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE + RTEXT "Text:",IDC_STATIC,288,247,38,8 + EDITTEXT IDC_INFO_TEXT_TEXT,330,247,168,57,ES_MULTILINE | + ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | NOT + WS_BORDER,WS_EX_STATICEDGE +END + +IDD_ABOUT_DIALOG DIALOGEX 0, 0, 244, 73 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION +CAPTION "About DNSServiceBrowser" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + ICON IDR_MAIN_ICON,IDC_ABOUT_APP_ICON,12,12,20,20 + LTEXT "DNSServiceBrowser",IDC_ABOUT_APP_NAME_TEXT,44,11,192, + 12 + LTEXT "Version 1.2d1",IDC_ABOUT_APP_VERSION_TEXT,44,25,192,8 + LTEXT "Copyright (C) 2002-2004 Apple Computer, Inc.", + IDC_ABOUT_COPYRIGHT_TEXT,4,60,156,8 + DEFPUSHBUTTON "OK",IDOK,192,52,44,14 +END + +IDD_LOGIN DIALOGEX 0, 0, 180, 89 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION +CAPTION "Login" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "Enter a username and password. Leave blank to use the default username and/or password.", + IDC_STATIC,8,8,156,16,NOT WS_GROUP + RTEXT "Username:",IDC_STATIC,10,34,36,8,NOT WS_GROUP + EDITTEXT IDC_LOGIN_USERNAME_TEXT,50,32,118,12,ES_AUTOHSCROLL + RTEXT "Password:",IDC_STATIC,10,50,36,8,NOT WS_GROUP + EDITTEXT IDC_LOGIN_PASSWORD_TEXT,50,48,118,12,ES_PASSWORD | + ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",IDOK,129,70,44,14 + PUSHBUTTON "Cancel",IDCANCEL,77,70,44,14 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Apple Computer, Inc." + VALUE "FileDescription", "DNSServiceBrowser for Windows" + VALUE "FileVersion", "1, 0, 0, 1" + VALUE "InternalName", "DNSServiceBrowser for Windows" + VALUE "LegalCopyright", "Copyright (C) 2002-2004 Apple Computer, Inc." + VALUE "OriginalFilename", "DNSServiceBrowser.exe" + VALUE "ProductName", "DNSServiceBrowser for Windows" + VALUE "ProductVersion", "1, 0, 0, 1" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_CHOOSER_DIALOG_MENU MENU +BEGIN + POPUP "File" + BEGIN + MENUITEM "Close &Window\tCtrl+W", ID_FILE_CLOSE + MENUITEM SEPARATOR + MENUITEM "Exit", ID_FILE_EXIT + END + POPUP "Help" + BEGIN + MENUITEM "About DNSServiceBrowser...", ID_HELP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDR_CHOOSER_DIALOG_MENU_ACCELERATORS ACCELERATORS +BEGIN + "S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "W", ID_FILE_CLOSE, VIRTKEY, CONTROL, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST +BEGIN + 0x3f3c, 0x6d78, 0x206c, 0x6576, 0x7372, 0x6f69, 0x3d6e, 0x3122, 0x302e, + 0x2022, 0x6e65, 0x6f63, 0x6964, 0x676e, 0x223d, 0x5455, 0x2d46, 0x2238, + 0x7320, 0x6174, 0x646e, 0x6c61, 0x6e6f, 0x3d65, 0x7922, 0x7365, 0x3f22, + 0x203e, 0x0a0d, 0x613c, 0x7373, 0x6d65, 0x6c62, 0x2079, 0x0a0d, 0x2020, + 0x7820, 0x6c6d, 0x736e, 0x223d, 0x7275, 0x3a6e, 0x6373, 0x6568, 0x616d, + 0x2d73, 0x696d, 0x7263, 0x736f, 0x666f, 0x2d74, 0x6f63, 0x3a6d, 0x7361, + 0x2e6d, 0x3176, 0x2022, 0x0a0d, 0x2020, 0x6d20, 0x6e61, 0x6669, 0x7365, + 0x5674, 0x7265, 0x6973, 0x6e6f, 0x223d, 0x2e31, 0x2230, 0x0d3e, 0x3c0a, + 0x7361, 0x6573, 0x626d, 0x796c, 0x6449, 0x6e65, 0x6974, 0x7974, 0x0d20, + 0x200a, 0x2020, 0x7020, 0x6f72, 0x6563, 0x7373, 0x726f, 0x7241, 0x6863, + 0x7469, 0x6365, 0x7574, 0x6572, 0x223d, 0x3878, 0x2236, 0x0d20, 0x200a, + 0x2020, 0x7620, 0x7265, 0x6973, 0x6e6f, 0x223d, 0x2e35, 0x2e31, 0x2e30, + 0x2230, 0x0a0d, 0x2020, 0x2020, 0x7974, 0x6570, 0x223d, 0x6977, 0x336e, + 0x2232, 0x0a0d, 0x2020, 0x2020, 0x616e, 0x656d, 0x223d, 0x7041, 0x2e70, + 0x7865, 0x2265, 0x3e2f, 0x0a0d, 0x2020, 0x2020, 0x643c, 0x7365, 0x7263, + 0x7069, 0x6974, 0x6e6f, 0x413e, 0x7269, 0x6f50, 0x7472, 0x4120, 0x6d64, + 0x6e69, 0x5520, 0x6974, 0x696c, 0x7974, 0x2f3c, 0x6564, 0x6373, 0x6972, + 0x7470, 0x6f69, 0x3e6e, 0x0a0d, 0x2020, 0x2020, 0x643c, 0x7065, 0x6e65, + 0x6564, 0x636e, 0x3e79, 0x0a0d, 0x2020, 0x2020, 0x643c, 0x7065, 0x6e65, + 0x6564, 0x746e, 0x7341, 0x6573, 0x626d, 0x796c, 0x0d3e, 0x200a, 0x2020, + 0x3c20, 0x7361, 0x6573, 0x626d, 0x796c, 0x6449, 0x6e65, 0x6974, 0x7974, + 0x0a0d, 0x2020, 0x2020, 0x2020, 0x2020, 0x7420, 0x7079, 0x3d65, 0x7722, + 0x6e69, 0x3233, 0x0d22, 0x200a, 0x2020, 0x2020, 0x2020, 0x2020, 0x616e, + 0x656d, 0x223d, 0x694d, 0x7263, 0x736f, 0x666f, 0x2e74, 0x6957, 0x646e, + 0x776f, 0x2e73, 0x6f43, 0x6d6d, 0x6e6f, 0x432d, 0x6e6f, 0x7274, 0x6c6f, + 0x2273, 0x0a0d, 0x2020, 0x2020, 0x2020, 0x2020, 0x7620, 0x7265, 0x6973, + 0x6e6f, 0x223d, 0x2e36, 0x2e30, 0x2e30, 0x2230, 0x0a0d, 0x2020, 0x2020, + 0x2020, 0x2020, 0x7020, 0x6275, 0x696c, 0x4b63, 0x7965, 0x6f54, 0x656b, + 0x3d6e, 0x3622, 0x3935, 0x6235, 0x3436, 0x3431, 0x6334, 0x6663, 0x6431, + 0x2266, 0x0a0d, 0x2020, 0x2020, 0x2020, 0x2020, 0x6c20, 0x6e61, 0x7567, + 0x6761, 0x3d65, 0x2a22, 0x0d22, 0x200a, 0x2020, 0x2020, 0x2020, 0x2020, + 0x7270, 0x636f, 0x7365, 0x6f73, 0x4172, 0x6372, 0x6968, 0x6574, 0x7463, + 0x7275, 0x3d65, 0x7822, 0x3638, 0x2f22, 0x0d3e, 0x200a, 0x2020, 0x3c20, + 0x642f, 0x7065, 0x6e65, 0x6564, 0x746e, 0x7341, 0x6573, 0x626d, 0x796c, + 0x0d3e, 0x200a, 0x2020, 0x3c20, 0x642f, 0x7065, 0x6e65, 0x6564, 0x636e, + 0x3e79, 0x0a0d, 0x2f3c, 0x7361, 0x6573, 0x626d, 0x796c, 0x0d3e, "\012" +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_CHOOSER_DIALOG, DIALOG + BEGIN + RIGHTMARGIN, 468 + END + + IDD_LOGIN, DIALOG + BEGIN + BOTTOMMARGIN, 62 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_ABOUTBOX "&About DNSServiceBrowser" + IDS_CHOOSER_DOMAIN_COLUMN_NAME "Domains" + IDP_SOCKETS_INIT_FAILED "Windows sockets initialization failed." + IDS_CHOOSER_SERVICE_COLUMN_TYPE "Services" + IDS_CHOOSER_CHOOSER_NAME_COLUMN_NAME "Name" + IDS_CHOOSER_CHOOSER_IP_COLUMN_NAME "IP Address" + IDS_CHOOSER_SERVICE_COLUMN_DESC "Description" +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) +#ifdef _WIN32 +LANGUAGE 9, 1 +#pragma code_page(1252) +#endif //_WIN32 +#include "Resources\Application.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#endif + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Resources/Application.rc2 b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Resources/Application.rc2 new file mode 100644 index 00000000..ec5e69fa --- /dev/null +++ b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Resources/Application.rc2 @@ -0,0 +1,20 @@ +/* -*- Mode: C; tab-width: 4 -*- + * + * Copyright (c) 2002-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. + */ + +#ifdef APSTUDIO_INVOKED + #error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED diff --git a/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Resources/Resource.h b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Resources/Resource.h new file mode 100644 index 00000000..62602a4f --- /dev/null +++ b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Resources/Resource.h @@ -0,0 +1,53 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Application.rc +// +#define IDS_ABOUTBOX 101 +#define IDS_CHOOSER_DOMAIN_COLUMN_NAME 102 +#define IDP_SOCKETS_INIT_FAILED 103 +#define IDS_CHOOSER_SERVICE_COLUMN_NAME 104 +#define IDS_CHOOSER_SERVICE_COLUMN_TYPE 104 +#define IDS_CHOOSER_CHOOSER_NAME_COLUMN_NAME 105 +#define IDS_CHOOSER_CHOOSER_IP_COLUMN_NAME 106 +#define IDS_CHOOSER_SERVICE_COLUMN_DESC 107 +#define IDC_NAME_TEXT2 124 +#define IDC_INFO_NAME_TEXT 124 +#define IDC_DESCRIPTION_TEXT2 125 +#define IDC_INFO_TEXT_TEXT 125 +#define IDC_IP_TEXT2 126 +#define IDC_INFO_IP_TEXT 126 +#define IDC_IP_TEXT3 127 +#define IDC_INFO_INTERFACE_TEXT 127 +#define IDR_MAIN_ICON 128 +#define IDC_INFO_INTERFACE_TEXT2 128 +#define IDC_INFO_HOST_NAME_TEXT 128 +#define IDR_CHOOSER_DIALOG_MENU 136 +#define IDD_CHOOSER_DIALOG 143 +#define IDD_ABOUT_DIALOG 144 +#define IDD_LOGIN 145 +#define IDR_CHOOSER_DIALOG_MENU_ACCELERATORS 146 +#define IDC_CHOOSER_LIST 1000 +#define IDC_SERVICE_LIST2 1001 +#define IDC_SERVICE_LIST 1001 +#define IDC_SERVICE_LIST3 1002 +#define IDC_DOMAIN_LIST 1002 +#define IDC_ABOUT_APP_NAME_TEXT 1105 +#define IDC_ABOUT_APP_VERSION_TEXT 1106 +#define IDC_ABOUT_COPYRIGHT_TEXT 1107 +#define IDC_ABOUT_APP_ICON 1108 +#define IDC_LOGIN_USERNAME_TEXT 1182 +#define IDC_EDIT2 1183 +#define IDC_LOGIN_PASSWORD_TEXT 1183 +#define ID_FILE_EXIT 32771 +#define ID_HELP_ABOUT 32806 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 164 +#define _APS_NEXT_COMMAND_VALUE 32809 +#define _APS_NEXT_CONTROL_VALUE 1185 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/AboutDialog.cpp b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/AboutDialog.cpp new file mode 100644 index 00000000..8dd6b091 --- /dev/null +++ b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/AboutDialog.cpp @@ -0,0 +1,71 @@ +/* -*- Mode: C; tab-width: 4 -*- + * + * Copyright (c) 2002-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 <stdlib.h> + +#include "stdafx.h" + +#include "AboutDialog.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +//=========================================================================================================================== +// Message Map +//=========================================================================================================================== + +BEGIN_MESSAGE_MAP(AboutDialog, CDialog) + //{{AFX_MSG_MAP(AboutDialog) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +//=========================================================================================================================== +// AboutDialog +//=========================================================================================================================== + +AboutDialog::AboutDialog(CWnd* pParent /*=NULL*/) + : CDialog(AboutDialog::IDD, pParent) +{ + //{{AFX_DATA_INIT(AboutDialog) + // Note: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + +//=========================================================================================================================== +// OnInitDialog +//=========================================================================================================================== + +BOOL AboutDialog::OnInitDialog() +{ + CDialog::OnInitDialog(); + return( true ); +} + +//=========================================================================================================================== +// DoDataExchange +//=========================================================================================================================== + +void AboutDialog::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(AboutDialog) + // Note: the ClassWizard will add DDX and DDV calls here + //}}AFX_DATA_MAP +} diff --git a/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/AboutDialog.h b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/AboutDialog.h new file mode 100644 index 00000000..cdd257cf --- /dev/null +++ b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/AboutDialog.h @@ -0,0 +1,62 @@ +/* -*- Mode: C; tab-width: 4 -*- + * + * Copyright (c) 2002-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. + */ + +#if !defined(AFX_ABOUTDIALOG_H__4B8A04B2_9735_4F4A_AFCA_15F85FB3D763__INCLUDED_) +#define AFX_ABOUTDIALOG_H__4B8A04B2_9735_4F4A_AFCA_15F85FB3D763__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "Resource.h" + +//=========================================================================================================================== +// AboutDialog +//=========================================================================================================================== + +class AboutDialog : public CDialog +{ + public: + + // Creation/Deletion + + AboutDialog(CWnd* pParent = NULL); // standard constructor + + //{{AFX_DATA(AboutDialog) + enum { IDD = IDD_ABOUT_DIALOG }; + // Note: the ClassWizard will add data members here + //}}AFX_DATA + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(AboutDialog) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + protected: + + // Generated message map functions + //{{AFX_MSG(AboutDialog) + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_ABOUTDIALOG_H__4B8A04B2_9735_4F4A_AFCA_15F85FB3D763__INCLUDED_) diff --git a/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/Application.cpp b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/Application.cpp new file mode 100644 index 00000000..f7f4b035 --- /dev/null +++ b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/Application.cpp @@ -0,0 +1,111 @@ +/* -*- Mode: C; tab-width: 4 -*- + * + * Copyright (c) 2002-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 <assert.h> + +#include "StdAfx.h" + +#include "DNSServices.h" + +#include "Application.h" + +#include "ChooserDialog.h" + +#include "stdafx.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +//=========================================================================================================================== +// Message Map +//=========================================================================================================================== + +BEGIN_MESSAGE_MAP(Application, CWinApp) + //{{AFX_MSG_MAP(Application) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG + ON_COMMAND(ID_HELP, CWinApp::OnHelp) +END_MESSAGE_MAP() + +//=========================================================================================================================== +// Globals +//=========================================================================================================================== + +Application gApp; + +//=========================================================================================================================== +// Application +//=========================================================================================================================== + +Application::Application( void ) +{ + // +} + +//=========================================================================================================================== +// InitInstance +//=========================================================================================================================== + +BOOL Application::InitInstance() +{ + DNSStatus err; + + // Standard MFC initialization. + +#if( !defined( AFX_DEPRECATED ) ) + #ifdef _AFXDLL + Enable3dControls(); // Call this when using MFC in a shared DLL + #else + Enable3dControlsStatic(); // Call this when linking to MFC statically + #endif +#endif + + InitCommonControls(); + + // Set up DNS Services. + + err = DNSServicesInitialize( 0, 512 ); + assert( err == kDNSNoErr ); + + // Create the chooser dialog. + + ChooserDialog * dialog; + + m_pMainWnd = NULL; + dialog = new ChooserDialog; + dialog->Create( IDD_CHOOSER_DIALOG ); + m_pMainWnd = dialog; + dialog->ShowWindow( SW_SHOW ); + + return( true ); +} + +//=========================================================================================================================== +// ExitInstance +//=========================================================================================================================== + +int Application::ExitInstance( void ) +{ + // Clean up DNS Services. + + DNSServicesFinalize(); + return( 0 ); +} diff --git a/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/Application.h b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/Application.h new file mode 100644 index 00000000..8368a49f --- /dev/null +++ b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/Application.h @@ -0,0 +1,68 @@ +/* -*- Mode: C; tab-width: 4 -*- + * + * Copyright (c) 2002-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. + */ + +#if !defined(AFX_ADMIN_H__8663733F_6A15_439F_B568_F5A0125CD572__INCLUDED_) +#define AFX_ADMIN_H__8663733F_6A15_439F_B568_F5A0125CD572__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "stdafx.h" + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "Resource.h" + +//=========================================================================================================================== +// Globals +//=========================================================================================================================== + +extern class Application gApp; + +//=========================================================================================================================== +// Application +//=========================================================================================================================== + +class Application : public CWinApp +{ + public: + + // Creation/Deletion + + Application(); + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(Application) + public: + virtual BOOL InitInstance(); + virtual int ExitInstance( void ); + //}}AFX_VIRTUAL + + //{{AFX_MSG(Application) + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_ADMIN_H__8663733F_6A15_439F_B568_F5A0125CD572__INCLUDED_) diff --git a/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/ChooserDialog.cpp b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/ChooserDialog.cpp new file mode 100644 index 00000000..9e4db65b --- /dev/null +++ b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/ChooserDialog.cpp @@ -0,0 +1,1426 @@ +/* -*- Mode: C; tab-width: 4 -*- + * + * Copyright (c) 2002-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 <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + +#include <algorithm> +#include <memory> + +#include "stdafx.h" + +#include "DNSServices.h" + +#include "Application.h" +#include "AboutDialog.h" +#include "LoginDialog.h" +#include "Resource.h" + +#include "ChooserDialog.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +#if 0 +#pragma mark == Constants == +#endif + +//=========================================================================================================================== +// Constants +//=========================================================================================================================== + +// Menus + +enum +{ + kChooserMenuIndexFile = 0, + kChooserMenuIndexHelp = 1 +}; + +// Domain List + +#define kDomainListDefaultDomainColumnWidth 164 + +// Service List + +#define kServiceListDefaultServiceColumnTypeWidth 146 +#define kServiceListDefaultServiceColumnDescWidth 230 + +// Chooser List + +#define kChooserListDefaultNameColumnWidth 190 +#define kChooserListDefaultIPColumnWidth 120 + +// Windows User Messages + +#define WM_USER_DOMAIN_ADD ( WM_USER + 0x100 ) +#define WM_USER_DOMAIN_REMOVE ( WM_USER + 0x101 ) +#define WM_USER_SERVICE_ADD ( WM_USER + 0x102 ) +#define WM_USER_SERVICE_REMOVE ( WM_USER + 0x103 ) +#define WM_USER_RESOLVE ( WM_USER + 0x104 ) + +#if 0 +#pragma mark == Constants - Service Table == +#endif + +//=========================================================================================================================== +// Constants - Service Table +//=========================================================================================================================== + +struct KnownServiceEntry +{ + const char * serviceType; + const char * description; + const char * urlScheme; + bool useText; +}; + +static const KnownServiceEntry kKnownServiceTable[] = +{ + { "_accountedge._tcp.", "MYOB AccountEdge", "", false }, + { "_aecoretech._tcp.", "Apple Application Engineering Services", "", false }, + { "_afpovertcp._tcp.", "Apple File Sharing (AFP)", "afp://", false }, + { "_airport._tcp.", "AirPort Base Station", "", false }, + { "_apple-sasl._tcp.", "Apple Password Server", "", false }, + { "_aquamon._tcp.", "AquaMon", "", false }, + { "_async._tcp", "address-o-sync", "", false }, + { "_auth._tcp.", "Authentication Service", "", false }, + { "_bootps._tcp.", "Bootstrap Protocol Server", "", false }, + { "_bousg._tcp.", "Bag Of Unusual Strategy Games", "", false }, + { "_browse._udp.", "DNS Service Discovery", "", false }, + { "_cheat._tcp.", "The Cheat", "", false }, + { "_chess._tcp", "Project Gridlock", "", false }, + { "_chfts._tcp", "Fluid Theme Server", "", false }, + { "_clipboard._tcp", "Clipboard Sharing", "", false }, + { "_contactserver._tcp.", "Now Up-to-Date & Contact", "", false }, + { "_cvspserver._tcp", "CVS PServer", "", false }, + { "_cytv._tcp.", "CyTV Network streaming for Elgato EyeTV", "", false }, + { "_daap._tcp.", "Digital Audio Access Protocol (iTunes)", "daap://", false }, + { "_distcc._tcp", "Distributed Compiler", "", false }, + { "_dns-sd._udp", "DNS Service Discovery", "", false }, + { "_dpap._tcp.", "Digital Picture Access Protocol (iPhoto)", "", false }, + { "_earphoria._tcp.", "Earphoria", "", false }, + { "_ecbyesfsgksc._tcp.", "Net Monitor Anti-Piracy Service", "", false }, + { "_eheap._tcp.", "Interactive Room Software", "", false }, + { "_embrace._tcp.", "DataEnvoy", "", false }, + { "_eppc._tcp.", "Remote AppleEvents", "eppc://", false }, + { "_exec._tcp.", "Remote Process Execution", "", false }, + { "_facespan._tcp.", "FaceSpan", "", false }, + { "_fjork._tcp.", "Fjork", "", false }, + { "_ftp._tcp.", "File Transfer (FTP)", "ftp://", false }, + { "_ftpcroco._tcp.", "Crocodile FTP Server", "", false }, + { "_gbs-smp._tcp.", "SnapMail", "", false }, + { "_gbs-stp._tcp.", "SnapTalk", "", false }, + { "_grillezvous._tcp.", "Roxio ToastAnywhere(tm) Recorder Sharing", "", false }, + { "_h323._tcp.", "H.323", "", false }, + { "_hotwayd._tcp", "Hotwayd", "", false }, + { "_http._tcp.", "Web Server (HTTP)", "http://", true }, + { "_hydra._tcp", "SubEthaEdit", "", false }, + { "_ica-networking._tcp.", "Image Capture Networking", "", false }, + { "_ichalkboard._tcp.", "iChalk", "", false }, + { "_ichat._tcp.", "iChat", "ichat://", false }, + { "_iconquer._tcp.", "iConquer", "", false }, + { "_imap._tcp.", "Internet Message Access Protocol", "", false }, + { "_imidi._tcp.", "iMidi", "", false }, + { "_ipp._tcp.", "Printer (IPP)", "ipp://", false }, + { "_ishare._tcp.", "iShare", "", false }, + { "_isparx._tcp.", "iSparx", "", false }, + { "_istorm._tcp", "iStorm", "", false }, + { "_iwork._tcp.", "iWork Server", "", false }, + { "_liaison._tcp.", "Liaison", "", false }, + { "_login._tcp.", "Remote Login a la Telnet", "", false }, + { "_lontalk._tcp.", "LonTalk over IP (ANSI 852)", "", false }, + { "_lonworks._tcp.", "Echelon LNS Remote Client", "", false }, + { "_macfoh-remote._tcp.", "MacFOH Remote", "", false }, + { "_moneyworks._tcp.", "MoneyWorks", "", false }, + { "_mp3sushi._tcp", "MP3 Sushi", "", false }, + { "_mttp._tcp.", "MenuTunes Sharing", "", false }, + { "_ncbroadcast._tcp.", "Network Clipboard Broadcasts", "", false }, + { "_ncdirect._tcp.", "Network Clipboard Direct Transfers", "", false }, + { "_ncsyncserver._tcp.", "Network Clipboard Sync Server", "", false }, + { "_newton-dock._tcp.", "Escale", "", false }, + { "_nfs._tcp", "NFS", "", false }, + { "_nssocketport._tcp.", "DO over NSSocketPort", "", false }, + { "_omni-bookmark._tcp.", "OmniWeb", "", false }, + { "_openbase._tcp.", "OpenBase SQL", "", false }, + { "_p2pchat._tcp.", "Peer-to-Peer Chat", "", false }, + { "_pdl-datastream._tcp.", "Printer (PDL)", "pdl://", false }, + { "_poch._tcp.", "Parallel OperatiOn and Control Heuristic", "", false }, + { "_pop_2_ambrosia._tcp.", "Pop-Pop", "", false }, + { "_pop3._tcp", "POP3 Server", "", false }, + { "_postgresql._tcp", "PostgreSQL Server", "", false }, + { "_presence._tcp", "iChat AV", "", false }, + { "_printer._tcp.", "Printer (LPR)", "lpr://", false }, + { "_ptp._tcp.", "Picture Transfer (PTP)", "ptp://", false }, + { "_register._tcp", "DNS Service Discovery", "", false }, + { "_rfb._tcp.", "Remote Frame Buffer", "", false }, + { "_riousbprint._tcp.", "Remote I/O USB Printer Protocol", "", false }, + { "_rtsp._tcp.", "Real Time Stream Control Protocol", "", false }, + { "_safarimenu._tcp", "Safari Menu", "", false }, + { "_scone._tcp", "Scone", "", false }, + { "_sdsharing._tcp.", "Speed Download", "", false }, + { "_seeCard._tcp.", "seeCard", "", false }, + { "_services._udp.", "DNS Service Discovery", "", false }, + { "_shell._tcp.", "like exec, but automatic authentication", "", false }, + { "_shout._tcp.", "Shout", "", false }, + { "_shoutcast._tcp", "Nicecast", "", false }, + { "_smb._tcp.", "Windows File Sharing (SMB)", "smb://", false }, + { "_soap._tcp.", "Simple Object Access Protocol", "", false }, + { "_spincrisis._tcp.", "Spin Crisis", "", false }, + { "_spl-itunes._tcp.", "launchTunes", "", false }, + { "_spr-itunes._tcp.", "netTunes", "", false }, + { "_ssh._tcp.", "Secure Shell (SSH)", "ssh://", false }, + { "_ssscreenshare._tcp", "Screen Sharing", "", false }, + { "_sge-exec._tcp", "Sun Grid Engine (Execution Host)", "", false }, + { "_sge-qmaster._tcp", "Sun Grid Engine (Master)", "", false }, + { "_stickynotes._tcp", "Sticky Notes", "", false }, + { "_strateges._tcp", "Strateges", "", false }, + { "_sxqdea._tcp", "Synchronize! Pro X", "", false }, + { "_sybase-tds._tcp", "Sybase Server", "", false }, + { "_tce._tcp", "Power Card", "", false }, + { "_teamlist._tcp", "ARTIS Team Task", "", false }, + { "_teleport._tcp", "teleport", "", false }, + { "_telnet._tcp.", "Telnet", "telnet://", false }, + { "_tftp._tcp.", "Trivial File Transfer (TFTP)", "tftp://", false }, + { "_tinavigator._tcp.", "TI Navigator", "", false }, + { "_tivo_servemedia._tcp", "TiVo", "", false }, + { "_upnp._tcp.", "Universal Plug and Play", "", false }, + { "_utest._tcp.", "uTest", "", false }, + { "_vue4rendercow._tcp", "VueProRenderCow", "", false }, + { "_webdav._tcp.", "WebDAV", "webdav://", false }, + { "_whamb._tcp.", "Whamb", "", false }, + { "_workstation._tcp", "Macintosh Manager", "", false }, + { "_ws._tcp", "Web Services", "", false }, + { "_xserveraid._tcp.", "Xserve RAID", "xsr://", false }, + { "_xsync._tcp.", "Xserve RAID Synchronization", "", false }, + + { "", "", "", false }, + + // Unofficial and invalid service types that will be phased out: + + { "_clipboardsharing._tcp.", "ClipboardSharing", "", false }, + { "_MacOSXDupSuppress._tcp.", "Mac OS X Duplicate Suppression", "", false }, + { "_netmonitorserver._tcp.", "Net Monitor Server", "", false }, + { "_networkclipboard._tcp.", "Network Clipboard", "", false }, + { "_slimdevices_slimp3_cli._tcp.", "SliMP3 Server Command-Line Interface", "", false }, + { "_slimdevices_slimp3_http._tcp.", "SliMP3 Server Web Interface", "", false }, + { "_tieducationalhandhelddevice._tcp.", "TI Connect Manager", "", false }, + { "_tivo_servemedia._tcp.", "TiVo", "", false }, + + { NULL, NULL, NULL, false }, +}; + +#if 0 +#pragma mark == Structures == +#endif + +//=========================================================================================================================== +// Structures +//=========================================================================================================================== + +struct DomainEventInfo +{ + DNSBrowserEventType eventType; + CString domain; + DNSNetworkAddress ifIP; +}; + +struct ServiceEventInfo +{ + DNSBrowserEventType eventType; + std::string name; + std::string type; + std::string domain; + DNSNetworkAddress ifIP; +}; + +#if 0 +#pragma mark == Prototypes == +#endif + +//=========================================================================================================================== +// Prototypes +//=========================================================================================================================== + +static void + BrowserCallBack( + void * inContext, + DNSBrowserRef inRef, + DNSStatus inStatusCode, + const DNSBrowserEvent * inEvent ); + +static char * DNSNetworkAddressToString( const DNSNetworkAddress *inAddr, char *outString ); + +static DWORD UTF8StringToStringObject( const char *inUTF8, CString &inObject ); +static DWORD StringObjectToUTF8String( CString &inObject, std::string &outUTF8 ); + +#if 0 +#pragma mark == Message Map == +#endif + +//=========================================================================================================================== +// Message Map +//=========================================================================================================================== + +BEGIN_MESSAGE_MAP(ChooserDialog, CDialog) + //{{AFX_MSG_MAP(ChooserDialog) + ON_WM_SYSCOMMAND() + ON_NOTIFY(LVN_ITEMCHANGED, IDC_DOMAIN_LIST, OnDomainListChanged) + ON_NOTIFY(LVN_ITEMCHANGED, IDC_SERVICE_LIST, OnServiceListChanged) + ON_NOTIFY(LVN_ITEMCHANGED, IDC_CHOOSER_LIST, OnChooserListChanged) + ON_NOTIFY(NM_DBLCLK, IDC_CHOOSER_LIST, OnChooserListDoubleClick) + ON_COMMAND(ID_HELP_ABOUT, OnAbout) + ON_WM_INITMENUPOPUP() + ON_WM_ACTIVATE() + ON_COMMAND(ID_FILE_CLOSE, OnFileClose) + ON_COMMAND(ID_FILE_EXIT, OnExit) + ON_WM_CLOSE() + ON_WM_NCDESTROY() + //}}AFX_MSG_MAP + ON_MESSAGE( WM_USER_DOMAIN_ADD, OnDomainAdd ) + ON_MESSAGE( WM_USER_DOMAIN_REMOVE, OnDomainRemove ) + ON_MESSAGE( WM_USER_SERVICE_ADD, OnServiceAdd ) + ON_MESSAGE( WM_USER_SERVICE_REMOVE, OnServiceRemove ) + ON_MESSAGE( WM_USER_RESOLVE, OnResolve ) +END_MESSAGE_MAP() + +#if 0 +#pragma mark == Routines == +#endif + +//=========================================================================================================================== +// ChooserDialog +//=========================================================================================================================== + +ChooserDialog::ChooserDialog( CWnd *inParent ) + : CDialog( ChooserDialog::IDD, inParent) +{ + //{{AFX_DATA_INIT(ChooserDialog) + // Note: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + + // Load menu accelerator table. + + mMenuAcceleratorTable = ::LoadAccelerators( AfxGetInstanceHandle(), MAKEINTRESOURCE( IDR_CHOOSER_DIALOG_MENU_ACCELERATORS ) ); + assert( mMenuAcceleratorTable ); + + mBrowser = NULL; + mIsServiceBrowsing = false; +} + +//=========================================================================================================================== +// ~ChooserDialog +//=========================================================================================================================== + +ChooserDialog::~ChooserDialog( void ) +{ + if( mBrowser ) + { + DNSStatus err; + + err = DNSBrowserRelease( mBrowser, 0 ); + assert( err == kDNSNoErr ); + } +} + +//=========================================================================================================================== +// DoDataExchange +//=========================================================================================================================== + +void ChooserDialog::DoDataExchange( CDataExchange *pDX ) +{ + CDialog::DoDataExchange(pDX); + + //{{AFX_DATA_MAP(ChooserDialog) + DDX_Control(pDX, IDC_SERVICE_LIST, mServiceList); + DDX_Control(pDX, IDC_DOMAIN_LIST, mDomainList); + DDX_Control(pDX, IDC_CHOOSER_LIST, mChooserList); + //}}AFX_DATA_MAP +} + +//=========================================================================================================================== +// OnInitDialog +//=========================================================================================================================== + +BOOL ChooserDialog::OnInitDialog( void ) +{ + HICON icon; + BOOL result; + CString tempString; + DNSStatus err; + + // Initialize our parent. + + CDialog::OnInitDialog(); + + // Set up the window icon. + + icon = AfxGetApp()->LoadIcon( IDR_MAIN_ICON ); + assert( icon ); + if( icon ) + { + SetIcon( icon, TRUE ); // Set big icon + SetIcon( icon, FALSE ); // Set small icon + } + + // Set up the Domain List. + + result = tempString.LoadString( IDS_CHOOSER_DOMAIN_COLUMN_NAME ); + assert( result ); + mDomainList.InsertColumn( 0, tempString, LVCFMT_LEFT, kDomainListDefaultDomainColumnWidth ); + + // Set up the Service List. + + result = tempString.LoadString( IDS_CHOOSER_SERVICE_COLUMN_TYPE ); + assert( result ); + mServiceList.InsertColumn( 0, tempString, LVCFMT_LEFT, kServiceListDefaultServiceColumnTypeWidth ); + + result = tempString.LoadString( IDS_CHOOSER_SERVICE_COLUMN_DESC ); + assert( result ); + mServiceList.InsertColumn( 1, tempString, LVCFMT_LEFT, kServiceListDefaultServiceColumnDescWidth ); + + PopulateServicesList(); + + // Set up the Chooser List. + + result = tempString.LoadString( IDS_CHOOSER_CHOOSER_NAME_COLUMN_NAME ); + assert( result ); + mChooserList.InsertColumn( 0, tempString, LVCFMT_LEFT, kChooserListDefaultNameColumnWidth ); + + result = tempString.LoadString( IDS_CHOOSER_CHOOSER_IP_COLUMN_NAME ); + assert( result ); + mChooserList.InsertColumn( 1, tempString, LVCFMT_LEFT, kChooserListDefaultIPColumnWidth ); + + // Set up the other controls. + + UpdateInfoDisplay(); + + // Start browsing for domains. + + err = DNSBrowserCreate( 0, BrowserCallBack, this, &mBrowser ); + assert( err == kDNSNoErr ); + + err = DNSBrowserStartDomainSearch( mBrowser, 0 ); + assert( err == kDNSNoErr ); + + return( true ); +} + +//=========================================================================================================================== +// OnFileClose +//=========================================================================================================================== + +void ChooserDialog::OnFileClose() +{ + OnClose(); +} + +//=========================================================================================================================== +// OnActivate +//=========================================================================================================================== + +void ChooserDialog::OnActivate( UINT nState, CWnd* pWndOther, BOOL bMinimized ) +{ + // Always make the active window the "main" window so modal dialogs work better and the app quits after closing + // the last window. + + gApp.m_pMainWnd = this; + + CDialog::OnActivate(nState, pWndOther, bMinimized); +} + +//=========================================================================================================================== +// PostNcDestroy +//=========================================================================================================================== + +void ChooserDialog::PostNcDestroy() +{ + // Call the base class to do the normal cleanup. + + delete this; +} + +//=========================================================================================================================== +// PreTranslateMessage +//=========================================================================================================================== + +BOOL ChooserDialog::PreTranslateMessage(MSG* pMsg) +{ + BOOL result; + + result = false; + assert( mMenuAcceleratorTable ); + if( mMenuAcceleratorTable ) + { + result = ::TranslateAccelerator( m_hWnd, mMenuAcceleratorTable, pMsg ); + } + if( !result ) + { + result = CDialog::PreTranslateMessage( pMsg ); + } + return( result ); +} + +//=========================================================================================================================== +// OnInitMenuPopup +//=========================================================================================================================== + +void ChooserDialog::OnInitMenuPopup( CMenu *pPopupMenu, UINT nIndex, BOOL bSysMenu ) +{ + CDialog::OnInitMenuPopup( pPopupMenu, nIndex, bSysMenu ); + + switch( nIndex ) + { + case kChooserMenuIndexFile: + break; + + case kChooserMenuIndexHelp: + break; + + default: + break; + } +} + +//=========================================================================================================================== +// OnExit +//=========================================================================================================================== + +void ChooserDialog::OnExit() +{ + OnClose(); +} + +//=========================================================================================================================== +// OnAbout +//=========================================================================================================================== + +void ChooserDialog::OnAbout() +{ + AboutDialog dialog; + + dialog.DoModal(); +} + +//=========================================================================================================================== +// OnSysCommand +//=========================================================================================================================== + +void ChooserDialog::OnSysCommand( UINT inID, LPARAM inParam ) +{ + CDialog::OnSysCommand( inID, inParam ); +} + +//=========================================================================================================================== +// OnClose +//=========================================================================================================================== + +void ChooserDialog::OnClose() +{ + StopBrowsing(); + + gApp.m_pMainWnd = this; + DestroyWindow(); +} + +//=========================================================================================================================== +// OnNcDestroy +//=========================================================================================================================== + +void ChooserDialog::OnNcDestroy() +{ + gApp.m_pMainWnd = this; + + CDialog::OnNcDestroy(); +} + +//=========================================================================================================================== +// OnDomainListChanged +//=========================================================================================================================== + +void ChooserDialog::OnDomainListChanged( NMHDR *pNMHDR, LRESULT *pResult ) +{ + UNUSED_ALWAYS( pNMHDR ); + + // Domain list changes have similar effects to service list changes so reuse that code path by calling it here. + + OnServiceListChanged( NULL, NULL ); + + *pResult = 0; +} + +//=========================================================================================================================== +// OnServiceListChanged +//=========================================================================================================================== + +void ChooserDialog::OnServiceListChanged( NMHDR *pNMHDR, LRESULT *pResult ) +{ + int selectedType; + int selectedDomain; + + UNUSED_ALWAYS( pNMHDR ); + + // Stop any existing service search. + + StopBrowsing(); + + // If a domain and service type are selected, start searching for the service type on the domain. + + selectedType = mServiceList.GetNextItem( -1, LVNI_SELECTED ); + selectedDomain = mDomainList.GetNextItem( -1, LVNI_SELECTED ); + + if( ( selectedType >= 0 ) && ( selectedDomain >= 0 ) ) + { + CString s; + std::string utf8; + const char * type; + + s = mDomainList.GetItemText( selectedDomain, 0 ); + StringObjectToUTF8String( s, utf8 ); + type = mServiceTypes[ selectedType ].serviceType.c_str(); + if( *type != '\0' ) + { + StartBrowsing( type, utf8.c_str() ); + } + } + + if( pResult ) + { + *pResult = 0; + } +} + +//=========================================================================================================================== +// OnChooserListChanged +//=========================================================================================================================== + +void ChooserDialog::OnChooserListChanged( NMHDR *pNMHDR, LRESULT *pResult ) +{ + UNUSED_ALWAYS( pNMHDR ); + + UpdateInfoDisplay(); + *pResult = 0; +} + +//=========================================================================================================================== +// OnChooserListDoubleClick +//=========================================================================================================================== + +void ChooserDialog::OnChooserListDoubleClick( NMHDR *pNMHDR, LRESULT *pResult ) +{ + int selectedItem; + + UNUSED_ALWAYS( pNMHDR ); + + // Display the service instance if it is selected. Otherwise, clear all the info. + + selectedItem = mChooserList.GetNextItem( -1, LVNI_SELECTED ); + if( selectedItem >= 0 ) + { + ServiceInstanceInfo * p; + CString url; + const KnownServiceEntry * service; + + assert( selectedItem < (int) mServiceInstances.size() ); + p = &mServiceInstances[ selectedItem ]; + + // Search for a known service type entry that matches. + + for( service = kKnownServiceTable; service->serviceType; ++service ) + { + if( p->type == service->serviceType ) + { + break; + } + } + if( service->serviceType ) + { + const char * text; + + // Create a URL representing the service instance. + + if( strcmp( service->serviceType, "_smb._tcp." ) == 0 ) + { + // Special case for SMB (no port number). + + url.Format( TEXT( "%s%s/" ), service->urlScheme, (const char *) p->ip.c_str() ); + } + else if( strcmp( service->serviceType, "_ftp._tcp." ) == 0 ) + { + // Special case for FTP to get login info. + + LoginDialog dialog; + CString username; + CString password; + + if( !dialog.GetLogin( username, password ) ) + { + goto exit; + } + + // Build URL in the following format: + // + // ftp://[username[:password]@]<ip> + + url += service->urlScheme; + if( username.GetLength() > 0 ) + { + url += username; + if( password.GetLength() > 0 ) + { + url += ':'; + url += password; + } + url += '@'; + } + url += p->ip.c_str(); + } + else if( strcmp( service->serviceType, "_http._tcp." ) == 0 ) + { + // Special case for HTTP to exclude "path=" if present. + + text = service->useText ? p->text.c_str() : ""; + if( strncmp( text, "path=", 5 ) == 0 ) + { + text += 5; + } + if( *text != '/' ) + { + url.Format( TEXT( "%s%s/%s" ), service->urlScheme, (const char *) p->ip.c_str(), text ); + } + else + { + url.Format( TEXT( "%s%s%s" ), service->urlScheme, (const char *) p->ip.c_str(), text ); + } + } + else + { + text = service->useText ? p->text.c_str() : ""; + url.Format( TEXT( "%s%s/%s" ), service->urlScheme, (const char *) p->ip.c_str(), text ); + } + + // Let the system open the URL in the correct app. + + { + CWaitCursor waitCursor; + + ShellExecute( NULL, TEXT( "open" ), url, TEXT( "" ), TEXT( "c:\\" ), SW_SHOWNORMAL ); + } + } + } + +exit: + *pResult = 0; +} + +//=========================================================================================================================== +// OnCancel +//=========================================================================================================================== + +void ChooserDialog::OnCancel() +{ + // Do nothing. +} + +//=========================================================================================================================== +// PopulateServicesList +//=========================================================================================================================== + +void ChooserDialog::PopulateServicesList( void ) +{ + ServiceTypeVector::iterator i; + CString type; + CString desc; + std::string tmp; + + // Add a fixed list of known services. + + if( mServiceTypes.empty() ) + { + const KnownServiceEntry * service; + + for( service = kKnownServiceTable; service->serviceType; ++service ) + { + ServiceTypeInfo info; + + info.serviceType = service->serviceType; + info.description = service->description; + info.urlScheme = service->urlScheme; + mServiceTypes.push_back( info ); + } + } + + // Add each service to the list. + + for( i = mServiceTypes.begin(); i != mServiceTypes.end(); ++i ) + { + const char * p; + const char * q; + + p = ( *i ).serviceType.c_str(); + if( *p == '_' ) ++p; // Skip leading '_'. + q = strchr( p, '.' ); // Find first '.'. + if( q ) tmp.assign( p, (size_t)( q - p ) ); // Use only up to the first '.'. + else tmp.assign( p ); // No '.' so use the entire string. + UTF8StringToStringObject( tmp.c_str(), type ); + UTF8StringToStringObject( ( *i ).description.c_str(), desc ); + + int n; + + n = mServiceList.GetItemCount(); + mServiceList.InsertItem( n, type ); + mServiceList.SetItemText( n, 1, desc ); + } + + // Select the first service type by default. + + if( !mServiceTypes.empty() ) + { + mServiceList.SetItemState( 0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED ); + } +} + +//=========================================================================================================================== +// UpdateInfoDisplay +//=========================================================================================================================== + +void ChooserDialog::UpdateInfoDisplay( void ) +{ + int selectedItem; + std::string name; + CString s; + std::string ip; + std::string ifIP; + std::string text; + std::string textNewLines; + std::string hostName; + CWnd * item; + std::string::iterator i; + + // Display the service instance if it is selected. Otherwise, clear all the info. + + selectedItem = mChooserList.GetNextItem( -1, LVNI_SELECTED ); + if( selectedItem >= 0 ) + { + ServiceInstanceInfo * p; + + assert( selectedItem < (int) mServiceInstances.size() ); + p = &mServiceInstances[ selectedItem ]; + + name = p->name; + ip = p->ip; + ifIP = p->ifIP; + text = p->text; + hostName = p->hostName; + + // Sync up the list items with the actual data (IP address may change). + + UTF8StringToStringObject( ip.c_str(), s ); + mChooserList.SetItemText( selectedItem, 1, s ); + } + + // Name + + item = (CWnd *) this->GetDlgItem( IDC_INFO_NAME_TEXT ); + assert( item ); + UTF8StringToStringObject( name.c_str(), s ); + item->SetWindowText( s ); + + // IP + + item = (CWnd *) this->GetDlgItem( IDC_INFO_IP_TEXT ); + assert( item ); + UTF8StringToStringObject( ip.c_str(), s ); + item->SetWindowText( s ); + + // Interface + + item = (CWnd *) this->GetDlgItem( IDC_INFO_INTERFACE_TEXT ); + assert( item ); + UTF8StringToStringObject( ifIP.c_str(), s ); + item->SetWindowText( s ); + + + item = (CWnd *) this->GetDlgItem( IDC_INFO_HOST_NAME_TEXT ); + assert( item ); + UTF8StringToStringObject( hostName.c_str(), s ); + item->SetWindowText( s ); + + // Text + + item = (CWnd *) this->GetDlgItem( IDC_INFO_TEXT_TEXT ); + assert( item ); + for( i = text.begin(); i != text.end(); ++i ) + { + if( *i == '\1' ) + { + textNewLines += "\r\n"; + } + else + { + textNewLines += *i; + } + } + UTF8StringToStringObject( textNewLines.c_str(), s ); + item->SetWindowText( s ); +} + +#if 0 +#pragma mark - +#endif + +//=========================================================================================================================== +// OnDomainAdd +//=========================================================================================================================== + +LONG ChooserDialog::OnDomainAdd( WPARAM inWParam, LPARAM inLParam ) +{ + DomainEventInfo * p; + std::auto_ptr < DomainEventInfo > pAutoPtr; + int n; + int i; + CString domain; + CString s; + bool found; + + UNUSED_ALWAYS( inWParam ); + + assert( inLParam ); + p = reinterpret_cast <DomainEventInfo *> ( inLParam ); + pAutoPtr.reset( p ); + + // Search to see if we already know about this domain. If not, add it to the list. + + found = false; + domain = p->domain; + n = mDomainList.GetItemCount(); + for( i = 0; i < n; ++i ) + { + s = mDomainList.GetItemText( i, 0 ); + if( s == domain ) + { + found = true; + break; + } + } + if( !found ) + { + int selectedItem; + + mDomainList.InsertItem( n, domain ); + + // If no domains are selected and the domain being added is a default domain, select it. + + selectedItem = mDomainList.GetNextItem( -1, LVNI_SELECTED ); + if( ( selectedItem < 0 ) && ( p->eventType == kDNSBrowserEventTypeAddDefaultDomain ) ) + { + mDomainList.SetItemState( n, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED ); + } + } + return( 0 ); +} + +//=========================================================================================================================== +// OnDomainRemove +//=========================================================================================================================== + +LONG ChooserDialog::OnDomainRemove( WPARAM inWParam, LPARAM inLParam ) +{ + DomainEventInfo * p; + std::auto_ptr < DomainEventInfo > pAutoPtr; + int n; + int i; + CString domain; + CString s; + bool found; + + UNUSED_ALWAYS( inWParam ); + + assert( inLParam ); + p = reinterpret_cast <DomainEventInfo *> ( inLParam ); + pAutoPtr.reset( p ); + + // Search to see if we know about this domain. If so, remove it from the list. + + found = false; + domain = p->domain; + n = mDomainList.GetItemCount(); + for( i = 0; i < n; ++i ) + { + s = mDomainList.GetItemText( i, 0 ); + if( s == domain ) + { + found = true; + break; + } + } + if( found ) + { + mDomainList.DeleteItem( i ); + } + return( 0 ); +} + +//=========================================================================================================================== +// OnServiceAdd +//=========================================================================================================================== + +LONG ChooserDialog::OnServiceAdd( WPARAM inWParam, LPARAM inLParam ) +{ + ServiceEventInfo * p; + std::auto_ptr < ServiceEventInfo > pAutoPtr; + + UNUSED_ALWAYS( inWParam ); + + assert( inLParam ); + p = reinterpret_cast <ServiceEventInfo *> ( inLParam ); + pAutoPtr.reset( p ); + + return( 0 ); +} + +//=========================================================================================================================== +// OnServiceRemove +//=========================================================================================================================== + +LONG ChooserDialog::OnServiceRemove( WPARAM inWParam, LPARAM inLParam ) +{ + ServiceEventInfo * p; + std::auto_ptr < ServiceEventInfo > pAutoPtr; + bool found; + int n; + int i; + + UNUSED_ALWAYS( inWParam ); + + assert( inLParam ); + p = reinterpret_cast <ServiceEventInfo *> ( inLParam ); + pAutoPtr.reset( p ); + + // Search to see if we know about this service instance. If so, remove it from the list. + + found = false; + n = (int) mServiceInstances.size(); + for( i = 0; i < n; ++i ) + { + ServiceInstanceInfo * q; + + // If the name, type, domain, and interface match, treat it as the same service instance. + + q = &mServiceInstances[ i ]; + if( ( p->name == q->name ) && + ( p->type == q->type ) && + ( p->domain == q->domain ) ) + { + found = true; + break; + } + } + if( found ) + { + mChooserList.DeleteItem( i ); + assert( i < (int) mServiceInstances.size() ); + mServiceInstances.erase( mServiceInstances.begin() + i ); + } + return( 0 ); +} + +//=========================================================================================================================== +// OnResolve +//=========================================================================================================================== + +LONG ChooserDialog::OnResolve( WPARAM inWParam, LPARAM inLParam ) +{ + ServiceInstanceInfo * p; + std::auto_ptr < ServiceInstanceInfo > pAutoPtr; + int selectedType; + int n; + int i; + bool found; + + UNUSED_ALWAYS( inWParam ); + + assert( inLParam ); + p = reinterpret_cast <ServiceInstanceInfo *> ( inLParam ); + pAutoPtr.reset( p ); + + // Make sure it is for an item of the correct type. This handles any resolves that may have been queued up. + + selectedType = mServiceList.GetNextItem( -1, LVNI_SELECTED ); + assert( selectedType >= 0 ); + if( selectedType >= 0 ) + { + assert( selectedType <= (int) mServiceTypes.size() ); + if( p->type != mServiceTypes[ selectedType ].serviceType ) + { + goto exit; + } + } + + // Search to see if we know about this service instance. If so, update its info. Otherwise, add it to the list. + + found = false; + n = (int) mServiceInstances.size(); + for( i = 0; i < n; ++i ) + { + ServiceInstanceInfo * q; + + // If the name, type, domain, and interface matches, treat it as the same service instance. + + q = &mServiceInstances[ i ]; + if( ( p->name == q->name ) && + ( p->type == q->type ) && + ( p->domain == q->domain ) && + ( p->ifIP == q->ifIP ) ) + { + found = true; + break; + } + } + if( found ) + { + mServiceInstances[ i ] = *p; + } + else + { + CString s; + + mServiceInstances.push_back( *p ); + UTF8StringToStringObject( p->name.c_str(), s ); + mChooserList.InsertItem( n, s ); + + UTF8StringToStringObject( p->ip.c_str(), s ); + mChooserList.SetItemText( n, 1, s ); + + // If this is the only item, select it. + + if( n == 0 ) + { + mChooserList.SetItemState( n, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED ); + } + } + UpdateInfoDisplay(); + +exit: + return( 0 ); +} + +//=========================================================================================================================== +// StartBrowsing +//=========================================================================================================================== + +void ChooserDialog::StartBrowsing( const char *inType, const char *inDomain ) +{ + DNSStatus err; + + assert( mServiceInstances.empty() ); + assert( mChooserList.GetItemCount() == 0 ); + assert( !mIsServiceBrowsing ); + + mChooserList.DeleteAllItems(); + mServiceInstances.clear(); + + mIsServiceBrowsing = true; + err = DNSBrowserStartServiceSearch( mBrowser, kDNSBrowserFlagAutoResolve, inType, inDomain ); + assert( err == kDNSNoErr ); +} + +//=========================================================================================================================== +// StopBrowsing +//=========================================================================================================================== + +void ChooserDialog::StopBrowsing( void ) +{ + // If searching, stop. + + if( mIsServiceBrowsing ) + { + DNSStatus err; + + mIsServiceBrowsing = false; + err = DNSBrowserStopServiceSearch( mBrowser, 0 ); + assert( err == kDNSNoErr ); + } + + // Remove all service instances. + + mChooserList.DeleteAllItems(); + assert( mChooserList.GetItemCount() == 0 ); + mServiceInstances.clear(); + assert( mServiceInstances.empty() ); + UpdateInfoDisplay(); +} + +#if 0 +#pragma mark - +#endif + +//=========================================================================================================================== +// BrowserCallBack +//=========================================================================================================================== + +static void + BrowserCallBack( + void * inContext, + DNSBrowserRef inRef, + DNSStatus inStatusCode, + const DNSBrowserEvent * inEvent ) +{ + ChooserDialog * dialog; + UINT message; + BOOL posted; + + UNUSED_ALWAYS( inStatusCode ); + UNUSED_ALWAYS( inRef ); + + // Check parameters. + + assert( inContext ); + dialog = reinterpret_cast <ChooserDialog *> ( inContext ); + + try + { + switch( inEvent->type ) + { + case kDNSBrowserEventTypeRelease: + break; + + // Domains + + case kDNSBrowserEventTypeAddDomain: + case kDNSBrowserEventTypeAddDefaultDomain: + case kDNSBrowserEventTypeRemoveDomain: + { + DomainEventInfo * domain; + std::auto_ptr < DomainEventInfo > domainAutoPtr; + + domain = new DomainEventInfo; + domainAutoPtr.reset( domain ); + + domain->eventType = inEvent->type; + domain->domain = inEvent->data.addDomain.domain; + domain->ifIP = inEvent->data.addDomain.interfaceIP; + + message = ( inEvent->type == kDNSBrowserEventTypeRemoveDomain ) ? WM_USER_DOMAIN_REMOVE : WM_USER_DOMAIN_ADD; + posted = ::PostMessage( dialog->GetSafeHwnd(), message, 0, (LPARAM) domain ); + assert( posted ); + if( posted ) + { + domainAutoPtr.release(); + } + break; + } + + // Services + + case kDNSBrowserEventTypeAddService: + case kDNSBrowserEventTypeRemoveService: + { + ServiceEventInfo * service; + std::auto_ptr < ServiceEventInfo > serviceAutoPtr; + + service = new ServiceEventInfo; + serviceAutoPtr.reset( service ); + + service->eventType = inEvent->type; + service->name = inEvent->data.addService.name; + service->type = inEvent->data.addService.type; + service->domain = inEvent->data.addService.domain; + service->ifIP = inEvent->data.addService.interfaceIP; + + message = ( inEvent->type == kDNSBrowserEventTypeAddService ) ? WM_USER_SERVICE_ADD : WM_USER_SERVICE_REMOVE; + posted = ::PostMessage( dialog->GetSafeHwnd(), message, 0, (LPARAM) service ); + assert( posted ); + if( posted ) + { + serviceAutoPtr.release(); + } + break; + } + + // Resolves + + case kDNSBrowserEventTypeResolved: + if( inEvent->data.resolved->address.addressType == kDNSNetworkAddressTypeIPv4 ) + { + ServiceInstanceInfo * serviceInstance; + std::auto_ptr < ServiceInstanceInfo > serviceInstanceAutoPtr; + char s[ 32 ]; + + serviceInstance = new ServiceInstanceInfo; + serviceInstanceAutoPtr.reset( serviceInstance ); + + serviceInstance->name = inEvent->data.resolved->name; + serviceInstance->type = inEvent->data.resolved->type; + serviceInstance->domain = inEvent->data.resolved->domain; + serviceInstance->ip = DNSNetworkAddressToString( &inEvent->data.resolved->address, s ); + serviceInstance->ifIP = DNSNetworkAddressToString( &inEvent->data.resolved->interfaceIP, s ); + serviceInstance->text = inEvent->data.resolved->textRecord; + serviceInstance->hostName = inEvent->data.resolved->hostName; + + posted = ::PostMessage( dialog->GetSafeHwnd(), WM_USER_RESOLVE, 0, (LPARAM) serviceInstance ); + assert( posted ); + if( posted ) + { + serviceInstanceAutoPtr.release(); + } + } + break; + + default: + break; + } + } + catch( ... ) + { + // Don't let exceptions escape. + } +} + +//=========================================================================================================================== +// DNSNetworkAddressToString +// +// Note: Currently only supports IPv4 network addresses. +//=========================================================================================================================== + +static char * DNSNetworkAddressToString( const DNSNetworkAddress *inAddr, char *outString ) +{ + const DNSUInt8 * p; + DNSUInt16 port; + + p = inAddr->u.ipv4.addr.v8; + port = ntohs( inAddr->u.ipv4.port.v16 ); + if( port != kDNSPortInvalid ) + { + sprintf( outString, "%u.%u.%u.%u:%u", p[ 0 ], p[ 1 ], p[ 2 ], p[ 3 ], port ); + } + else + { + sprintf( outString, "%u.%u.%u.%u", p[ 0 ], p[ 1 ], p[ 2 ], p[ 3 ] ); + } + return( outString ); +} + +//=========================================================================================================================== +// UTF8StringToStringObject +//=========================================================================================================================== + +static DWORD UTF8StringToStringObject( const char *inUTF8, CString &inObject ) +{ + DWORD err; + int n; + BSTR unicode; + + unicode = NULL; + + n = MultiByteToWideChar( CP_UTF8, 0, inUTF8, -1, NULL, 0 ); + if( n > 0 ) + { + unicode = (BSTR) malloc( (size_t)( n * sizeof( wchar_t ) ) ); + if( !unicode ) + { + err = ERROR_INSUFFICIENT_BUFFER; + goto exit; + } + + n = MultiByteToWideChar( CP_UTF8, 0, inUTF8, -1, unicode, n ); + try + { + inObject = unicode; + } + catch( ... ) + { + err = ERROR_NO_UNICODE_TRANSLATION; + goto exit; + } + } + else + { + inObject = ""; + } + err = 0; + +exit: + if( unicode ) + { + free( unicode ); + } + return( err ); +} + +//=========================================================================================================================== +// StringObjectToUTF8String +//=========================================================================================================================== + +static DWORD StringObjectToUTF8String( CString &inObject, std::string &outUTF8 ) +{ + DWORD err; + BSTR unicode; + int nUnicode; + int n; + char * utf8; + + unicode = NULL; + utf8 = NULL; + + nUnicode = inObject.GetLength(); + if( nUnicode > 0 ) + { + unicode = inObject.AllocSysString(); + n = WideCharToMultiByte( CP_UTF8, 0, unicode, nUnicode, NULL, 0, NULL, NULL ); + assert( n > 0 ); + + utf8 = (char *) malloc( (size_t) n ); + assert( utf8 ); + if( !utf8 ) { err = ERROR_INSUFFICIENT_BUFFER; goto exit; } + + n = WideCharToMultiByte( CP_UTF8, 0, unicode, nUnicode, utf8, n, NULL, NULL ); + assert( n > 0 ); + + try + { + outUTF8.assign( utf8, n ); + } + catch( ... ) + { + err = ERROR_NO_UNICODE_TRANSLATION; + goto exit; + } + } + else + { + outUTF8.clear(); + } + err = 0; + +exit: + if( unicode ) + { + SysFreeString( unicode ); + } + if( utf8 ) + { + free( utf8 ); + } + return( err ); +} diff --git a/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/ChooserDialog.h b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/ChooserDialog.h new file mode 100644 index 00000000..41fd8275 --- /dev/null +++ b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/ChooserDialog.h @@ -0,0 +1,131 @@ +/* -*- Mode: C; tab-width: 4 -*- + * + * Copyright (c) 2002-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. + */ + +#if !defined(AFX_CHOOSERDIALOG_H__AC258704_B307_4901_9F98_A0AC022FD8AC__INCLUDED_) +#define AFX_CHOOSERDIALOG_H__AC258704_B307_4901_9F98_A0AC022FD8AC__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include <string> +#include <vector> + +#include "afxcmn.h" + +#include "Resource.h" + +#include "DNSServices.h" + +//=========================================================================================================================== +// Structures +//=========================================================================================================================== + +struct ServiceInstanceInfo +{ + std::string name; + std::string type; + std::string domain; + std::string ip; + std::string text; + std::string ifIP; + std::string hostName; +}; + +struct ServiceTypeInfo +{ + std::string serviceType; + std::string description; + std::string urlScheme; +}; + +//=========================================================================================================================== +// ChooserDialog +//=========================================================================================================================== + +class ChooserDialog : public CDialog +{ + public: + + ChooserDialog(CWnd* pParent = NULL); + virtual ~ChooserDialog( void ); + + //{{AFX_DATA(ChooserDialog) + enum { IDD = IDD_CHOOSER_DIALOG }; + CListCtrl mServiceList; + CListCtrl mDomainList; + CListCtrl mChooserList; + //}}AFX_DATA + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(ChooserDialog) + public: + virtual BOOL PreTranslateMessage(MSG* pMsg); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void PostNcDestroy(); + //}}AFX_VIRTUAL + + protected: + + typedef std::vector < ServiceInstanceInfo > ServiceInstanceVector; + typedef std::vector < ServiceTypeInfo > ServiceTypeVector; + + HACCEL mMenuAcceleratorTable; + DNSBrowserRef mBrowser; + BOOL mIsServiceBrowsing; + ServiceInstanceVector mServiceInstances; + ServiceTypeVector mServiceTypes; + + public: + + void PopulateServicesList( void ); + void UpdateInfoDisplay( void ); + + void StartBrowsing( const char *inType, const char *inDomain ); + void StopBrowsing( void ); + + protected: + + //{{AFX_MSG(ChooserDialog) + virtual BOOL OnInitDialog(); + afx_msg void OnSysCommand(UINT nID, LPARAM lParam); + afx_msg void OnDomainListChanged(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnServiceListChanged(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnChooserListChanged(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnChooserListDoubleClick(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnAbout(); + afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu); + afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized); + afx_msg void OnFileClose(); + virtual void OnCancel(); + afx_msg void OnExit(); + afx_msg void OnClose(); + afx_msg void OnNcDestroy(); + //}}AFX_MSG + afx_msg LONG OnDomainAdd( WPARAM inWParam, LPARAM inLParam ); + afx_msg LONG OnDomainRemove( WPARAM inWParam, LPARAM inLParam ); + afx_msg LONG OnServiceAdd( WPARAM inWParam, LPARAM inLParam ); + afx_msg LONG OnServiceRemove( WPARAM inWParam, LPARAM inLParam ); + afx_msg LONG OnResolve( WPARAM inWParam, LPARAM inLParam ); + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_CHOOSERDIALOG_H__AC258704_B307_4901_9F98_A0AC022FD8AC__INCLUDED_) diff --git a/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/LoginDialog.cpp b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/LoginDialog.cpp new file mode 100644 index 00000000..b9a9ec93 --- /dev/null +++ b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/LoginDialog.cpp @@ -0,0 +1,109 @@ +/* -*- Mode: C; tab-width: 4 -*- + * + * Copyright (c) 2003-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 <assert.h> +#include <stdlib.h> + +#include "stdafx.h" + +#include "LoginDialog.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +//=========================================================================================================================== +// Message Map +//=========================================================================================================================== + +BEGIN_MESSAGE_MAP( LoginDialog, CDialog ) +END_MESSAGE_MAP() + +//=========================================================================================================================== +// LoginDialog +//=========================================================================================================================== + +LoginDialog::LoginDialog( CWnd *inParent ) + : CDialog( LoginDialog::IDD, inParent ) +{ + // +} + +//=========================================================================================================================== +// OnInitDialog +//=========================================================================================================================== + +BOOL LoginDialog::OnInitDialog( void ) +{ + CDialog::OnInitDialog(); + return( TRUE ); +} + +//=========================================================================================================================== +// DoDataExchange +//=========================================================================================================================== + +void LoginDialog::DoDataExchange( CDataExchange *inDX ) +{ + CDialog::DoDataExchange( inDX ); +} + +//=========================================================================================================================== +// OnOK +//=========================================================================================================================== + +void LoginDialog::OnOK( void ) +{ + const CWnd * control; + + // Username + + control = GetDlgItem( IDC_LOGIN_USERNAME_TEXT ); + assert( control ); + if( control ) + { + control->GetWindowText( mUsername ); + } + + // Password + + control = GetDlgItem( IDC_LOGIN_PASSWORD_TEXT ); + assert( control ); + if( control ) + { + control->GetWindowText( mPassword ); + } + + CDialog::OnOK(); +} + +//=========================================================================================================================== +// GetLogin +//=========================================================================================================================== + +BOOL LoginDialog::GetLogin( CString &outUsername, CString &outPassword ) +{ + if( DoModal() == IDOK ) + { + outUsername = mUsername; + outPassword = mPassword; + return( TRUE ); + } + return( FALSE ); +} diff --git a/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/LoginDialog.h b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/LoginDialog.h new file mode 100644 index 00000000..e53beb6b --- /dev/null +++ b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/LoginDialog.h @@ -0,0 +1,53 @@ +/* -*- Mode: C; tab-width: 4 -*- + * + * Copyright (c) 2003-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 __LOGIN_DIALOG__ +#define __LOGIN_DIALOG__ + +#pragma once + +#include "Resource.h" + +//=========================================================================================================================== +// LoginDialog +//=========================================================================================================================== + +class LoginDialog : public CDialog +{ + protected: + + CString mUsername; + CString mPassword; + + public: + + enum { IDD = IDD_LOGIN }; + + LoginDialog( CWnd *inParent = NULL ); + + virtual BOOL GetLogin( CString &outUsername, CString &outPassword ); + + protected: + + virtual BOOL OnInitDialog( void ); + virtual void DoDataExchange( CDataExchange *inDX ); + virtual void OnOK( void ); + + DECLARE_MESSAGE_MAP() +}; + +#endif // __LOGIN_DIALOG__ diff --git a/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/StdAfx.cpp b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/StdAfx.cpp new file mode 100644 index 00000000..ae2ca2ec --- /dev/null +++ b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/StdAfx.cpp @@ -0,0 +1,18 @@ +/* -*- Mode: C; tab-width: 4 -*- + * + * Copyright (c) 2002-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/mDNSWindows/DNSServiceBrowser/Windows/Sources/StdAfx.h b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/StdAfx.h new file mode 100644 index 00000000..c62bd3ee --- /dev/null +++ b/mDNSResponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/StdAfx.h @@ -0,0 +1,48 @@ +/* -*- Mode: C; tab-width: 4 -*- + * + * Copyright (c) 2002-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. + */ + +#if !defined(AFX_STDAFX_H__424305D2_0A97_4AA0_B9B1_A7D90D18EBA0__INCLUDED_) +#define AFX_STDAFX_H__424305D2_0A97_4AA0_B9B1_A7D90D18EBA0__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#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 + +#include <afxwin.h> // MFC core and standard components +#include <afxext.h> // MFC extensions +#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 <winsock2.h> + +#include <stdlib.h> + +#include "DNSServices.h" + +#include "Application.h" + +#include "ChooserDialog.h" + +#endif // !defined(AFX_STDAFX_H__424305D2_0A97_4AA0_B9B1_A7D90D18EBA0__INCLUDED_) |