summaryrefslogtreecommitdiffstats
path: root/contrib/idn/idnkit-1.0-src/wsock
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/idn/idnkit-1.0-src/wsock')
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/README.txt665
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/README_j.txt717
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/common/checkdll.c242
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/common/convert.c180
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/common/dump.c118
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/common/encoding.c271
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/common/hook.c224
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/common/make.wnt102
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/common/printf.c138
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/common/wrapcommon.h109
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/config/idnconf.tcl1123
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/config/make.wnt58
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/make.wnt97
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock11/dlldef.h86
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock11/dllfunc.c212
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock11/dllload.c63
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock11/dllmain.c96
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock11/dllstub.c1541
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock11/make.wnt98
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock11/wsock32.def87
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock20/dlldef.h123
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock20/dllfunc.c592
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock20/dllload.c62
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock20/dllmain.c94
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock20/dllstub.c2168
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock20/make.wnt97
-rw-r--r--contrib/idn/idnkit-1.0-src/wsock/wsock20/ws2_32.def120
27 files changed, 9483 insertions, 0 deletions
diff --git a/contrib/idn/idnkit-1.0-src/wsock/README.txt b/contrib/idn/idnkit-1.0-src/wsock/README.txt
new file mode 100644
index 0000000..e7723b4
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/README.txt
@@ -0,0 +1,665 @@
+
+ idn wrapper - Client Side IDN Conversion Software for Windows
+
+ Copyright (c) 2000,2001,2002 Japan Network Information Center.
+ All rights reserved.
+
+ *** NOTICE ******************************************************
+ If you have installed mDN Wrapper (former version of idn wrapper)
+ on your system, you should unwrap all the programs before
+ installing idn wrapper.
+ *****************************************************************
+
+
+1. Introduction
+
+ For supporting internationalized domain names, each client
+ application should convert domain names (their encodings) to that
+ DNS server accepts. This requires applications to handle
+ internationalized domain names in its core, and it is the vendor's
+ responsibility to make their programs IDN-compatible.
+
+ Although there are ongoing efforts in IETF to standardize IDN
+ framework (architecture, encoding etc.) and several RFCs are
+ expected to be published soon as the result, not many applications
+ support IDN to this date.
+
+ So, there are needs for some helper application which makes legacy
+ applications IDN-aware. `runidn' in idnkit is one of such
+ solutions for Unix-like operating systems, and this software, `idn
+ wrapper' is the one for Windows.
+
+ On windows, name resolving request is passed to WINSOCK DLL. idn
+ wrapper replaces WINSOCK DLL with the one that can handle IDN,
+ which makes legacy windows applications compatible with IDN.
+
+2. Architecture
+
+2.1. Wrapper DLL
+
+ Wrapper DLL resides between application and original DLL. It
+ intercept application's calls to original DLL, and preforms some
+ additional processing on those calls.
+
+ +------------+ Call +------------+ Call +------------+
+ | |------->| |------->| |
+ |Application | |Wrapper DLL | |Original DLL|
+ | |<-------| |<-------| |
+ +------------+ Return +------------+ Return +------------+
+ additional
+ processing
+ here
+
+ DLL call from apllication is passed to wrapper DLL. Wrapper DLL
+ then performs some additional processing on that call, and then
+ calls original DLL. Also, result from original DLL will once passed
+ to wrapper DLL and wrapper does additional process on that result,
+ and finally result will passed to the application.
+
+ idn wrapper provides wrapper DLLs for WINSOCK,
+
+ WSOCK32.DLL WINSOCK V1.1
+ WS2_32.DLL WINSOCK V2.0
+
+ to resolve multi-lingual domain names.
+
+2.2. Wrapping APIs
+
+ idn wrapper performs additional processing on name resolving APIs in
+ WINSOCK, listed below.
+
+ both WINSOCK 1.1, WINSOCK 2.0
+
+ gethostbyaddr
+ gethostbyname
+ WSAAsyncGetHostByAddr
+ WSAAsyncGetHostByName
+
+ only in WINSOCK 2.0
+
+ getaddrinfo
+ freeaddrinfo
+ getnameinfo
+ WSALookupServiceBeginA
+ WSALookupServiceNextA
+ WSALookupServiceEnd
+
+ Some applications do not use these APIs to resolve domain names.
+ `nslookup' is one of those programs. `nslookup' builds and parse DNS
+ messages internally and does not use WINSOCK's name resolver APIs.
+ idn wrapper cannot make those programs IDN-aware.
+
+ NOTE:
+ WINSOCK 2.0 also contains WIDE-CHARACTER based name resolution
+ APIs,
+
+ WSALookupServiceBeginW
+ WSALookupServiceNextW
+
+ idn wrapper does not wrap these APIs. These APIs are used in
+ Microsoft's own internationalization framework. It is dangerous
+ to convert to another internationalization framework.
+
+2.3. Other APIs in WINSOCK
+
+ For other APIs in WINSOCK, idn wrapper does nothing, only calls
+ original DLL's entries.
+
+ idn wrapper copies original WINSOCK DLLs with renaming
+ as below, and forward requests to them.
+
+ wsock32.dll -> wsock32o.dll
+ ws2_32.dll -> ws2_32o.dll
+
+ Wrappper DLL will be installed with original DLL names. So after
+ installation of idn wrapper, WINSOCK DLLs should be
+
+ wsock32.dll idn wrapper for WINSOCK V1.1
+ ws2_32.dll idn wrapper for WINSOCK V2.0
+ wsock32o.dll Original WINSOCK V1.1 DLL
+ ws2_32o.dll Original WINSOCK V2.0 DLL
+
+2.4. Asynchronous API
+
+ Domain name conversion take place on
+
+ request to DNS
+
+ convert from local encoding to DNS compatible encoding
+
+ response from DNS
+
+ convert from DNS encoding to local encoding
+
+ For synchronous APIs, local to DNS conversion is done before calling
+ original API, and after return from original API, name should be
+ converted from DNS encoding to local encoding.
+
+ But WINSOCK having some asynchronous APIs, such as
+
+ WSAAsyncGetHostByAddr
+ WSAAsyncGetHostByName
+
+ In these APIs, completion is notified with windows message. To
+ perform DNS to local conversion, wrapper should hook target window
+ procedure to capture those completion messages.
+
+ So, if asynchronous API was called, idn wrapper set hook to target
+ window procedure (passed with API parameter). If hook found
+ notify message (also given with API parameter), then convert
+ resulting name (in DNS encoding) to local encoding.
+
+2.5. Installing Wrapper DLLs
+
+ WINSOCK DLLs are placed at Windows's system directory. To wrap
+ WINSOCK DLLs, one could do following sequence at system directory.
+
+ + Rename Original WINSOCK DLLs
+
+ ren wsock32.dll wsock32o.dll
+ ren ws2_32.dll ws2_32o.dll
+
+ + Install (copy in) Wrapper DLLs
+
+ copy somewhere\wsock32.dll wsock32.dll
+ copy somewhere\ws2_32.dll ws2_32.dll
+ copy another DLLs also
+
+ However, replacing DLLs in Window's system directory is very
+ dangerous:
+
+ a) If you re-install idn wrapper again, original WINSOCK DLLs
+ may be lost.
+
+ b) Some application or service pack will replace WINSOCK DLLs. It
+ may corrupt WINSOCK environment.
+
+ If these happen, at least networking does not work, and worse,
+ Windows never startup again.
+
+ So, idn wrapper usually does not wrap in the system directory, but wrap in
+ each indivisual application's directory.
+
+ In Windows, DLL will be searched in the following places:
+
+ Application's Load Directory
+ %SystemRoot%\System32
+ %SystemRoot%
+ Directories in PATH
+
+ and loaded & linked first found one. So if installed wrapper DLLs is
+ found on application's load directory, the application's call to
+ WINSOCK will wrapped.
+
+ But some applications or DLLs are binded to specific DLL, they do
+ not rely on above DLL's search path. For those applcaitons or DLLs,
+ idn wrapper (in standard installation) cannot wrap them.
+
+ NOTE: Netscape is one of those program. It cannot be wrapped if
+ installed to applications directory. Also WINSOCK DLLs are
+ also binded to related DLLs in system directory. On the
+ other hand, Internet Explore or Window Media Player relys on
+ standard DLL search path, and well wrapped with idn wrapper.
+
+2.6. At which point conversion applied
+
+ If windows supporting WINSOCK 2.0, there are DLLs one for 1.1 and
+ another for 2.0, and call to WINSOCK 1.1 will redirected to 2.0 DLL.
+
+ +------------+ Call +------------+ Call +------------+
+ | |------->| |------->| |
+ |Application | |WINSOCK 1.1 | |WINSOCK 2.0 |
+ | |<-------| |<-------| |
+ +------------+ Return +------------+ Return +------------+
+
+ In this case, calls to 1.1 and 2.0 are both passed to 2.0 DLL. So
+ conversion will done in WINSOCK 2.0 DLL side.
+
+ If windows only supports WINSOCK 1.1, there's 1.1 DLL only.
+
+ +------------+ Call +------------+
+ | |------->| |
+ |Application | |WINSOCK 1.1 |
+ | |<-------| |
+ +------------+ Return +------------+
+
+ In this case, conversion must done in 1.1 DLL.
+
+ If idn wrapper was installed on system directory, DLLs will work as
+ described above. But if wrapper was installed on application's
+ directory, call/return sequence changes. Original WINSOCK 1.1 DLL
+ in windows seems binded to specific WINSOCK 2.0 DLL, placed at
+ window's system diretory. So call from WINSOCK 1.1 to WINSOCK 2.0
+ will passed to original DLL (in system directory) and never passed
+ to wrapper DLL in application's directory. So in this case, both
+ 1.1 and 2.0 DLLs should coonvert domain name encodings.
+
+ These DLL binding is not documented. It may be change on OS
+ versions or DLL versions. So, mDn wrapper determines place of
+ conversion on registry value. With this registry value, idn
+ wrappper absolb OS/DLL variations.
+
+ Registry values for idn wrapper will placed under
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\IDN
+ HKEY_CURRENT_USER\SOFTWARE\JPNIC\IDN
+
+ Place of conversion is determined with registry value "Where",
+
+ Registry Value "Where" REG_DWORD
+
+ 0 both on WINSOCK 1.1 and WINSOCK 2.0
+ 1 if WINSOCK 2.0 exist, only in WINSOCK 2.0
+ otherwise, convert on WINSOCK 1.1
+ 2 only in WINSOCK 1.1
+ 3 only in WINSOCK 2.0
+
+ If you install idn wrapper into application's directory, use "0".
+ If you install idn wrapper into system directory, use "1". If there
+ are no "Where" value, idn wrapper uses "0" as default, it is suited
+ to installation into application's directory (default installation).
+
+2.7. Converting From/To
+
+ Wrapper DLL convert resolving domain name encoded with local code to
+ DNS server's encoding. Also, wrapper DLL convert resulting name (
+ encoded with DNS's encoding) back to local encoding.
+
+ There are several proposals for DNS encodings to handle multi-lingual
+ domain names. Wrapper DLL should be configured to convert to one of
+ those encodings. This DNS side encoding will specified with
+ registry. When installing idn wrapper, this registry will set to
+ some (yet undefined) DNS encoding.
+
+ Registry values for idn wrapper will placed under
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\IDN
+ HKEY_CURRENT_USER\SOFTWARE\JPNIC\IDN
+
+ DNS encoding name will given with registry value (REG_SZ) of "Encoding",
+ this name must be one of encoding names which 'libmdn' recognize.
+
+ Registry Value "Encoding" REG_SZ
+
+ Encoding name of DNS server accepts.
+
+ Local encodings (Windows Apllication Encodings) is generally
+ acquired from process's code page. 'iconv' library, used for idn
+ wrapper, generally accepts MS's codepage names.
+
+ Some windows apllication encode domain name with some specific multi-
+ lingual encoding. For example, if you configured IE to use UTF-8,
+ then domain names are encoded with UTF-8. UTF-8 is one of proposed
+ DNS encoding, but DNS server may expect another encoding.
+
+ For those cases, idn wrapper accept program specific encoding as
+ local encoding. These program specific local encoding should be
+ marked in registry.
+
+ Program specific registry setting will placed under
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\IDN\PerProg
+ HKEY_CURRENT_USER\SOFTWARE\JPNIC\IDN\PerProg
+
+ using program name (executable file name) as key. For example,
+ setting specific to Internet Explore, it executable name is
+ "IEXPLORE", will plcaed at
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\IDN\PerProg\IEXPLORE
+
+ Local encoding name will specified with registry value (REG_SZ) of
+ "Encoding". This name must be one of encoding names which '
+ recognize.libmdn'
+
+ Registry Value "Encoding" REG_SZ
+
+ Encoding name of application program encodes, if it is not
+ system's default encoding.
+
+3. Setup and Configuration
+
+ idn wrapper wraps WINSOCK DLL by placing wrapper (fake) DLLs in
+ the application's directory. For the installation, idn wrapper
+ comes with a setup program and a configuration program.
+
+ NOTE: You can also install idn wrapper DLLs in the Windows
+ system directory. But this installation is very dangerous
+ and may cause severe problems in your system.
+ You should try it at your own risk.
+
+3.1. Setup Program
+
+ To install idn wrapper, run "setup.exe". Setup program will do:
+
+ Installing Files
+
+ Copy idn wrapper files (DLL, Program EXE, etc) into diretory
+
+ "\Program Files\JPNIC\idn wrapper"
+
+ This directory may be changed on setup sequence.
+
+ Setting registry entries
+
+ Setup program will create keys and values under registry:
+
+ "HKEY_LOCAL_MACHINES\Software\JPNIC\IDN"
+
+ InstallDir REG_SZ "<installation directory>"
+ Pathname of the idn wrapper's installation directory.
+ The installer makes copies of the original WINSOCK DLLs
+ in that directory, which is referenced by the idn wrapper's
+ fake DLLs.
+
+ ConfFile REG_SZ "<installation directory>\idn.conf"
+ Name of the idnkit's configuration file, which defines
+ various parameter regarding multilingual domain name
+ handling. See the contents of the file for details.
+ This value can be changed with the Configuration Program
+ or the registry editor.
+
+ LogFile REG_SZ "<installation directory>\idn_wrapper.log"
+ Name of the idn wrapper's log file.
+ This value can be changed with the Configuration Program
+ or the registry editor.
+
+ LogLevel DWORD -1
+ Logging level. Default is -1, which indicates no logging
+ is made. This value can be changed with the Configuration
+ Program or the registry editor.
+
+ PerProg KEY
+
+ Under this key, idn wrapper set program specific values. idn
+ wrapper uses program's executable name as key, and put
+ values under that key.
+
+ PerProg\<progname>\Where REG_DWORD Encoding Position
+ PerProg\>progname>\Encoding REG_SZ Local Encoding Name
+
+ Configuration program set local encpoding name. "Where"
+ value is usually not required in standard installation. If
+ you installed idn wrapper in system directory, chanage
+ "Where" values to fit your environment.
+
+ Creating ICON
+
+ Setup program will create program icon for idn wrapper's
+ configuration program, and put it into "Start Menu". You can
+ start configuration program with it.
+
+3.2. Configuration Program
+
+ Configuration program is a tool for wrap specific program, or unwrap
+ programs. If you start "Configuration Program", you'll get window
+ like this.
+
+ +---+-------------------------------------------------+---+---+---+
+ | | idn wrapper - Configuration | _ | O | X |
+ +---+-------------------------------------------------+---+---+---+
+ | idn wrapper Configuration Program version X.X |
+ +-----------------------------------------------------------------+
+ | Wrapped Program +---------+ |
+ | +---------------------------------------------+---+ | Wrap.. | |
+ | | | A | +---------+ |
+ | | +---+ +---------+ |
+ | | | | | Unwrap..| |
+ | | | | +---------+ |
+ | | | | +---------+ |
+ | | | | |UnwrapAll| |
+ | | | | +---------+ |
+ | | | | +---------+ |
+ | | | | |RewrapAll| |
+ | | | | +---------+ |
+ | | | | +---------+ |
+ | | | | | Log.. | |
+ | | | | +---------+ |
+ | | | | +---------+ |
+ | | +---+ |Advanced.| |
+ | | | V | +---------+ |
+ | +---+-------------------------------------+---+---+ +---------+ |
+ | | < | | > | | Exit | |
+ | +---+-------------------------------------+---+ +---------+ |
+ +-----------------------------------------------------------------+
+
+ Listbox contains list of current wrapped programs. Initially it is
+ empty.
+
+ To wrap a program, press button "wrap". You'll get following dialog.
+
+ +---+-------------------------------------------------+---+---+---+
+ | | idn wrapper - Wrap Executable | _ | O | X |
+ +---+-------------------------------------------------+---+---+---+
+ | +----------------------------------------+ +--------+ |
+ | Program: | | |Browse..| |
+ | +----------------------------------------+ +--------+ |
+ | +----------+ |
+ | Encoding: | | o Default o UTF-8 |
+ | +----------+ |
+ | [] Force local DLL reference |
+ +-----------------------------------------------------------------+
+ | +--------+ +--------+ |
+ | | Wrap | | Cancel | |
+ | +--------+ +--------+ |
+ +-----------------------------------------------------------------+
+
+ First, enter program (executable name with full path) or browse
+ wrapping exectable from file browser. Then set local encoding of
+ that program. Usually use "Default" as local encoding. If target
+ program uses internationalized encoding, then specify "UFT-8".
+
+ The "Force local DLL reference" button controls the DLL search
+ order of the program to be wrapped (Windows95 does not have this
+ capability, hence this button does not appear). If it is checked,
+ DLLs in the local directory (the directory which the executable
+ file is in) are always preferred, even if the executable specifies
+ otherwise. If you have problem with wrapping, checking this
+ button may solve the problem, but it is also possible that it
+ causes other problem.
+
+ Finally, put "wrap" button to wrap specified program with given
+ encoding. Wrapped program will be listed in listbox of the first
+ window.
+
+ When you install a new version of idn wrapper, you have to re-wrap
+ your programs in order to update DLLs used for wrapping. "Rewrap
+ all" button is provided for this purpose. Just press the button,
+ and all the currently wrapped programs will be re-wrapped.
+
+ To unwrap a program, press button "unwrap". You'll get following
+ confirmating dialog.
+
+ +---+-------------------------------------------------+---+---+---+
+ | | idn wrapper - Unwrap Executable | _ | O | X |
+ +---+-------------------------------------------------+---+---+---+
+ | +---------------------------------------------------+ |
+ | Program: | | |
+ | +---------------------------------------------------+ |
+ +-----------------------------------------------------------------+
+ | +--------+ +--------+ |
+ | | Unwrap | | Cancel | |
+ | +--------+ +--------+ |
+ +-----------------------------------------------------------------+
+
+ If you unwrap a program, the program will be vanished from listbox
+ of the first window.
+
+ Also "Unwrap all" button is provided to unwrap all the programs
+ that are currently wrapped.
+
+ To configure logging, press button "log". You'll get the following
+ dialog.
+
+ +---+-------------------------------------------------+---+---+---+
+ | | idn wrapper - Log Configuration | _ | O | X |
+ +---+-------------------------------------------------+---+---+---+
+ | Log Level: o None o Fatal o Error o Warning o Info o Trace |
+ | |
+ | +------------------------------------+ +---------+ |
+ | Log File:| | | Browse..| |
+ | +------------------------------------+ +---------+ |
+ | +------+ +--------+ |
+ |Log Operation: | View | | Delete | |
+ | +------+ +--------+ |
+ +-----------------------------------------------------------------+
+ | +--------+ +--------+ |
+ | | OK | | Cancel | |
+ | +--------+ +--------+ |
+ +-----------------------------------------------------------------+
+
+ Logging level can be selected from the followings.
+ None no logging at all
+ Fatal only records fatal errors
+ Error also records non-fatal errors
+ Warning also records warning mssages
+ Info also records informational messages
+ Trace also records trace information
+ Note that these levels are for log output from IDN library (idnkit.dll).
+ idn wrapper itself supports only off (None) and on (the rest).
+
+ Pathname of the log file can also be specified with this dialog.
+
+ You can view the current log file contents by pressing "View" button,
+ or delete it by "Delete" button.
+
+ Note that log level and log file configuration doesn't affect already
+ running processes.
+
+ Press "advanced" button to invoke the advanced configuration dialog.
+ This dialog is for advanced users and enables customization for
+ some basic parameters which normal users need not change, since
+ appropriate defaults are provided.
+
+ +---+-------------------------------------------------+---+---+---+
+ | | idn wrapper - Advanced Configuration | _ | O | X |
+ +---+-------------------------------------------------+---+---+---+
+ | IDN Wrapping Mode |
+ | o Wrap both WINSOCK 1.1 and WINSOCK 2.0 |
+ | o Wrap only WINSOCK 1.1 |
+ | o Wrap only WINSOCK 2.0 |
+ | o Wrap only WINSOCK 2.0 if it exists. |
+ | Otherwise wrap only WINSOCK 1.1 |
+ +-----------------------------------------------------------------+
+ | IDN Configuration |
+ | +--------------------------------+ +----------+ |
+ | Config File: | | | Browse.. | |
+ | +--------------------------------+ +----------+ |
+ | +------+ |
+ | | Edit | |
+ | +------+ |
+ +-----------------------------------------------------------------+
+ | +--------+ +--------+ |
+ | | OK | | Cancel | |
+ | +--------+ +--------+ |
+ +-----------------------------------------------------------------+
+
+ With the dialog users can do the following configuration.
+
+ Wrapping Mode
+ Customize wrapping mode. Normally the default item should be
+ appropriate. Changing it to other item may help when you
+ have problems.
+
+ IDN Configuration
+ Set the configuration file for multilingual domain name handling.
+ By pressing "Edit" button, you can edit then contents of the file.
+
+4. Limitations
+
+4.1. DLL Versions
+
+ Wrapper DLL is tightly coupled with specific DLL version, because
+ it must export all the entries including un-documented ones.
+ If WINSOCK DLL version changed, idn wrapper may not work correctly.
+
+ Current idn wrapper is tested on
+
+ Win2000 (WINSOCK 1.1 + 2.0)
+ WinME (WINSOCK 1.1 + 2.0)
+
+ But there are no assuarance for future versions of Windows.
+
+4.2. DNS, WINS, LMHOSTS
+
+ There are three name resolving methods in windows, DNS, WINS and
+ LMHOSTS. Using idn wrapper, domain name conversion will performed
+ on all of thoses methods. It may cause some trouble if windows
+ using WINS or LMHOSTS. We recommend use DNS oly if you want to use
+ idn wrapper.
+
+4.3. Converting Names other than Domain Name
+
+ In WINSOCK 2.0, there are generic name resolution APIs are
+ introduced.
+
+ WSALookupServiceBeginA
+ WSALookupServiceNextA
+ WSALookupServiceEnd
+
+ They are use mainly domain name conversion now, but not limited to
+ resolving domain name. idn wrapper hooks this API and convert
+ given name anyway. This causes some trouble if conversion name is
+ not domain name.
+
+4.4. Applications don't use these APIa
+
+ Some applications don't use these APIs to resolving domain names.
+ For example, 'nslookup' issue DNS request locally. For these
+ applications, idn wrapper does not work.
+
+4.5. Applications bound to specific WINSOCK DLL
+
+ Some applications are bound to specific DLL, not relying on
+ standard DLL search path. Netscape Communicator seems to be one of
+ such programs. idn wrapper in standard installation cannot wrap
+ such programs.
+
+ If you want to wrap those programs, you may use installation into
+ system directory. But this installation is very dangerous, for
+ it is possible that your system cannot boot again.
+
+5. Registry Setting - Summary
+
+5.1. Priority of Setting
+
+ Settings of idn wrapper is placed on registry
+
+ Software\JPNIC\IDN
+
+ under HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER. idn wrapper first
+ read HKEY_LOCAL_MACHINE, and if HKEY_CURRENT_USER exist, overwrite
+ with this one. Usually set HKEY_LOCAL_MACHINE only. But if you
+ need per user setting, then set HKEY_CURRENT_USER.
+
+ Note that the configuration program reads/writes only
+ HKEY_LOCAL_MACHINE.
+
+5.2. Registry Key
+
+ There's common settings and per program settings.
+
+_Common Settings
+
+ Software\JPNIC\IDN\InstallDir Installation directory
+ Software\JPNIC\IDN\Where Where to convert encoding
+ 0: both WINSOCK 1.1 and WINSOCK 2.0
+ 1: if WINSOCK 2.0 exist, convert at 2.0 DLL
+ if WINSOCK 1.1 only, convert at 1.1 DLL
+ 2: only in WINSOCK1.1
+ 3: only in WINSOCK2.0
+ Software\JPNIC\IDN\ConfFile idnkit Configuration File
+ Software\JPNIC\IDN\LogFile Log File
+ Software\JPNIC\IDN\LogLevel Log Level
+
+_Per Program Settings
+
+ Converting position and program's local encoding may be set per
+ program bases.
+
+ Software\JPNIC\IDN\PerProg\<name>\Where
+ Software\JPNIC\IDN\PerProg\<name>\Encoding
+
+ If not specified, the following values are assumed.
+
+ Where 0 (both 1.1 DLL and 2.0 DLL)
+ Encoding [process's code page]
diff --git a/contrib/idn/idnkit-1.0-src/wsock/README_j.txt b/contrib/idn/idnkit-1.0-src/wsock/README_j.txt
new file mode 100644
index 0000000..354f46c
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/README_j.txt
@@ -0,0 +1,717 @@
+
+ idn wrapper - Windows におけるクライアント側での IDN 変換ソフトウェア
+
+ Copyright (c) 2000,2001,2002 Japan Network Information Center.
+ All rights reserved.
+
+ *** 注意 **********************************************************
+ もしもすでに mDN Wrapper (idn wrapper の前身) がインストールされて
+ いるマシンに idn wrapper をインストールする場合には、インストール前
+ に、ラップされているすべてのプログラムをアンラップしてください。
+ *******************************************************************
+
+
+1. はじめに
+
+ Windows で国際化ドメイン名を扱えるようにするためには、Windows 上の
+ クライアントアプリケーションにおいて、解決しようとする名前のエンコー
+ ディングを、DNS サーバが受付ける形式のものに変換する必要があります。
+ これは、Windows 上のアプリケーションが、きちんと国際化ドメイン名を
+ 扱えるようになっていなければならない、ということであり、本来はそれ
+ ぞれのプログラムの作成者が行なうべきことです。
+
+ 現在 IETF にて国際化ドメイン名のフレームワークを標準化する努力が続
+ けられており、その結果として一連の RFC がもうすぐ発行されることに
+ なっていますが、それでも国際化ドメイン名に対応したアプリケーション
+ はまだまだ少ないのが現状です。
+
+ そこで、既存のアプリケーションを国際化ドメイン名に対応させるための
+ ヘルパーアプリケーションが必要になります。idnkit に含まれる runidn
+ コマンドは Unix 系の OS での一つの解決策ですし、Windows に対する解
+ 決策としてはここで説明する idn wrapper があります。
+
+ Windows において、多くの場合、ドメイン名解決の要求はWINSOCK DLL に
+ 渡されます。そこで、WINSOCK DLL を国際化ドメイン名対応のものに置き
+ 換えてやれば、既存のプログラムからでも国際化ドメイン名を使うことが
+ できるようになります。
+
+2. 実現方法
+
+2.1. ラッパーDLL
+
+ ラッパーDLL は、アプリケーションと元のDLL との間に割り込んで、アプリ
+ ケーションからのDLL の呼び出しを横取りして、本来のDLL とは異なった処
+ 理をさせるものです。
+
+ +------------+ Call +------------+ Call +------------+
+ | |------->| |------->| |
+ |Application | |Wrapper DLL | |Original DLL|
+ | |<-------| |<-------| |
+ +------------+ Return +------------+ Return +------------+
+ additional
+ processing
+ here
+
+ アプリケーションからのDLL の呼び出しはラッパー DLLに渡されます。ラッ
+ パー DLLはそこで、付加的な処理を行なって、元のDLL のエントリを呼び出
+ します。また、元のDLL の処理結果は一旦ラッパー DLLに返され、ここでも
+ 付加的な処理を行なって、最終的な結果がアプリケーションに返されること
+ になります。
+
+ idn wrapper では、WINSOCK DLLの
+
+ WSOCK32.DLL WINSOCK V1.1
+ WS2_32.DLL WINSOCK V2.0
+
+ に対するラッパーDLL を提供して、国際化ドメイン名の名前解決ができるよ
+ うにします。16ビット版のWINSOCK (WINSOCK.DLL) は対象外です。
+
+2.2. 処理対象のAPI
+
+ idn wrapper はWINSOCK の名前解決に関連したAPI についてのみ付加的な処
+ 理を行ないます。処理の対象となるWINSOCK APIは以下のものです。
+
+ WINSOCK 1.1, WINSOCK 2.0 の両方にあるもの
+
+ gethostbyaddr
+ gethostbyname
+ WSAAsyncGetHostByAddr
+ WSAAsyncGetHostByName
+
+ WINSOCK 2.0 だけにあるもの
+
+ WSALookupServiceBeginA
+ WSALookupServiceNextA
+ WSALookupServiceEnd
+
+ アプリケーションによっては、これらのAPI を使わないで独自にドメイン名
+ の解決を行なうものもあります。例えば、nslookupは、これらのAPI を使わ
+ ないで、内部で独自にDNS リクエストの生成、解釈を行なっています。当然
+ のことながら、これらのアプリケーションについては、idn wrapper では多
+ 言語化対応させることはできません。
+
+ 注:WINSOCK 2.0 には、WIDE CHARACTER ベースの名前解決のAPI として
+
+ WSALookupServiceBeginW
+ WSALookupServiceNextW
+
+ もありますが、これらについてはラップしません。これらのAPI はマ
+ イクロソフト仕様による国際化に対応したものですから、そのフレー
+ ムワーク上で使うべきものです。これらについては他の多言語化フレー
+ ムワークに変換してしまうのは危険ではないと判断しました。
+
+2.3. 処理対象外のAPI
+
+ 上記以外のWINSOCK API については、idn wrapper はなにもしないで、元の
+ WINSOCK API を呼び出します。
+
+ idn wrapper では、元のWINSOCK DLL を名前を変えてコピーし、それを
+ 呼び出すように作られています。
+
+ wsock32.dll -> wsock32o.dll
+ ws2_32.dll -> ws2_32o.dll
+
+ ラッパーDLL は元のWINSOCK DLL と同じ名前で作成されます。従ってidn
+ wrapper がインストールされた状態では、
+
+ wsock32.dll idn wrapper for WINSOCK V1.1
+ ws2_32.dll idn wrapper for WINSOCK V2.0
+ wsock32o.dll Original WINSOCK V1.1 DLL
+ ws2_32o.dll Original WINSOCK V2.0 DLL
+
+ となります。
+
+2.4. 非同期 API
+
+ ドメイン名の変換は、以下のタイミングで行なわれる必要があります。
+
+ DNS へのリクエスト時
+
+ ローカルエンコーディング -> DNS エンコーディング
+
+ DNS からの応答受信時
+
+ DNS エンコーディング -> ローカルエンコーディング
+
+ 同期API においては、ローカルエンコーディングからDNS エンコーディング
+ への変換は、元のAPI を呼び出す前に行われ、DNS エンコーディングからロー
+ カルエンコーディングへの変換は、元のAPI から復帰してきたところで行な
+ われます。
+
+ しかし、WINSOCK の以下のAPI は非同期API で、DNS からの応答受信前に復
+ 帰してしまいます。
+
+ WSAAsyncGetHostByAddr
+ WSAAsyncGetHostByName
+
+ これらのAPI においては、名前解決の完了は、Windows へのメッセージによっ
+ て通知されます。このため、DNS エンコーディングからローカルエンコーディン
+ グへの変換を行なうには、ラッパーは通知先のウィンドウプロシジャのメッ
+ セージキューをフックして、この完了メッセージを捕獲する必要があります。
+
+ そこで、非同期API が呼び出された場合には、idn wrapper は、通知先のウィン
+ ドウプロシジャ(これはAPI のパラメタで指示されます)にフックを設定し
+ ます。フックが完了メッセージ(これもAPI のパラメタで指示されます)を
+ 検出したなら、フックは結果の格納領域(これもAPI のパラメタで指示され
+ ています)のドメイン名を、DNS 側のエンコーディングからローカルエンコー
+ ディングに変換するものとします。
+
+2.5. Wrapper DLL のインストール
+
+ WINSOCK DLL はWindows のシステムディレクトリに置かれています。
+ WINSOCK を確実にラップするには、システムディレクトリにおいて
+
+ オリジナルWINSOCK DLL の名前の変更
+
+ ren wsock32.dll wsock32o.dll
+ ren ws2_32.dll ws2_32o.dll
+
+ ラッパーDLL の導入
+
+ copy somewhere\wsock32.dll wsock32.dll
+ copy somewhere\ws2_32.dll ws2_32.dll
+ copy another DLLs also
+
+ を行なう必要があります。
+
+ しかし、システムディレクトリでこのようなDLL の置き換えを行なうのは大
+ 変危険な操作になります。
+
+ a) DLL を入れ替えた状態で、もういちど同じ操作を行なうと、オリジナル
+ のWINSOCK DLL が失われてしまうことになります。
+
+ b) サービスパックやアプリケーションなどで、WINSOCK DLL を再導入する
+ ものがありますが、これによってもWINSOCK が利用不能になることがあ
+ ります。
+
+ このような状態になると、ネットワーク機能が全く使えなくなったり、最悪
+ はWindows の起動すら出来なくなる可能性があります。
+
+ そこで、idn wrapper では、上のようなシステムレベルのラップではなく、
+ アプリケーションに対するラップを基本機能として提供するものとします。
+
+ Windows において、DLL は、基本的には
+
+ アプリケーションのロードディレクトリ
+ %SystemRoot%\System32
+ %SystemRoot%
+ PATH で指示されるディレクトリ
+
+ の順序で検索されて、最初に見つかったものがロードされます。ですから、
+ 一般的には、DLL をアプリケーションのロードディレクトリにインストール
+ すれば、そのアプリケーションからのWINSOCK の呼び出しをラップすること
+ ができます。
+
+ ただし、いくつかのアプリケーション、DLL では、検索パスを経由せずに特
+ 定のDLL をリンクするようになっているものがあります。このような構成の
+ アプリケーション、DLL が使われた場合には idn wrapperでは対処すること
+ はできません。
+
+ 注:Netscapeは特定DLL にバインドされているようで、アプリケーションディ
+ レクトリへのインストールではラップできません。WINSOCK DLL 自体も
+ システムディレクトリの関連DLL にバインドされているようです。一方、
+ Internet ExploreやWindows Media Playerは標準のサーチパスに従って
+ いるので、ラップすることができます。
+
+2.6. エンコーディングの変換位置
+
+ WINSOCK 2.0 をサポートしているWindows には、WINSOCK の1.1 と2.0 のそ
+ れぞれに対応するDLL があり、WINSOCK 1.1 のAPI の呼び出しは2.0 の同じ
+ エントリにリダイレクトされるようになっています。
+
+ +------------+ Call +------------+ Call +------------+
+ | |------->| |------->| |
+ |Application | |WINSOCK 1.1 | |WINSOCK 2.0 |
+ | |<-------| |<-------| |
+ +------------+ Return +------------+ Return +------------+
+
+ この場合には1.1 に対する呼び出しも2.0 に対する呼び出しも、ともにV2.0
+ 用のDLL に渡されるので、2.0用のラッパーDLL 側だけでエンコーディングの
+ 変換を行なうようにするべきでしょう。
+
+ 一方、WINSOCK 1.1 しかサポートしていない場合(Win95)には、1.1 に対応し
+ たDLL しかありません。
+
+ +------------+ Call +------------+
+ | |------->| |
+ |Application | |WINSOCK 1.1 |
+ | |<-------| |
+ +------------+ Return +------------+
+
+ この場合には必然的に1.1 用のラッパーDLL でエンコーディングを変換しな
+ ければなりません。
+
+ idn Wrapepr がwindows のシステムディレクトリにインストールされた場合
+ には、上の通りに動作するので、
+
+ WINSOCK 2.0 あり 2.0 ラッパーで変換
+ WINSOCK 1.1 のみ 1.1 ラッパーで変換
+
+ する必要があります。
+
+ しかし、アプリケーションディレクトリにインストールされた場合には動作
+ が変わってきます。Windows 付属の WINSOCK 1.1 DLLは、システムディレク
+ トリのWINSOCK 2.0 にバインドされているため、アプリケーションディレク
+ トリ側のWINSOCK 2.0 ラッパーDLL にはリダイレクトされてきません。この
+ ため、アプリケーションディレクトリへのインストールにおいては、1.1DLL、
+ 2.0DLLの両方でエンコーディングを変換する必要があります。
+
+ このようなDLL 間のバインディングはドキュメントされていませんので、環
+ 境、バージョンによっては異なった動作をするかも知れません。そこでidn
+ wrapper では、レジストリ値によって、ラッパーDLL のどこで変換を行なう
+ かを決定するようにして、インストール先による差異、あるいはバージョン
+ による差異を吸収するようにします。
+
+ idn wrapper 用のレジストリ設定は
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\IDN
+ HKEY_CURRENT_USER\SOFTWARE\JPNIC\IDN
+
+ 以下に配置されます。エンコーディング変換を行なう位置については、この
+ 直下のレジストリ値 Where(REG_DWORD) によって決定します。有効な値は、
+
+ レジストリ Where (REG_DWORD)
+
+ 0 WINSOCK 1.1、WINSOCK 2.0 の両方で変換する
+ 1 WINSOCK 2.0 があれば、WINSOCK 2.0だけで変換する
+ WINSOCK 1.1 だけの場合には WINSOCK 1.1 で変換する
+ 2 WINSOCK 1.1 だけで変換する
+ 3 WINSOCK 2.0 だけで変換する
+
+ の4通りです。アプリケーションディレクトリにインストールする場合には
+ 「0」を、システムディレクトリにインストールする場合には「1」を設定
+ する必要があります。レジストリ値が存在しない場合には「0」を想定しま
+ す。これはアプリケーションディレクトリへのインストールを標準としたも
+ のです。
+
+2.7. 変換元/先のエンクコーディング
+
+ ラッパーDLL では、解決しようとするドメイン名を、マシンのローカルエン
+ コーディングからDNS サーバのエンコーディングに変換し、また、DNS が返
+ してきたドメイン名(DNS サーバのエンコーディング)をマシンのローカルエン
+ コーディングに戻します。
+
+ 現在、DNS 側の国際化エンコーディングについては、いくつもの方式が提
+ 案されています。ラッパーDLL はそれらのDNS 側エンコーディングのどれか
+ ひとつに変換するように構成されます。このDNS 側エンコーディングはレジ
+ ストリで指示されます。このレジストリには、idn wrapper のインストール
+ 時に(現時点では未定の)デフォルトエンコーディングが設定されます。当
+ 然、このレジストリは、後で他のものに変更することもできます。
+
+ idn wrapper 用のレジストリ設定は
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\IDN
+ HKEY_CURRENT_USER\SOFTWARE\JPNIC\IDN
+
+ 以下に配置されます。DNS 側のエンコーディングはレジストリ値 Encoding
+ (REG_SZ)で指示されます。このエンコーディング名は、libmdnで認識され
+ るものでなければなりません。
+
+ レジストリ Encoding (REG_SZ)
+ DNS サーバ側のエンコーディング名を設定します
+
+ 一方、アプリケーションが使用しているローカルエンコーディングは、通常
+ はプロセスのコードページから求めます。ラッパーDLL が使用する 'iconv'
+ ライブラリは、windows のコードページ名をエンコーディング名として受付
+ けることができるので、コードページ名をそのままローカルエンコーディン
+ グ名として使用します。
+
+ しかし、アプリケーションによっては、特定の国際化エンコーディングで
+ ドメイン名をエンコーディングしてしまうものもあります。例えば、IEでは
+ ドメイン名をUTF-8 で表記するように指示することができるようになってい
+ ます。UTF-8 によるエンコーディングは、提案されている国際化方式のひ
+ とつですが、国際化されたDNS サーバは他のエンコーディングしか受付け
+ ないかも知れません。
+
+ このような状況に対処するため、idn ラッパーは、ローカルエンコーディン
+ グとしてプログラム特有のエンコーディングも受付けることができるように
+ します。このようなプログラム特有のローカルエンコーディングはレジスト
+ リ記載されるものとします。
+
+ idn wrapper 用のプログラム特有のレジストリ設定は
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\IDN\PerProg
+ HKEY_CURRENT_USER\SOFTWARE\JPNIC\IDN\PerProg
+
+ 以下に、プログラム名(実行モジュールファイル名)をキーとして配置され
+ ます。例えば、Internet Explore の場合には、実行モジュール名の
+ IEXPLOREをキーとして
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\JPNIC\IDN\PerProg\IEXPLORE
+
+ 以下に置かれます。ローカルエンコーディング名は、レジストリ値
+ Encoding (REG_SZ)で指示します。これもlibmdnで認識されるものでなけれ
+ ばなりません。
+
+ レジストリ Encoding (REG_SZ)
+
+ アプリケーションプログラム特有のエンコーディング名(デフォル
+ トのエンコーディング以外を必要とする場合)を指定します。
+
+3.セットアップとコンフィギュレーション
+
+ idn wrapper は、基本インストレーションとして、アプリケーションディレ
+ クトリでWINSOCK をラップします。これに合わせて、セットアッププログラ
+ ムとコンフィギュレーションプログラムとを提供します。
+
+ 注:システムディレクトリでのラップも可能ですが、これは危険な設定です
+ ので、標準インストレーションとしては提供しません。システムディレ
+ クトリへのインストールを行なう場合には、自己責任でやってください。
+
+3.1.セットアッププログラム
+
+ idn wrapper をインストールするには"setup.exe" を実行します。セットアッ
+ ププログラムは以下の処理を実行します。
+
+ ファイルのインストール
+
+ ディレクトリ「\Program Files\JPNIC\idn wrapper」 ( セットアップ
+ 時点で変更可能)以下に、idn wrapper を構成するファイルをコピーし
+ ます。
+
+ レジストリの設定
+
+ HKEY_LOCAL_MACHINE\Software\JPNIC\IDN 以下に必要なレジストリキー、
+ レジストリ値を作成、設定します。
+
+ InstallDir REG_SZ "<インストールディレクトリ>"
+ idn wrapper のインストールディレクトリのパス名です。セット
+ アッププログラムはこのディレクトリにオリジナルのWINSOCK
+ DLL のコピーを作成します。idn wrapper のラッパー DLL は実
+ 行時にこの DLL を参照します。
+
+ ConfFile REG_SZ "<インストールディレクトリ>\idn.conf"
+ idn wrapper が国際化ドメイン名の変換処理に使用している
+ idnkit のコンフィギュレーションファイルの名前です。このファ
+ イルは国際化ドメイン名の処理に必要な各種のパラメータを設定
+ するためのものです。詳しくはファイルの内容をご覧ください。
+ この値は後述するコンフィギュレーションプログラムで変更する
+ ことができます。
+
+ LogFile REG_SZ "<インストールディレクトリ>\idn_wrapper.log"
+ idn wrapper のログファイルの名前です。この値もコンフィギュ
+ レーションプログラムで変更することができます。
+
+ LogLevel DWORD -1
+ ログレベルの指定です。デフォルトは -1 で、これは全くログを
+ 出力しないという意味です。この値もコンフィギュレーションプ
+ ログラムで変更することができます。
+
+ PerProg キー
+
+ プログラム毎の設定値を格納するためのキーです。この下に、プロ
+ グラムの実行モジュール名をキーとしてプログラム個別の設定が記
+ 録されます。設定される情報は以下の二つです。
+
+ PerProg\<progname>\Where REG_DWORD 変換位置
+ PerProg\<progname>\Encoding REG_SZ エンコーディング名
+
+ エンコーディング名は通常コンフィギュレーションプログラムによっ
+ て設定されます。変換位置は、標準インストールでは不要です。シ
+ ステムディレクトリへのインストールを行なった場合には、レジス
+ トリエディタで環境に合わせて設定する必要があります。
+
+ アイコンの作成
+
+ コンフィギュレーションプログラムのアイコンを作成し、スタートメニュー
+ に登録します。これによってコンフィギュレーションプログラムを起動
+ することができます。
+
+ アンインストールするには、コントロールパネルの「アプリケーションの追
+ 加と削除」で、「idn wrapper」 を選択して削除(「追加と削除」ボタン)
+ します。
+
+3.2.コンフィギュレーションプログラム
+
+ コンフィギュレーションプログラムは、アプリケーションを特定してラップ
+ したり、アプリケーションのラップを解除するためのツールです。
+
+ 起動すると以下のような画面が表示されます。
+
+ ┌─┬─────────────────────────┬─┬─┬─┐
+ │ │idn wrapper - Configuration │_│□│×│
+ ├─┴─────────────────────────┴─┴─┴─┤
+ │ idn wrapper Configuration Program version X.X │
+ ├─────────────────────────────────┤
+ │ Wrapped Program ┌─────┐│
+ │┌──────────────────────┬─┐│ Wrap.. ││
+ ││ │∧│└─────┘│
+ ││ ├─┤┌─────┐│
+ ││ │ ││ Unwrap.. ││
+ ││ │ │└─────┘│
+ ││ │ │┌─────┐│
+ ││ │ ││UnwrapAll.││
+ ││ │ │└─────┘│
+ ││ │ │┌─────┐│
+ ││ │ ││RewrapAll.││
+ ││ │ │└─────┘│
+ ││ │ │┌─────┐│
+ ││ │ ││ Log.. ││
+ ││ │ │└─────┘│
+ ││ │ │┌─────┐│
+ ││ ├─┤│Advanced..││
+ ││ │∨│└─────┘│
+ │├─┬──────────────────┬─┼─┘┌─────┐│
+ ││〈│ │〉│ │ Exit ││
+ │└─┴──────────────────┴─┘ └─────┘│
+ └─────────────────────────────────┘
+
+ リストボックスには、その時点でラップされているプログラムが表示されま
+ す。最初に実行した場合には空になっています。
+
+ プログラムをラップするには、"wrap"ボタンを押します。"wrap"ボタンを押
+ すと以下のようなダイアログが表示されます。
+
+ ┌─┬────────────────────────┬─┬─┬─┐
+ │ │idn wrapper - Wrap Executable │_│□│×│
+ ├─┴────────────────────────┴─┴─┴─┤
+ │ ┌───────────────────┐┌────┐│
+ │ Program: │ ││Browse..││
+ │ └───────────────────┘└────┘│
+ │ ┌───┐ │
+ │Encoding: │ │ ○Default ○UTF-8 │
+ │ └───┘ │
+ │ □ Force local DLL reference │
+ ├────────────────────────────────┤
+ │ ┌────┐┌────┐│
+ │ │ wrap ││ cancel ││
+ │ └────┘└────┘│
+ └────────────────────────────────┘
+
+ 最初に、ラップするプログラムの実行ファイル名を設定します。直接入力
+ するか、ブラウズボタンでファイルを探してください。次にそのプログラ
+ ムのローカルエンコーディングを指定します。通常は「Default」 でかま
+ いません。プログラムが国際化エンコーディングに従っている場合にのみ
+ 「UTF-8」 を指示します。
+
+ 「Force local DLL reference」ボタンにより、ラップするプログラムの
+ DLL の探索順序を変更することができます (ただし Windows95 にはこの
+ 機能がないため、このボタンも表示されません)。このボタンをチェック
+ すると、たとえプログラムが別の場所の DLL を指定していても、常に実
+ 行ファイルがあるディレクトリの DLL が優先されるようになります。も
+ しプログラムがうまくラップできない場合には、このボタンをチェックす
+ るとうまくいくかもしれません。ただし同時に他の問題が発生する可能性
+ もあります。
+
+ 最後に「wrap」ボタンを押せば、プログラムが、指定されたエンコーディ
+ ングでラップされます。ラップされたプログラムは、最初のウィンドウの
+ リストボックスに反映されます。
+
+ idn wrapper をバージョンアップした場合には、ラップ用の DLL をアップ
+ デートするために、プログラムを再ラップする必要があります。このために、
+ 現在ラップされているプログラムに対して再度ラップを行うための「rewrap
+ all」ボタンが用意されています。
+
+ プログラムに対するラップを解除するには、リストボックスで解除するプロ
+ グラムを選択して、「unwrap」ボタンを押します。以下の確認用のダイアロ
+ グが表示されますので、間違いがなければ「unwrap」ボタンを押してくださ
+ い。
+
+ ┌─┬────────────────────────┬─┬─┬─┐
+ │ │idn wrapper - Unwrap Executable │_│□│×│
+ ├─┴────────────────────────┴─┴─┴─┤
+ │ ┌─────────────────────────┐│
+ │Program: │ ││
+ │ └─────────────────────────┘│
+ ├────────────────────────────────┤
+ │ ┌────┐┌────┐│
+ │ │ Unwrap ││ Cancel ││
+ │ └────┘└────┘│
+ └────────────────────────────────┘
+
+ ラップが解除されると、そのプログラムは最初のウィンドウのリストボック
+ スからも削除されます。
+
+ プログラムに対して現在設定されているラップをすべて解除するための
+ 「unwrap all」ボタンも用意されています。
+
+ ログの設定を行うには、"log" ボタンを押します。次のようなダイアログが
+ 表示されます。
+
+ ┌─┬────────────────────────┬─┬─┬─┐
+ │ │idn wrapper - Log Configuration │_│□│×│
+ ├─┴────────────────────────┴─┴─┴─┤
+ │ Log Level: ○None ○Fatal ○Error ○Warning ○Info ○Trace │
+ │ ┌─────────────────┐┌────┐│
+ │ Log File:│ ││Browse..││
+ │ └─────────────────┘└────┘│
+ │ ┌───┐ ┌───┐ │
+ │Log Operation:│ View │ │Delete│ │
+ │ └───┘ └───┘ │
+ ├────────────────────────────────┤
+ │ ┌────┐┌────┐│
+ │ │ OK ││ Cancel ││
+ │ └────┘└────┘│
+ └────────────────────────────────┘
+
+ ログレベルは次の中から選択することができます。
+ None ログを出力しない
+ Fatal 致命的エラーのみ記録する
+ Error 致命的でないエラーも記録する
+ Warning 警告メッセージも記録する
+ Info その他の情報も記録する
+ Trace トレース出力も記録する
+ ここにあげたログレベルの設定は、IDN ライブラリ (idnkit.dll) が出力する
+ ログに対してのみ有効です。idn wrapper 自身が出力するログは ON/OFF
+ しかできません。None を指定すると OFF に、それ以外のレベルを指定すると
+ ON になります。
+
+ このダイアログを用いて、ログファイルのパス名を指定することもできます。
+
+ また、ログファイルの内容を表示させたり、ログファイルを削除することも
+ 可能です。
+
+ ログレベルやログファイルの設定は、設定時にすでに動作しているプロセス
+ には影響を与えないことに気をつけてください。
+
+ "advanced" ボタンを押すと「advanced configuration」用のダイアログ
+ が表示されます。このダイアログは上級ユーザのためのもので、適切なデ
+ フォルトが設定されているために通常ユーザが変更する必要のないような
+ 基本的なパラメータを変更することができます。
+
+ ┌─┬────────────────────────┬─┬─┬─┐
+ │ │idn wrapper - Advanced Configuration │_│□│×│
+ ├─┴────────────────────────┴─┴─┴─┤
+ │ IDN Wrapping Mode │
+ │ ○Wrap both WINSOCK 1.1 and WINSOCK 2.0 │
+ │ ○Wrap only WINSOCK 1.1 │
+ │ ○Wrap only WINSOCK 2.0 │
+ │ ○Wrap only WINSOCK 2.0 if it exists. │
+ │ Otherwise wrap only WINSOCK 1.1 │
+ ├────────────────────────────────┤
+ │ IDN Configuration │
+ │ ┌─────────────────┐┌────┐│
+ │ Log File:│ ││Browse..││
+ │ └─────────────────┘└────┘│
+ │ ┌───┐ │
+ │ │ Edit │ │
+ │ └───┘ │
+ ├────────────────────────────────┤
+ │ ┌────┐┌────┐│
+ │ │ OK ││ Cancel ││
+ │ └────┘└────┘│
+ └────────────────────────────────┘
+
+ このダイアログを使用して、次の3種類の設定を行うことができます。
+
+ Wrapping Mode
+ ラップ方法を設定します。通常はデフォルトで設定されている項目を
+ 選択しておけばよいはずですが、問題が起ったときには別の項目にす
+ ると動くようになるかもしれません。
+
+ IDN Configuration
+ コンフィギュレーションファイル名を指定します。また "Edit" ボタ
+ ンを押すことにより、ファイルの内容を編集することも可能です。
+
+4. 制限事項
+
+4.1. DLL バージョン
+
+ ラッパーDLL は、元のWINSOCK のDLL のバージョンに強く依存します。これ
+ は、非公開のエントリも含めてすべてのエントリを提供する必要があるため
+ です。このためWINSOCK DLL のバージョンが変わると、idn wrapper が動作
+ しなくなる可能性があります。
+
+ 今回作成されたidn wrapper は、
+
+ Win2000 (WINSOCK 1.1 + 2.0)
+ WinME (WINSOCK 1.1 + 2.0)
+
+ で動作を確認しています。ただ、将来にわたって動作する保証はありません。
+
+4.2. DNS, WINS, LMHOSTS
+
+ Windows では、DNS だけではなく、WINSやLMHOSTS によってもドメイン名、
+ ホスト名の解決が行なわれます。idn wrapper を使った場合には、ドメイン
+ 名の変換が、これらの方式へのディスパッチを行なう場所よりも上位層で行
+ なわれるので、これらのすべての方式について、ドメイン名、ホスト名の変
+ 換が行なわれることになります。このため、Windows が、WINSやLMHOSTS を
+ 使っている場合には、予期しない問題が発生する可能性があります。これに
+ ついては、idn wrapper を使う場合には、名前解決にDNS だけを使用するこ
+ とをお勧めします。
+
+3.3. ドメイン名以外の名前の解決
+
+ WINSOCK 2.0 の名前解決API
+
+ WSALookupServiceBeginA
+ WSALookupServiceNextA
+ WSALookupServiceEnd
+
+ は、ドメイン名以外でも使用できる、汎用の名前解決用のAPI として定義さ
+ れています。現時点では、これらはもっぱらドメイン名の解決で使用されて
+ いますが、他の名前(例えばサービス名)の解決にも使用できることになって
+ います。
+
+ idn wrapper は、名前の対象の如何にかかわらず、名前のエンコーディング
+ を変換してしまうので、これらのAPI が、ドメイン名以外の解決に使われて
+ いる場合には、問題を引き起こす可能性があります。
+
+4.4. 名前解決API を使わないプログラム
+
+ アプリケーションによっては、ドメイン名の解決にこれらのAPI を使用しな
+ いものもあります。例えば、'nslookup'は、これらのAPI を使用しないで、
+ 直接DNS サーバと通信してしまいます。このようなアプリケーションについ
+ ては、idn wrapper は役に立ちません。
+
+4.5. 特定WINSOCK DLL にバインドされたアプリケーション
+
+ アプリケーションによっては、標準のDLL サーチパスに従わないで、特定の
+ パスのDLL にバインドされているものがあります。よく使われるプログラム
+ の中では、Netscape Communicator がそうなっています。このようなプログ
+ ラムについては、標準のインストール/コンフィギュレーションではラップ
+ することはできません。
+
+ このようなプログラムについて、どうしてもラップする必要があるなら、シ
+ ステムディレクトリへのインストールを行なうことができます。ただし、こ
+ のインストールは大変危険で、場合によってはシステムを再起動不能にして
+ しまう可能性もあります。
+
+5. レジストリ設定 - まとめ
+
+5.1. レジストリの優先順位
+
+ idn wrapper の設定情報は、HKEY_LOCAL_MACHINE、HKEY_CURRENT_USERの
+
+ Software\JPNIC\IDN
+
+ 以下に格納されます。idn wrapperは最初にHKEY_LOCAL_MACHINEの設定を読
+ み込み、HKEY_CURRENT_USER側にも設定があれば、これで上書きします。通
+ 常は、HKEY_LOCAL_MACHINE 側だけを設定します。ユーザ個別に異なった設
+ 定を使いたい場合のみ、HKEY_CURRENT_USERを設定するようにしてください。
+
+ なお、コンフィギュレーションプログラムは HKEY_LOCAL_MACHINE の設定
+ だけを読み書きするようになっています。
+
+4.2. レジストリキー
+
+ 全体の共通の設定と、プログラム個別設定とがあります。
+
+_共通定義
+
+ Software\JPNIC\IDN\InstallDir インストールディレクトリ
+ Software\JPNIC\IDN\Where 変換位置
+ 0:WINSOCK1.1 WINSOCK2.0の両方で
+ 1:WINSOCK2.0 があればそちらで
+ 2:WINSOCK1.1 だけで
+ 3:WINSOCK2.0 だけで
+ Software\JPNIC\IDN\ConfFile idnkit の設定ファイル
+ Software\JPNIC\IDN\LogLevel ログレベル
+ Software\JPNIC\IDN\LogFile ログファイル
+
+_プログラム個別設定
+
+ 変換位置、およびプログラム側のエンコーディングはプログラム毎に特定す
+ ることもできます。これらは、以下のキーハイブの下に、プログラム名をキー
+ とする値で設定します。
+
+ Software\JPNIC\IDN\PerProg\<name>\Where
+ Software\JPNIC\IDN\PerProg\<name>\Encoding
+
+ 指定されていない場合には、
+
+ Where 0 1.1、2.0 の両方で変換
+ Encoding プロセスのコードページ
+
+ とみなします。
+
diff --git a/contrib/idn/idnkit-1.0-src/wsock/common/checkdll.c b/contrib/idn/idnkit-1.0-src/wsock/common/checkdll.c
new file mode 100644
index 0000000..a620cc9
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/common/checkdll.c
@@ -0,0 +1,242 @@
+/*
+ * checkdll.c - Winsock DLL/IDN processing status
+ */
+
+/*
+ * Copyright (c) 2000,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "wrapcommon.h"
+
+static int winsock_idx; /* index of winsock_info[] */
+
+static struct winsock_type {
+ char *version; /* winsock version */
+ char *name; /* wrapper DLL name */
+ char *original_name; /* original DLL name */
+} winsock_info[] = {
+#define IDN_IDX_WS11 0
+ { "1.1", "WSOCK32", "WSOCK32O" },
+#define IDN_IDX_WS20 1
+ { "2.0", "WS2_32", "WS2_32O" },
+ { NULL, NULL, NULL },
+};
+
+static HINSTANCE load_original_dll(void);
+static BOOL check_idn_processing(void);
+static BOOL check_dll(const char *name);
+
+BOOL
+idnWinsockVersion(const char *version) {
+ int i;
+ for (i = 0; winsock_info[i].version != NULL; i++) {
+ if (strcmp(winsock_info[i].version, version) == 0) {
+ winsock_idx = i;
+ idnLogPrintf(idn_log_level_trace,
+ "idnWinsockVersion: version %s\n",
+ version);
+ return (TRUE);
+ }
+ }
+ idnLogPrintf(idn_log_level_fatal,
+ "idnWinsockVersion: unknown winsock version %s\n",
+ version);
+ return (FALSE);
+}
+
+HINSTANCE
+idnWinsockHandle(void) {
+ static HINSTANCE dll_handle = NULL;
+ static int initialized = 0;
+
+ if (!initialized) {
+ /* Get the handle of the original winsock DLL */
+ idnLogPrintf(idn_log_level_trace,
+ "idnWinsockHandle: loading original DLL..\n");
+ dll_handle = load_original_dll();
+ }
+ initialized = 1;
+ return (dll_handle);
+}
+
+idn_resconf_t
+idnGetContext(void) {
+ static int initialized = 0;
+ static idn_resconf_t ctx = NULL;
+
+ if (!initialized) {
+ /*
+ * Check whether IDN processing should be done
+ * in this wrapper DLL.
+ */
+ idnLogPrintf(idn_log_level_trace,
+ "idnGetContext: checking IDN status..\n");
+ if (check_idn_processing()) {
+ /* Initialize idnkit */
+ ctx = idnConvInit();
+ idnLogPrintf(idn_log_level_info,
+ "Processing context: %08x\n", ctx);
+ } else {
+ idnLogPrintf(idn_log_level_info,
+ "NOT process IDN here\n");
+ ctx = NULL;
+ }
+ initialized = 1;
+ }
+
+ return (ctx);
+}
+
+static HINSTANCE
+load_original_dll(void) {
+ /*
+ * Load Original DLL
+ */
+ char dllpath[MAX_PATH];
+ const char *dll_name = winsock_info[winsock_idx].original_name;
+ HINSTANCE handle;
+
+ /*
+ * Get idn wrapper's install directory, where the copies of
+ * the original winsock DLLs are saved.
+ */
+ dllpath[0] = '\0';
+ if (idnGetInstallDir(dllpath, sizeof(dllpath)) != TRUE) {
+ idnLogPrintf(idn_log_level_fatal,
+ "idnWinsockHandle: cannot find idn wrapper's "
+ "install directory\n");
+ abort();
+ return (NULL); /* for lint */
+ }
+ /* Strip the trailing backslash. */
+ if (dllpath[0] != '\0' &&
+ dllpath[strlen(dllpath) - 1] == '\\') {
+ dllpath[strlen(dllpath) - 1] = '\0';
+ }
+ /* Is the pathname is insanely long? */
+ if (strlen(dllpath) + strlen(dll_name) + 1 + 4 >= sizeof(dllpath)) {
+ idnLogPrintf(idn_log_level_fatal,
+ "idnWinsockHandle: idn wrapper's install path is "
+ "too long to be true\n");
+ abort();
+ return (NULL); /* for lint */
+ }
+ /* Append the DLL name to form a full pathname of the DLL. */
+ strcat(dllpath, "\\");
+ strcat(dllpath, dll_name);
+ strcat(dllpath, ".DLL");
+
+ idnLogPrintf(idn_log_level_trace,
+ "idnWinsockHandle: loading original winsock DLL (%s)\n",
+ dllpath);
+ if ((handle = LoadLibrary(dllpath)) == NULL) {
+ idnLogPrintf(idn_log_level_fatal,
+ "idnWinsockHandle: no DLL %-.100s\n", dllpath);
+ abort();
+ return (NULL); /* font lint */
+ }
+ return (handle);
+}
+
+static BOOL
+check_idn_processing(void) {
+ int where = idnEncodeWhere();
+ BOOL here = FALSE;
+
+ idnLogPrintf(idn_log_level_trace,
+ "idnGetContext: Winsock%s, where=%d\n",
+ winsock_info[winsock_idx].version, where);
+
+ switch (winsock_idx) {
+ case IDN_IDX_WS11:
+ switch (where) {
+ case IDN_ENCODE_ALWAYS:
+ case IDN_ENCODE_ONLY11:
+ return (TRUE);
+ case IDN_ENCODE_CHECK:
+ if (!check_dll(winsock_info[winsock_idx].name)) {
+ return (TRUE);
+ }
+ break;
+ }
+ break;
+ case IDN_IDX_WS20:
+ switch (where) {
+ case IDN_ENCODE_ALWAYS:
+ case IDN_ENCODE_ONLY20:
+ case IDN_ENCODE_CHECK:
+ return (TRUE);
+ break;
+ }
+ break;
+ }
+ return (FALSE);
+}
+
+static BOOL
+check_dll(const char *name) {
+ HINSTANCE hdll = NULL;
+
+#if 1
+ hdll = LoadLibrary(name);
+#else
+ /*
+ * Just check the existence of the named DLL, without taking
+ * the trouble of calling DllMain.
+ */
+ hdll = LoadLibraryEx(name, NULL, LOAD_LIBRARY_AS_DATAFILE);
+#endif
+ if (hdll == NULL) {
+ idnLogPrintf(idn_log_level_trace,
+ "idnGetContext: DLL %s does not exist\n");
+ return (FALSE);
+ } else {
+ idnLogPrintf(idn_log_level_trace,
+ "idnGetContext: DLL %s exists\n");
+ FreeLibrary(hdll);
+ return (TRUE);
+ }
+}
diff --git a/contrib/idn/idnkit-1.0-src/wsock/common/convert.c b/contrib/idn/idnkit-1.0-src/wsock/common/convert.c
new file mode 100644
index 0000000..b2c202e
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/common/convert.c
@@ -0,0 +1,180 @@
+/*
+ * convert.c - convert domain name
+ */
+
+/*
+ * Copyright (c) 2000,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "wrapcommon.h"
+
+/*
+ * prepare/dispose conversion context
+ */
+
+void
+idnConvDone(idn_resconf_t ctx)
+{
+ if (ctx != NULL) {
+ idnLogReset();
+ idn_resconf_destroy(ctx);
+ }
+}
+
+idn_resconf_t
+idnConvInit(void)
+{
+ char encoding[256];
+ idn_resconf_t ctx;
+ idn_result_t r;
+
+ idnLogReset();
+
+ idnLogPrintf(idn_log_level_info, "idnkit version: %-.20s\n",
+ idn_version_getstring());
+
+ /*
+ * Initialize.
+ */
+ if ((r = idn_resconf_initialize()) != idn_success) {
+ idnPrintf("idnConvInit: cannot initialize idn library: %s\n",
+ idn_result_tostring(r));
+ return NULL;
+ }
+ if ((r = idn_resconf_create(&ctx)) != idn_success) {
+ idnPrintf("idnConvInit: cannot create context: %s\n",
+ idn_result_tostring(r));
+ return NULL;
+ }
+ /*
+ * load configuration file.
+ */
+ if ((r = idn_resconf_loadfile(ctx, NULL)) != idn_success) {
+ idnPrintf("idnConvInit: cannot read configuration file: %s\n",
+ idn_result_tostring(r));
+ if ((r = idn_resconf_setdefaults(ctx)) != idn_success) {
+ idnPrintf("idnConvInit: setting default configuration"
+ " failed: %s\n",
+ idn_result_tostring(r));
+ idnConvDone(ctx);
+ return (NULL);
+ }
+ idnPrintf("idnConvInit: using default configuration\n");
+ }
+ /*
+ * Set local codeset.
+ */
+ if (idnGetPrgEncoding(encoding, sizeof(encoding)) == TRUE) {
+ idnPrintf("Encoding PRG <%-.100s>\n", encoding);
+ r = idn_resconf_setlocalconvertername(ctx, encoding,
+ IDN_CONVERTER_RTCHECK);
+ if (r != idn_success) {
+ idnPrintf("idnConvInit: invalid local codeset "
+ "\"%-.100s\": %s\n",
+ encoding, idn_result_tostring(r));
+ idnConvDone(ctx);
+ return NULL;
+ }
+ }
+ return ctx;
+}
+
+/*
+ * idnConvReq - convert domain name in a DNS request
+ *
+ * convert local encoding to DNS encoding
+ */
+
+BOOL
+idnConvReq(idn_resconf_t ctx, const char FAR *from, char FAR *to, size_t tolen)
+{
+ idn_result_t r;
+
+ idnLogReset();
+
+ idnLogPrintf(idn_log_level_trace, "idnConvReq(from=%-.100s)\n", from);
+ if (ctx == NULL) {
+ idnLogPrintf(idn_log_level_trace, "idnConvReq: ctx is NULL\n");
+ if (strlen(from) >= tolen)
+ return FALSE;
+ strcpy(to, from);
+ return TRUE;
+ }
+
+ r = idn_res_encodename(ctx, IDN_ENCODE_APP, from, to, tolen);
+
+ if (r == idn_success) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+/*
+ * idnConvRsp - convert domain name in a DNS response
+ *
+ * convert DNS encoding to local encoding
+ */
+
+BOOL
+idnConvRsp(idn_resconf_t ctx, const char FAR *from, char FAR *to, size_t tolen)
+{
+ idnLogReset();
+
+ idnLogPrintf(idn_log_level_trace, "idnConvRsp(from=%-.100s)\n", from);
+ if (ctx == NULL) {
+ if (strlen(from) >= tolen)
+ return FALSE;
+ strcpy(to, from);
+ return TRUE;
+ } else if (idn_res_decodename(ctx, IDN_DECODE_APP,
+ from, to, tolen) == idn_success) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
diff --git a/contrib/idn/idnkit-1.0-src/wsock/common/dump.c b/contrib/idn/idnkit-1.0-src/wsock/common/dump.c
new file mode 100644
index 0000000..1f16bd5
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/common/dump.c
@@ -0,0 +1,118 @@
+/*
+ * dump.c - dump data
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "wrapcommon.h"
+
+char *
+dumpAddr(const char FAR *addr, int len, char *buff, size_t size) {
+ int i;
+ char *p;
+
+ buff[0] = '\0';
+ for (i = 0, p = buff; i < len; i++) {
+ char digits[8];
+
+ sprintf(digits, "%d", (addr[i] & 0xff));
+ if (i + 1 < len) {
+ strcat(digits, ".");
+ }
+ if (strlen(digits) >= size) {
+ break;
+ }
+ strcpy(p, digits);
+ p += strlen(digits);
+ size -= strlen(digits);
+ }
+ return (buff);
+}
+
+char *
+dumpHost(const struct hostent FAR *hp, char *buff, size_t size) {
+ char *p = buff;
+
+ p[0] = '\0';
+ if (strlen(hp->h_name) + 1 < size) {
+ sprintf(p, "%s ", hp->h_name);
+ p += strlen(p);
+ size -= strlen(p);
+ }
+ dumpAddr(hp->h_addr_list[0], hp->h_length, p, size);
+ return (buff);
+}
+
+char *
+dumpName(const char *name, char *buff, size_t size) {
+ const char *sp;
+ char *dp;
+
+ for (sp = name, dp = buff; *sp != '\0'; sp++) {
+ if (*sp >= 0x21 && *sp <= 0x7e) {
+ if (size < 2) {
+ break;
+ }
+ *dp++ = *sp;
+ size--;
+ } else {
+ if (size < 5) {
+ break;
+ }
+ dp[0] = '\\';
+ dp[1] = 'x';
+ sprintf(dp + 2, "%02x", *sp & 0xff);
+ dp += 4;
+ size -= 4;
+ }
+ }
+ *dp = '\0';
+
+ return (buff);
+}
+
diff --git a/contrib/idn/idnkit-1.0-src/wsock/common/encoding.c b/contrib/idn/idnkit-1.0-src/wsock/common/encoding.c
new file mode 100644
index 0000000..f8ad9e7
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/common/encoding.c
@@ -0,0 +1,271 @@
+/*
+ * encoding.c - get DNS/Local encodings
+ *
+ * Software\JPNIC\IDN\Where
+ * \LogFile
+ * \LogLevel
+ * \InstallDir
+ * \PerProg\<name>\Where
+ * \PerProg\<name>\Encoding
+ */
+
+/*
+ * Copyright (c) 2000,2001,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "wrapcommon.h"
+
+#define IDN_GLOBAL 1
+#define IDN_PERPROG 2
+#define IDN_CURUSER 4
+
+/*
+ * Registry of Encodings
+ */
+
+#define IDNKEY_WRAPPER "Software\\JPNIC\\IDN"
+#define IDNKEY_PERPROG "Software\\JPNIC\\IDN\\PerProg"
+#define IDNVAL_WHERE "Where"
+#define IDNVAL_ENCODE "Encoding"
+#define IDNVAL_LOGLVL "LogLevel"
+#define IDNVAL_LOGFILE "LogFile"
+#define IDNVAL_INSDIR "InstallDir"
+
+static int GetRegistry(HKEY top, const char *key, const char *name,
+ DWORD type, void *param, DWORD length);
+static char *GetPerProgKey(char *buf, size_t len);
+static int GetFromRegistry(const char *name, int where, DWORD type,
+ void *param, DWORD length);
+static int GetIntFromRegistry(const char *name, int defvalue, int where);
+static BOOL GetStringFromRegistry(const char *name, char *result,
+ size_t length, int where);
+
+static int
+GetRegistry(HKEY top, const char *key, const char *name, DWORD type,
+ void *param, DWORD length)
+{
+ LONG stat;
+ HKEY hk;
+ DWORD realtype;
+
+ stat = RegOpenKeyEx(top, key, 0, KEY_READ, &hk);
+ if (stat != ERROR_SUCCESS) {
+ return 0;
+ }
+
+ stat = RegQueryValueEx(hk, (LPCTSTR)name, NULL,
+ &realtype, (LPBYTE)param, &length);
+
+ RegCloseKey(hk);
+
+ if (stat != ERROR_SUCCESS || realtype != type)
+ return 0;
+
+ return 1;
+}
+
+static char *
+GetPerProgKey(char *buf, size_t len)
+{
+ char exename[256];
+ char prgname[256];
+ char *p, *last;
+
+ GetModuleFileName(NULL, exename, 256);
+
+ for (p = exename, last = NULL; *p != '\0'; p++) {
+ if (*p == '/' || *p == '\\') {
+ last = p;
+ }
+ }
+ strcpy(prgname, (last == NULL) ? exename : (last + 1));
+ if ((p = strrchr(prgname, '.')) != NULL) {
+ *p = '\0';
+ }
+
+ if (strlen(IDNKEY_PERPROG) + 1 + strlen(prgname) >= len) {
+ return (NULL);
+ }
+ sprintf(buf, "%s\\%s", IDNKEY_PERPROG, prgname);
+ return buf;
+}
+
+static int
+GetFromRegistry(const char *name, int where, DWORD type,
+ void *param, DWORD length)
+{
+ if (where & IDN_PERPROG) {
+ /*
+ * First, try program specific setting.
+ */
+ char keyname[256];
+
+ /*
+ * Try HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE.
+ */
+ if (GetPerProgKey(keyname, sizeof(keyname)) != NULL) {
+ if (((where & IDN_CURUSER) &&
+ GetRegistry(HKEY_CURRENT_USER, keyname, name,
+ type, param, length)) ||
+ GetRegistry(HKEY_LOCAL_MACHINE, keyname, name,
+ type, param, length)) {
+ return (1);
+ }
+ }
+ }
+
+ if (where & IDN_GLOBAL) {
+ /*
+ * Try global setting.
+ */
+ if (((where & IDN_CURUSER) &&
+ GetRegistry(HKEY_CURRENT_USER, IDNKEY_WRAPPER, name,
+ type, param, length)) ||
+ GetRegistry(HKEY_LOCAL_MACHINE, IDNKEY_WRAPPER, name,
+ type, param, length)) {
+ return (1);
+ }
+ }
+
+ /*
+ * Not found.
+ */
+ return (0);
+}
+
+static int
+GetIntFromRegistry(const char *name, int defvalue, int where)
+{
+ DWORD param;
+
+ if (GetFromRegistry(name, where, REG_DWORD, &param, sizeof(param))) {
+ return ((int)param);
+ }
+ return (defvalue);
+}
+
+static BOOL
+GetStringFromRegistry(const char *name, char *result, size_t length, int where)
+{
+ if (GetFromRegistry(name, where, REG_SZ, result, (DWORD)length)) {
+ return (TRUE);
+ }
+ return (FALSE);
+}
+
+/*
+ * idnEncodeWhere - which module should convert domain name
+ */
+int
+idnEncodeWhere(void)
+{
+ int v = GetIntFromRegistry(IDNVAL_WHERE, IDN_ENCODE_ALWAYS,
+ IDN_GLOBAL|IDN_PERPROG|IDN_CURUSER);
+
+ idnLogPrintf(idn_log_level_trace, "idnEncodeWhere: %d\n", v);
+ return (v);
+}
+
+/*
+ * idnGetLogFile - refer to log file
+ */
+BOOL
+idnGetLogFile(char *file, size_t len)
+{
+ BOOL v = GetStringFromRegistry(IDNVAL_LOGFILE, file, len,
+ IDN_GLOBAL|IDN_CURUSER);
+
+ idnLogPrintf(idn_log_level_trace, "idnGetLogFile: %-.100s\n",
+ (v == TRUE) ? file : "<none>");
+ return (v);
+}
+
+/*
+ * idnGetPrgEncoding - refer to Program's Local Encoding
+ *
+ * use program name as registry key
+ */
+BOOL
+idnGetPrgEncoding(char *enc, size_t len)
+{
+ if (GetStringFromRegistry(IDNVAL_ENCODE, enc, len,
+ IDN_PERPROG|IDN_CURUSER) != TRUE ||
+ enc[0] == '\0') {
+ sprintf(enc, "CP%d", GetACP());
+ }
+ idnLogPrintf(idn_log_level_trace,
+ "idnGetPrgEncoding: %-.30s\n", enc);
+ return (TRUE);
+}
+
+/*
+ * idnGetLogLevel
+ */
+int
+idnGetLogLevel(void)
+{
+ int v = GetIntFromRegistry(IDNVAL_LOGLVL, 0,
+ IDN_GLOBAL|IDN_CURUSER);
+
+ idnLogPrintf(idn_log_level_trace, "idnGetLogLevel: %d\n", v);
+ return (v);
+}
+
+/*
+ * idnGetInstallDir - get idn wrapper install directory
+ */
+BOOL
+idnGetInstallDir(char *dir, size_t len)
+{
+ /* No need to look at HKEY_CURRENT_USER */
+ BOOL v = GetStringFromRegistry(IDNVAL_INSDIR, dir, len, IDN_GLOBAL);
+
+ idnLogPrintf(idn_log_level_trace, "idnGetInstallDir: %-.100s\n",
+ (v == TRUE) ? dir : "<none>");
+ return (v);
+}
diff --git a/contrib/idn/idnkit-1.0-src/wsock/common/hook.c b/contrib/idn/idnkit-1.0-src/wsock/common/hook.c
new file mode 100644
index 0000000..b520f10
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/common/hook.c
@@ -0,0 +1,224 @@
+/*
+ * hook.c - Hooking Asynchronous Completion
+ */
+
+/*
+ * Copyright (c) 2000,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "wrapcommon.h"
+
+/*
+ * Hook Managements
+ */
+
+static HHOOK hookHandle = NULL ;
+
+typedef struct _HOOK *HOOKPTR;
+
+typedef struct _HOOK {
+ HOOKPTR prev;
+ HOOKPTR next;
+ idn_resconf_t ctx;
+ HWND hWnd;
+ u_int wMsg;
+ char FAR *pBuf;
+} HOOKREC;
+
+static HOOKREC hookList = { 0 } ;
+
+static void
+hookListInit(void) {
+ if (hookList.prev == NULL || hookList.next == NULL) {
+ hookList.prev = &hookList;
+ hookList.next = &hookList;
+ }
+}
+
+static HOOKPTR
+hookListSearch(HWND hWnd, u_int wMsg) {
+ HOOKPTR hp;
+
+ for (hp = hookList.next ; hp != &hookList ; hp = hp->next) {
+ if (hp->hWnd == hWnd && hp->wMsg == wMsg) {
+ return (hp);
+ }
+ }
+ return (NULL);
+}
+
+static BOOL
+hookListAppend(HWND hWnd, u_int wMsg, char FAR *buf, idn_resconf_t ctx) {
+ HOOKPTR hp, prev, next;
+
+ if ((hp = (HOOKPTR)malloc(sizeof(HOOKREC))) == NULL) {
+ idnPrintf("cannot create hook record\n");
+ return (FALSE);
+ }
+ memset(hp, 0, sizeof(*hp));
+
+ hp->ctx = ctx;
+ hp->hWnd = hWnd;
+ hp->wMsg = wMsg;
+ hp->pBuf = buf;
+
+ prev = hookList.prev;
+ next = prev->next;
+ prev->next = hp;
+ next->prev = hp;
+ hp->next = next;
+ hp->prev = prev;
+
+ return (TRUE);
+}
+
+static void
+hookListDelete(HOOKPTR hp)
+{
+ HOOKPTR prev, next;
+
+ prev = hp->prev;
+ next = hp->next;
+ prev->next = next;
+ next->prev = prev;
+
+ free(hp);
+}
+
+static void
+hookListDone(void)
+{
+ HOOKPTR hp;
+
+ while ((hp = hookList.next) != &hookList) {
+ hookListDelete(hp);
+ }
+}
+
+/*
+ * idnHookInit - initialize Hook Management
+ */
+void
+idnHookInit(void) {
+ hookListInit();
+}
+
+/*
+ * idnHookDone - finalize Hook Management
+ */
+void
+idnHookDone(void) {
+ if (hookHandle != NULL) {
+ UnhookWindowsHookEx(hookHandle);
+ hookHandle = NULL;
+ }
+ hookListDone();
+}
+
+/*
+ * hookProc - hookprocedure, used as WH_GETMESSAGE hook
+ */
+LRESULT CALLBACK
+hookProc(int nCode, WPARAM wParam, LPARAM lParam) {
+ MSG *pMsg;
+ HOOKPTR pHook;
+ struct hostent *pHost;
+ char nbuff[256];
+ char hbuff[256];
+
+ if (nCode < 0) {
+ return (CallNextHookEx(hookHandle, nCode, wParam, lParam));
+ } else if (nCode != HC_ACTION) {
+ return (0);
+ }
+ if ((pMsg = (MSG *)lParam) == NULL) {
+ return (0);
+ }
+ if ((pHook = hookListSearch(pMsg->hwnd, pMsg->message)) == NULL) {
+ return (0);
+ }
+
+ /*
+ * Convert the Host Name
+ */
+ pHost = (struct hostent *)pHook->pBuf;
+ idnPrintf("AsyncComplete Resulting <%s>\n",
+ dumpName(pHost->h_name, hbuff, sizeof(hbuff)));
+ if (idnConvRsp(pHook->ctx, pHost->h_name,
+ nbuff, sizeof(nbuff)) == TRUE) {
+ idnPrintf("AsyncComplete Converted <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ strcpy(pHost->h_name, nbuff);
+ }
+
+ /*
+ * Delete target
+ */
+ hookListDelete(pHook);
+
+ return (0);
+}
+
+/*
+ * idnHook - hook async. completion message
+ */
+BOOL
+idnHook(HWND hWnd, u_int wMsg, char FAR *buf, idn_resconf_t ctx)
+{
+ if (hookHandle == NULL) {
+ hookHandle = SetWindowsHookEx(WH_GETMESSAGE, hookProc,
+ NULL, GetCurrentThreadId());
+ }
+ if (hookHandle == NULL) {
+ idnPrintf("idnHook: cannot set hook\n");
+ return (FALSE);
+ }
+ if (hookListAppend(hWnd, wMsg, buf, ctx) != TRUE) {
+ return (FALSE);
+ }
+ return (TRUE);
+}
diff --git a/contrib/idn/idnkit-1.0-src/wsock/common/make.wnt b/contrib/idn/idnkit-1.0-src/wsock/common/make.wnt
new file mode 100644
index 0000000..4dde4dd
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/common/make.wnt
@@ -0,0 +1,102 @@
+#
+# Makefile for WinSock Wrapper (common part)
+#
+
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+!include <win32.mak>
+
+SYSLIBS = $(libcdll) kernel32.lib advapi32.lib user32.lib
+
+#
+# Files to use
+#
+
+HDRS = wrapcommon.h
+SRCS = printf.c dump.c checkdll.c encoding.c convert.c hook.c
+OBJS = printf.obj dump.obj checkdll.obj encoding.obj convert.obj hook.obj
+LIBS = ..\..\lib\idnkit.lib ..\..\win\iconv.lib
+
+cflags = $(cflags) -I..\..\include
+
+#
+# Targets to Build
+#
+
+TARGETS = wrapcommon.lib
+
+all : $(TARGETS)
+
+wrapcommon.lib : $(OBJS)
+ -del wrapcommon.lib
+ lib /out:wrapcommon.lib $(OBJS)
+
+install :
+
+clean : force
+ -del *.obj
+ -del *.lib
+ -del *.exp
+
+#
+# Dependencies
+#
+
+printf.obj : printf.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+dump.obj : dump.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+checkdll.obj : checkdll.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+encoding.obj : encoding.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+convert.obj : convert.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+hook.obj : hook.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+force :
+
diff --git a/contrib/idn/idnkit-1.0-src/wsock/common/printf.c b/contrib/idn/idnkit-1.0-src/wsock/common/printf.c
new file mode 100644
index 0000000..7d6d2e4
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/common/printf.c
@@ -0,0 +1,138 @@
+/*
+ * printf.c - printf like debug print function
+ */
+
+/*
+ * Copyright (c) 2000,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <process.h>
+
+#include "wrapcommon.h"
+
+/*
+ * Debug Tracer for DLL
+ */
+
+static char logfile_name[256];
+static int log_level = -1;
+static char log_header[30];
+
+void
+idnPrintf(char *fmt, ...) {
+ va_list arg_ptr;
+ FILE *fp;
+ char msg[512];
+
+ if (log_level < 0 || logfile_name[0] == '\0')
+ return;
+
+ va_start(arg_ptr, fmt);
+ vsprintf(msg, fmt, arg_ptr);
+ va_end(arg_ptr);
+
+ if ((fp = fopen(logfile_name, "a")) != NULL) {
+ fputs(log_header, fp);
+ fputs(msg, fp);
+ fclose(fp);
+ }
+}
+
+void
+idnLogPrintf(int level, char *fmt, ...) {
+ va_list arg_ptr;
+ FILE *fp;
+ char msg[512];
+
+ if (level > log_level || logfile_name[0] == '\0')
+ return;
+
+ va_start(arg_ptr, fmt);
+ vsprintf(msg, fmt, arg_ptr);
+ va_end(arg_ptr);
+
+ if ((fp = fopen(logfile_name, "a")) != NULL) {
+ fputs(log_header, fp);
+ fputs(msg, fp);
+ fclose(fp);
+ }
+}
+
+static void
+log_proc(int level, const char *msg) {
+ FILE *fp;
+
+ if (log_level < 0 || logfile_name[0] == '\0')
+ return;
+
+ if ((fp = fopen(logfile_name, "a")) != NULL) {
+ fputs(msg, fp);
+ fclose(fp);
+ }
+}
+
+void
+idnLogInit(const char *title) {
+ log_level = idnGetLogLevel();
+ /* If log file is not stored in the registry, don't do logging. */
+ if (idnGetLogFile(logfile_name, sizeof(logfile_name)) == FALSE) {
+ log_level = -1;
+ }
+ sprintf(log_header, "%08x %-.16s: ", getpid(), title);
+ idn_log_setproc(log_proc);
+ idn_log_setlevel(log_level < 0 ? 0 : log_level);
+}
+
+void
+idnLogReset(void) {
+ idn_log_setproc(log_proc);
+}
+
+void
+idnLogFinish(void) {
+ idn_log_setproc(NULL);
+ /* idn_log_setlevel(0); */
+}
diff --git a/contrib/idn/idnkit-1.0-src/wsock/common/wrapcommon.h b/contrib/idn/idnkit-1.0-src/wsock/common/wrapcommon.h
new file mode 100644
index 0000000..c186a33
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/common/wrapcommon.h
@@ -0,0 +1,109 @@
+/*
+ * wrapcommon.h
+ */
+
+/*
+ * Copyright (c) 2000,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef _WRAPCOMMON_H
+#define _WRAPCOMMON_H
+
+#include <idn/res.h>
+#include <idn/log.h>
+#include <idn/version.h>
+
+#define WRAPPER_EXPORT extern __declspec(dllexport)
+
+extern void idnPrintf(char *fmt, ...);
+extern void idnLogPrintf(int level, char *fmt, ...);
+extern void idnLogInit(const char *title);
+extern void idnLogReset(void);
+extern void idnLogFinish(void);
+
+extern char *dumpAddr(const char FAR *addr, int len, char *buff, size_t size);
+extern char *dumpHost(const struct hostent FAR *hp, char *buff, size_t size);
+extern char *dumpName(const char *name, char *buff, size_t size);
+
+extern int idnEncodeWhere(void);
+
+#define IDN_ENCODE_ALWAYS 0
+#define IDN_ENCODE_CHECK 1
+#define IDN_ENCODE_ONLY11 2
+#define IDN_ENCODE_ONLY20 3
+
+extern BOOL idnGetPrgEncoding(char *enc, size_t len);
+extern BOOL idnGetLogFile(char *file, size_t len);
+
+extern int idnGetLogLevel(void); /* 0 : fatal */
+ /* 1 : error */
+ /* 2 : warning */
+ /* 3 : info */
+ /* 4 : trace */
+ /* 5 : dump */
+extern int idnGetInstallDir(char *dir, size_t len);
+
+extern idn_resconf_t idnConvInit(void);
+extern void idnConvDone(idn_resconf_t ctx);
+
+extern BOOL idnWinsockVersion(const char *version);
+extern HINSTANCE idnWinsockHandle(void);
+extern idn_resconf_t idnGetContext(void);
+
+/*
+ * Converting Request/Response
+ */
+
+extern BOOL idnConvReq(idn_resconf_t ctx, const char FAR *from,
+ char FAR *to, size_t tolen);
+extern BOOL idnConvRsp(idn_resconf_t ctx, const char FAR *from,
+ char FAR *to, size_t tolen);
+
+/*
+ * Hook for Asynchronouse Query
+ */
+
+extern void idnHookInit(void);
+extern void idnHookDone(void);
+extern BOOL idnHook(HWND hWnd, u_int wMsg, char FAR *buf, idn_resconf_t ctx);
+
+#endif /* _WRAPCOMMON_H */
diff --git a/contrib/idn/idnkit-1.0-src/wsock/config/idnconf.tcl b/contrib/idn/idnkit-1.0-src/wsock/config/idnconf.tcl
new file mode 100644
index 0000000..d73bb77
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/config/idnconf.tcl
@@ -0,0 +1,1123 @@
+# $Id: idnconf.tcl,v 1.1.1.1 2003/06/04 00:27:42 marka Exp $
+#
+# idnconf.tcl - configure idn wrapper
+#
+
+#############################################################################
+# Copyright (c) 2000,2002 Japan Network Information Center.
+# All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+#############################################################################
+
+global configFile configBack
+global registryKey registryEnc registryDef
+global filesCpy filesRen filesDel
+
+# idnkit version
+set version "1.0"
+
+set configFile "idnconf.lst" ;# list of wrapped program
+set configBack "idnconf.bak" ;# backup of previous data
+
+set serverKey "HKEY_LOCAL_MACHINE\\Software\\JPNIC\\IDN"
+set serverLogLevel LogLevel
+set serverLogLevelDef -1
+set serverLogLevelNone -1
+set serverLogFile LogFile
+set serverLogFileDef {C:\idn_wrapper.log}
+set serverConfFile ConfFile
+
+set perprogKey "HKEY_LOCAL_MACHINE\\Software\\JPNIC\\IDN\\PerProg\\"
+set perprogEnc Encoding
+set perprogDef Default
+
+set logFileNameDef idn_wrapper.log
+set confFileNameDef idn.conf
+
+set filesCpy11 { "wsock32.dll" }
+set filesCpy20 { "wsock32.dll" "ws2_32.dll" }
+set filesDel11 { "wsock32.dll" }
+set filesDel20 { "wsock32.dll" "ws2_32.dll" }
+
+set local_dll 0
+
+########################################################################
+#
+# OS version check
+#
+
+proc get_os_version {} {
+ global os_version tcl_platform
+
+ if {[llength [info globals os_version]] > 0} {
+ return $os_version
+ }
+
+ switch -- $tcl_platform(os) {
+ "Windows 95" {
+ switch -- $tcl_platform(osVersion) {
+ 4.0 {
+ set os_version {Windows 95}
+ }
+ 4.10 {
+ set os_version {Windows 98}
+ }
+ 4.90 {
+ set os_version {Windows Me}
+ }
+ }
+ }
+ "Windows NT" {
+ switch -- $tcl_platform(osVersion) {
+ 3.51 -
+ 4.0 {
+ set os_version {Windows NT}
+ }
+ 5.0 {
+ set os_version {Windows 2000}
+ }
+ default {
+ # XP or .NET
+ set os_version {Windows XP}
+ }
+ }
+ }
+ "Win32s" {
+ error "idn wrapper does not support Windows 3.1"
+ }
+ default {
+ set os_version "Unknown"
+ }
+ }
+ set os_version
+}
+
+proc support_dll_redirection {} {
+ global dll_redirection
+
+ if {[llength [info globals dll_redirection]] > 0} {
+ return $dll_redirection
+ }
+
+ switch -- [get_os_version] {
+ {Windows 95} -
+ {Windows NT} {
+ # cannot force local DLL reference by .local file.
+ set dll_redirection 0
+ }
+ default {
+ set dll_redirection 1
+ }
+ }
+ set dll_redirection
+}
+
+########################################################################
+#
+# handling pathname
+#
+
+proc getExeName { prg } {
+ set elem [file split $prg]
+ set leng [expr {[llength $elem] - 1}]
+ set name [lindex $elem $leng]
+ set exe [file rootname $name]
+ return $exe
+}
+
+proc getDirName { prg } {
+ file dirname $prg
+}
+
+proc getSystemDir {} {
+ global env
+ switch -- [get_os_version] {
+ "Windows 95" -
+ "Windows 98" -
+ "Windows Me" {
+ set sysDir $env(windir)/system
+ }
+ default {
+ set sysDir $env(SystemRoot)/system32
+ }
+ }
+ return $sysDir
+}
+
+########################################################################
+#
+# loadList / saveList
+#
+# loadList - load list of wrapped executables from $configFile
+# saveList - save list of wrapped executables into $configFile
+#
+
+proc loadList {} {
+
+ global configFile configBack
+
+ if { [file exists $configFile] } {
+ file copy -force $configFile $configBack
+ }
+
+ set aList {}
+ set fd [open $configFile {CREAT RDONLY}]
+ while { ! [eof $fd]} {
+ set line [gets $fd]
+ if { [string length $line] > 0} {
+ lappend aList "$line"
+ }
+ }
+ close $fd
+ return $aList
+}
+
+proc saveList { aList } {
+ global configFile
+ file delete -force $configFile
+ set fd [open $configFile {CREAT WRONLY}]
+ foreach e $aList {
+ puts $fd $e
+ }
+ close $fd
+}
+
+########################################################################
+#
+# putList / getList - set/get list to/from listbox
+#
+
+proc putList { lb aList } {
+ foreach e $aList {
+ $lb insert end $e
+ }
+}
+
+proc getList { lb } {
+ $lb get 0 end
+}
+
+########################################################################
+#
+# checkList / appendList / deleteList - check / append / delete program from/to listbox
+#
+
+proc checkList { lb prg } {
+ set cnt 0
+ set lst [getList $lb]
+
+ foreach n $lst {
+ if { [string compare $prg $n] == 0 } {
+ incr cnt
+ }
+ }
+ return $cnt
+}
+
+proc appendList { lb prg } {
+
+ if { [checkList $lb $prg] == 0 } {
+ $lb insert end $prg
+ }
+}
+
+proc deleteList { lb prg } {
+ set cnt 0
+ set lst [getList $lb]
+
+ foreach n $lst {
+ if { [string compare $n $prg] == 0 } {
+ $lb delete $cnt
+ }
+ incr cnt
+ }
+}
+
+########################################################################
+#
+# registry operations
+#
+
+proc regGetEncode { prg } {
+
+ global perprogKey perprogEnc perprogDef
+
+ if { [string compare $prg "" ] == 0 } {
+ return $perprogDef
+ }
+
+ if {![isWindows]} {
+ return $perprogDef
+ }
+ package require registry 1.0
+
+ set name [getExeName $prg]
+ set key $perprogKey$name
+
+ if { [catch {set enc [registry get $key $perprogEnc]} err] } {
+ return $perprogDef
+ }
+ if { [string compare $enc ""] == 0 } {
+ return $perprogDef
+ }
+ return $enc
+}
+
+proc regSetEncode { prg enc } {
+
+ global perprogKey perprogEnc perprogDef
+
+ if {![isWindows]} {
+ return 1
+ }
+
+ package require registry 1.0
+
+ set name [getExeName $prg]
+ set key $perprogKey$name
+
+ if { [string compare $enc $perprogDef] == 0 } {
+ set enc ""
+ }
+ if { [catch {registry set $key $perprogEnc $enc sz} ] } {
+ return 2
+ }
+ return 0
+}
+
+proc regGetLogLevel {} {
+ global serverKey serverLogLevel serverLogLevelDef
+ regGetValue $serverKey $serverLogLevel $serverLogLevelDef
+}
+
+proc regSetLogLevel {level} {
+ global serverKey serverLogLevel
+ regSetValue $serverKey $serverLogLevel $level dword
+}
+
+proc regGetLogFile {} {
+ global serverKey serverLogFile serverLogFileDef
+ set file [regGetValue $serverKey $serverLogFile $serverLogFileDef]
+ if {[catch {file attributes $file -longname} lfile]} {
+ # Maybe $file doesn't exist (yet). Get the longname of
+ # directory portion.
+ set dir [file dirname $file]
+ if {[catch {file attributes $dir -longname} ldir]} {
+ set ldir $dir
+ }
+ set lfile [file join $ldir [file tail $file]]
+ }
+ file nativename $lfile
+}
+
+proc regSetLogFile {file} {
+ global serverKey serverLogFile
+ regSetValue $serverKey $serverLogFile [file nativename $file]
+}
+
+proc regGetConfFile {} {
+ global serverKey serverConfFile
+ set file [regGetValue $serverKey $serverConfFile {}]
+ if {[string compare $file {}] == 0} {
+ return {}
+ }
+ if {[catch {file attributes $file -longname} lfile]} {
+ # Maybe $file doesn't exist (yet). Get the longname of
+ # directory portion.
+ set dir [file dirname $file]
+ if {[catch {file attributes $dir -longname} ldir]} {
+ set ldir $dir
+ }
+ set lfile [file join $ldir [file tail $file]]
+ }
+ file nativename $lfile
+}
+
+proc regSetConfFile {file} {
+ global serverKey serverConfFile
+ regSetValue $serverKey $serverConfFile [file nativename $file]
+}
+
+proc regGetWhere {} {
+ global serverKey
+ regGetValue $serverKey Where 0
+}
+
+proc regSetWhere {where} {
+ global serverKey
+ regSetValue $serverKey Where $where dword
+}
+
+proc regGetValue {key name default} {
+ if {![isWindows]} {
+ puts "--regGetValue $key $name"
+ return $default
+ }
+ package require registry 1.0
+
+ if {[catch {registry get $key $name} value]} {
+ return $default
+ }
+ if {[string compare $value {}] == 0} {
+ return $default
+ }
+ return $value
+}
+
+proc regSetValue {key name value {type sz}} {
+ if {![isWindows]} {
+ puts "--regSetValue $key $name $value"
+ return 1
+ }
+
+ package require registry 1.0
+
+ if {[catch {registry set $key $name $value $type}]} {
+ return 2
+ }
+ return 0
+}
+
+########################################################################
+#
+# install / uninstall DLL s
+#
+
+proc fileInstall { prg } {
+
+ global env
+ global filesCpy11 filesCpy20
+
+ if {![isWindows]} {
+ return 1
+ }
+
+ switch -- [get_os_version] {
+ "Windows 95" -
+ "Windows 98" -
+ "Windows Me" {
+ set winDir $env(windir)
+ set sysDir $winDir/system
+ set filesCpy $filesCpy11
+ }
+ default {
+ set winDir $env(SystemRoot)
+ set sysDir $winDir/system32
+ set filesCpy $filesCpy20
+ }
+ }
+
+ set toDir [getDirName $prg ]
+
+ foreach n $filesCpy {
+ file copy -force $n $toDir
+ }
+ return 0
+}
+
+proc fileRemove { prg } {
+
+ global filesDel11 filesDel20
+
+ if {![isWindows]} {
+ return 1
+ }
+
+ switch -- [get_os_version] {
+ "Windows 95" {
+ set filesDel $filesDel11
+ }
+ "Windows 98" -
+ "Windows Me" {
+ set filesDel $filesDel20
+ }
+ default {
+ set filesDel $filesDel20
+ }
+ }
+
+ set fromDir [getDirName $prg ]
+
+ foreach n $filesDel {
+ file delete -force $fromDir/$n
+ }
+ return 0
+}
+
+########################################################################
+#
+# Wrap/Unwrap program
+#
+
+proc execWrap { pw lb dlg prg enc } {
+
+ set prgName [$prg get]
+ set encName [$enc get]
+
+ # Make sure the program name is not empty
+ if {[string compare $prgName {}] == 0} {
+ confErrorDialog $dlg "Program must be specified.\nClick \"Browse..\" button for browsing."
+ return
+ }
+
+ # It is dangerous to wrap programs in the system directory.
+ set prgdir [file nativename [getDirName $prgName]]
+ set sysdir [file nativename [getSystemDir]]
+ if {[string compare -nocase $prgdir $sysdir] == 0} {
+ tk_messageBox -icon error -type ok -title "Directory Error" \
+ -parent $dlg \
+ -message "Cannot wrap applications in the system directory.\nPlease copy the EXE file to elsewhere and wrap the copied one."
+ destroy $dlg
+ return 1
+ }
+
+ # Okay, copy the wrapper DLLs.
+ if { [fileInstall $prgName] } {
+ tk_messageBox -icon warning -type ok \
+ -title "Warning" \
+ -message "Cannot install DLLs" \
+ -parent $dlg
+ destroy $dlg
+ return 1
+ }
+ if { [regSetEncode $prgName $encName] } {
+ tk_messageBox -icon warning -type ok \
+ -title "Warning" \
+ -message "Cannot set encoding" \
+ -parent $dlg
+ fileRemove $prgName
+ destroy $dlg
+ return 2
+ }
+
+ # if local flag is on, create $prgName.local.
+ global local_dll
+ if {$local_dll} {
+ create_dot_local $prgName $dlg
+ } else {
+ remove_dot_local $prgName $dlg
+ }
+
+ if { [checkList $lb $prgName] == 0 } {
+ appendList $lb $prgName
+ }
+ saveList [getList $lb]
+ destroy $dlg
+}
+
+proc execUnwrap { pw lb dlg prg } {
+
+ set prgName [$prg get]
+
+ if {[support_dll_redirection] && [file exists $prgName.local]} {
+ set ans [tk_messageBox -icon question -type yesno \
+ -title "Confirmation" \
+ -message "Also remove $prgName.local file?" \
+ -parent $dlg]
+ if {[string compare $ans yes] == 0} {
+ remove_dot_local $prgName $dlg
+ }
+ }
+
+ if { [checkList $lb $prgName] == 1 } {
+ fileRemove $prgName
+ }
+ deleteList $lb $prgName
+ saveList [getList $lb]
+ destroy $dlg
+}
+
+proc create_dot_local {path {parent .}} {
+ set dotlocal $path.local
+ if {[file exists $dotlocal]} {
+ return 0
+ }
+ if {[catch {open $dotlocal w} fh]} {
+ tk_messageBox -icon warning -type ok -title "Warning" \
+ -message "Cannot create $dotlocal" -parent $parent
+ return -1
+ }
+ close $fh
+ return 0
+}
+
+proc remove_dot_local {path {parent .}} {
+ set dotlocal $path.local
+ if {[file exists $dotlocal] && [catch {file delete $dotlocal}]} {
+ tk_messageBox -icon warning -type ok -title "Warning" \
+ -message "Cannot remove $dotlocal" -parent $parent
+ return -1
+ }
+ return 0
+}
+
+########################################################################
+#
+# dialog for Wrap / Unwrap
+#
+
+proc syncEncode { v i op } {
+ global prgName encName
+ set enc [regGetEncode $prgName]
+ if { [string compare $encName $enc] != 0 } {
+ set encName $enc
+ }
+}
+
+proc confBrowse { p ePrg eEnc } {
+
+ set types {
+ { "Executable" .exe }
+ }
+
+ set file [tk_getOpenFile -filetypes $types -parent $p ]
+
+ if { [string compare $file ""] == 0 } {
+ return
+ }
+ set enc [regGetEncode $file]
+ $ePrg delete 0 end
+ $ePrg insert 0 $file
+}
+
+proc confWrap { pw lb } {
+
+ global prgName encName local_dll
+
+ set idx [$lb curselection]
+ if { [llength $idx] == 1 } {
+ set prg [$lb get $idx]
+ set local_dll [file exists $prg.local]
+ } else {
+ set prg ""
+ }
+
+ set top .wrap
+ toplevel $top
+ grab $top
+ wm title $top "idn wrapper - Wrap Executable"
+
+ frame $top.f1 -bd 1 -relief raised
+ frame $top.f2 -bd 1 -relief raised
+ pack $top.f1 -side top -fill x -expand on
+ pack $top.f2 -side top -fill x -expand on
+
+ frame $top.f1.f
+ pack $top.f1.f -fill both -expand on -padx 4 -pady 4
+
+ set w $top.f1.f
+ label $w.prgtitle -text "Program:"
+ label $w.enctitle -text "Encoding:"
+
+ entry $w.prgname -relief sunken -width 56 -textvariable prgName
+ entry $w.encname -relief sunken -width 8 -textvariable encName
+ set w_prgname $w.prgname
+ set w_encname $w.encname
+ button $w.browse -text "Browse.." \
+ -command [list confBrowse $w $w_prgname $w_encname]
+
+ frame $w.rbf
+ radiobutton $w.rbf.encdef -text "Default" -variable encName \
+ -value "Default"
+ radiobutton $w.rbf.encutf -text "UTF-8" -variable encName \
+ -value "UTF-8"
+ pack $w.rbf.encdef $w.rbf.encutf -side left -padx 4
+
+ grid $w.prgtitle -row 0 -column 0 -sticky e
+ grid $w.enctitle -row 1 -column 0 -sticky e
+ grid $w.prgname -row 0 -column 1 -sticky we -pady 4 -padx 2 -columnspan 2
+ grid $w.browse -row 0 -column 3 -sticky w -pady 4 -padx 4
+ grid $w.encname -row 1 -column 1 -sticky we -pady 4 -padx 2
+ grid $w.rbf -row 1 -column 2 -sticky w -padx 2
+ if {[support_dll_redirection]} {
+ checkbutton $w.local -text "Force local DLL reference" \
+ -variable local_dll
+ grid $w.local -row 2 -column 1 -sticky w -padx 4 -pady 4
+ }
+ grid columnconfig $w 1 -weight 1 -minsize 20
+ grid columnconfig $w 2 -weight 2 -minsize 20
+
+ trace variable prgName w syncEncode
+
+ $w.prgname delete 0 end
+ $w.prgname insert 0 $prg
+
+ focus $w.prgname
+
+ set w $top.f2
+ button $w.wrap -text "Wrap" \
+ -command [list execWrap $pw $lb $top $w_prgname $w_encname]
+ button $w.cancel -text "Cancel" \
+ -command [list destroy $top]
+ pack $w.cancel -side right -fill y -padx 12 -pady 4
+ pack $w.wrap -side right -fill y -padx 12 -pady 4
+
+ tkwait window $top
+}
+
+proc confUnwrap { pw lb } {
+
+ set idx [$lb curselection]
+ if { [llength $idx] != 1 } {
+ tk_messageBox -icon warning -type ok \
+ -title "Warning" \
+ -message "first, select unwrapping executable" \
+ -parent $pw
+ return 0
+ }
+ set prg [$lb get $idx]
+ if { [string length $prg] == 0 } {
+ tk_messageBox -icon warning -type ok \
+ -title "Warning" \
+ -message "first, select unwrapping executable" \
+ -parent $pw
+ return 0
+ }
+
+ set top .unwrap
+ toplevel $top
+ grab $top
+ wm title $top "idn wrapper - Unwrap Executable"
+
+ frame $top.f1 -bd 1 -relief raised
+ frame $top.f2 -bd 1 -relief raised
+ pack $top.f2 -side bottom -fill x
+ pack $top.f1 -side bottom -fill x -expand on
+
+ frame $top.f1.f
+ pack $top.f1.f -padx 4 -pady 4 -fill both -expand on
+ set w $top.f1.f
+ label $w.prgtitle -text "Program:"
+ entry $w.prgname -relief sunken -width 56 -textvariable prgName
+ $w.prgname delete 0 end
+ $w.prgname insert 0 $prg
+
+ set w_prgname $w.prgname
+
+ grid $w.prgtitle -row 0 -column 0 -sticky w
+ grid $w.prgname -row 0 -column 1 -sticky we -pady 4
+ grid columnconfig $w 1 -weight 1 -minsize 20
+
+ set w $top.f2
+ button $w.wrap -text "Unwrap" \
+ -command [list execUnwrap $pw $lb $top $w_prgname]
+ button $w.cancel -text "Cancel" \
+ -command [list destroy $top]
+
+ pack $w.cancel -side right -padx 12 -pady 6
+ pack $w.wrap -side right -padx 12 -pady 6
+
+ focus $w.wrap
+ tkwait window $top
+}
+
+proc unwrapAll {pw lb} {
+ set ans [tk_messageBox -type yesno -default no -icon question \
+ -parent $pw -title {idn wrapper Configuration} \
+ -message {Really unwrap all programs?}]
+ if {[string compare $ans yes] != 0} {
+ return
+ }
+
+ foreach prog [$lb get 0 end] {
+ fileRemove $prog
+ }
+
+ if {[support_dll_redirection]} {
+ set delete_type yes
+ foreach prog [$lb get 0 end] {
+ if {![file exists $prog.local]} continue
+ switch -- $delete_type {
+ yes -
+ no {
+ set delete_type [dotLocalDialog $prog $delete_type]
+ }
+ }
+ switch -- $delete_type {
+ yes -
+ yesall {
+ remove_dot_local $prog $pw
+ }
+ }
+ }
+ }
+
+ $lb delete 0 end
+ saveList {}
+}
+
+proc rewrapAll {pw lb} {
+ set ans [tk_messageBox -type yesno -default yes -icon question \
+ -parent $pw -title {idn wrapper Configuration} \
+ -message {Really rewrap all programs?}]
+ if {[string compare $ans yes] != 0} {
+ return
+ }
+ foreach prog [$lb get 0 end] {
+ fileInstall $prog
+ }
+}
+
+proc confLog {pw} {
+ global _logLevel _logFile
+
+ set top .log
+ catch {destroy $top}
+ toplevel $top
+ wm title $top "idn wrapper - Log Configuration"
+ # wm transient $top $pw
+
+ set _logLevel [regGetLogLevel]
+ set _logFile [regGetLogFile]
+
+ frame $top.f1 -bd 1 -relief raised
+ frame $top.f2 -bd 1 -relief raised
+ pack $top.f2 -side bottom -fill x
+ pack $top.f1 -side top -fill both -expand on
+
+ set w $top.f1
+ label $w.lv_l -text "Log Level:"
+ frame $w.lv_v
+ global serverLogLevelNone
+ set i 0
+ foreach {lvl text} [list $serverLogLevelNone None \
+ 0 Fatal 1 Error 2 Warning 3 Info 4 Trace] {
+ radiobutton $w.lv_v.btn$i -text $text -value $lvl -variable _logLevel
+ pack $w.lv_v.btn$i -side left -padx 3
+ incr i
+ }
+ label $w.ld_l -text "Log File:"
+ frame $w.ld_v
+ entry $w.ld_v.e -width 40 -textvariable _logFile
+ focus $w.ld_v.e
+ button $w.ld_v.b -text "Browse.." -command [list selectLog $top $w.ld_v.e]
+ pack $w.ld_v.b -side right -fill y -padx 6
+ pack $w.ld_v.e -side left -fill both -expand yes
+ #label $w.lo_l -text "Log Operation:"
+ frame $w.lo_v
+ button $w.lo_v.show -text "View" -command [list showLog $top]
+ button $w.lo_v.delete -text "Delete" -command [list deleteLog $top]
+ pack $w.lo_v.show $w.lo_v.delete -side left -padx 4
+
+ grid $w.lv_l -row 0 -column 0 -sticky e -padx 4
+ grid $w.ld_l -row 1 -column 0 -sticky e -padx 4
+ #grid $w.lo_l -row 2 -column 0 -sticky e -padx 4
+ grid $w.lv_v -row 0 -column 1 -sticky w -padx 4 -pady 4
+ grid $w.ld_v -row 1 -column 1 -sticky we -padx 4 -pady 4
+ grid $w.lo_v -row 2 -column 1 -sticky w -padx 4 -pady 4
+
+ set w $top.f2
+ button $w.ok -text "OK" -command [list configureLog $top]
+ button $w.cancel -text "Cancel" -command [list destroy $top]
+ pack $w.cancel -side right -padx 12 -pady 6
+ pack $w.ok -side right -padx 12 -pady 6
+}
+
+proc configureLog {top} {
+ global _logLevel _logFile
+
+ if {$_logLevel != [regGetLogLevel] ||
+ [string compare $_logFile [regGetLogFile]] != 0} {
+ set dir [file dirname $_logFile]
+ if {[string compare $dir {}]} {
+ if {![file exists $dir]} {
+ confErrorDialog $top "Directory $dir doesn't exist"
+ return
+ } elseif {![file isdirectory $dir]} {
+ confErrorDialog $top "$dir is not a directory"
+ return
+ }
+ }
+ regSetLogLevel $_logLevel
+ regSetLogFile $_logFile
+ tk_messageBox -type ok -default ok -icon info -parent $top \
+ -title "idn wrapper Configuration" \
+ -message "Changing log level or file does not affect already running processes."
+ }
+ destroy $top
+}
+
+proc selectLog {top e} {
+ global logFileNameDef
+ set file [tk_getSaveFile -title {idn wrapper Logfile Selection} \
+ -defaultextension .log \
+ -filetypes {{{Log Files} .log} {{All Files} *}} \
+ -initialfile $logFileNameDef \
+ -parent $top]
+ if {[string compare $file {}]} {
+ $e delete 0 end
+ $e insert insert $file
+ }
+}
+
+proc showLog {top} {
+ global _logFile
+ if {[catch {exec notepad.exe $_logFile &} r]} {
+ confErrorDialog $top "Cannot execute notepad"
+ }
+}
+
+proc deleteLog {top} {
+ global _logFile
+ set ans [tk_messageBox -type yesno -default no -icon question \
+ -parent $top -title "idn wrapper Configuration" \
+ -message "Really delete $_logFile?"]
+ if {[string compare $ans yes] == 0} {
+ file delete $_logFile
+ }
+}
+
+########################################################################
+#
+# dialog for .local deletion
+#
+
+proc dotLocalDialog {path {default yes}} {
+ set parent .
+ set dlg .dotlocaldlg
+ catch {destroy $dlg}
+ toplevel $dlg
+
+ wm iconname $dlg Dialog
+ wm title $dlg Confirmation
+ wm transient $dlg $parent
+ wm protocol $dlg WM_DELETE_WINDOW {}
+
+ frame $dlg.f1 -bd 1 -relief raised
+ frame $dlg.f2 -bd 1 -relief raised
+ pack $dlg.f1 -side top -fill x -expand on -ipadx 2m -ipady 4m
+ pack $dlg.f2 -side top -fill x -ipadx 2m
+
+ label $dlg.f1.bm -bitmap question -bd 0
+ label $dlg.f1.msg -text "Remove $path.local?" -wraplength 10c
+ pack $dlg.f1.bm -side left -padx 3m -pady 2m
+ pack $dlg.f1.msg -side left -padx 2m -pady 2m
+
+ global dotlocal_selection
+ foreach {btn lbl} {yes Yes no No yesall {Yes to All} noall {No to All}} {
+ set bw $dlg.f2.btn$btn
+ button $bw -text $lbl -default normal \
+ -command [list set dotlocal_selection $btn]
+ if {[string compare $default $btn] == 0} {
+ $bw configure -default active
+ focus $bw
+ }
+ bind $bw <Return> {%W flash; %W invoke}
+ pack $bw -side left -padx 3m -pady 2m
+ }
+
+ grab $dlg
+ ::tk::PlaceWindow $dlg widget $parent
+
+ vwait dotlocal_selection
+ destroy $dlg
+ return $dotlocal_selection
+}
+
+########################################################################
+#
+# dialog for advanced configuration
+#
+
+proc advancedConf {pw} {
+ set top .adv
+ catch {destroy $top}
+ toplevel $top
+ wm title $top "idn wrapper - Advanced Configuration"
+
+ global _mdnOperation _confFile
+ set _mdnOperation [regGetWhere]
+ set _confFile [regGetConfFile]
+
+ foreach f {f1 f2 f3} {
+ frame $top.$f -bd 1 -relief raised
+ pack $top.$f -side top -fill x
+ }
+
+ set f $top.f1
+ label $f.lbl -text {IDN Wrapping Mode}
+ set w $f.f
+ frame $w
+ foreach {rb val txt} [list \
+ rb1 0 {Wrap both WINSOCK 1.1 and WINSOCK 2.0} \
+ rb2 2 {Wrap only WINSOCK 1.1} \
+ rb3 3 {Wrap only WINSOCK 2.0} \
+ rb4 1 "Wrap only WINSOCK2.0 if it exists.\nOtherwise wrap only WINSOCK1.1"] {
+ radiobutton $w.$rb -text $txt -variable _mdnOperation -value $val \
+ -anchor w -justify left
+ pack $w.$rb -side top -fill x -pady 1
+ }
+ pack $f.lbl -side top -fill x -pady 4
+ pack $w -side top -fill both -padx 20 -pady 10
+
+ set f $top.f2
+ label $f.lbl -text {IDN Configuration}
+ pack $f.lbl -side top -fill x -pady 6
+
+ set w $f.f
+ frame $w
+ pack $w -side top -fill both -padx 10 -pady 6
+ label $w.l1 -text {Config File:}
+ #label $w.l2 -text {Config Operation:}
+ entry $w.e -width 40 -textvariable _confFile
+ focus $w.e
+ button $w.br -text "Browse.." -command [list selectConf $top $w.e]
+ button $w.b -text Edit -command [list editConf $top]
+ grid $w.l1 -row 0 -column 0 -sticky e -padx 4
+ #grid $w.l2 -row 1 -column 0 -sticky e -padx 4
+ grid $w.e -row 0 -column 1 -sticky we -padx 4 -pady 4
+ grid $w.b -row 1 -column 1 -sticky w -padx 4 -pady 4
+ grid $w.br -row 0 -column 2 -sticky w -padx 4 -pady 4
+
+ set w $top.f3
+ button $w.ok -text "OK" -command [list advConf $top]
+ button $w.cancel -text "Cancel" -command [list destroy $top]
+ pack $w.cancel -side right -padx 12 -pady 8
+ pack $w.ok -side right -padx 12 -pady 8
+}
+
+proc editConf {top} {
+ global _confFile
+ if {[catch {exec notepad.exe $_confFile &} r]} {
+ confErrorDialog $top "Cannot execute notepad"
+ }
+}
+
+proc selectConf {top e} {
+ global confFileNameDef
+ set file [tk_getOpenFile -title {idn wrapper Config File Selection} \
+ -defaultextension .conf \
+ -filetypes {{{Config Files} .conf} {{All Files} *}} \
+ -initialfile $confFileNameDef \
+ -parent $top]
+ if {[string compare $file {}]} {
+ $e delete 0 end
+ $e insert insert $file
+ }
+}
+
+proc advConf {top} {
+ global _mdnOperation _confFile
+ regSetWhere $_mdnOperation
+ regSetConfFile $_confFile
+ destroy $top
+}
+
+########################################################################
+#
+# utility
+#
+
+proc confErrorDialog {top message} {
+ tk_messageBox -default ok -icon error -parent $top -type ok \
+ -title {idn wrapper Configuration Error} -message $message
+}
+
+proc isWindows {} {
+ global tcl_platform
+ expr {[string compare $tcl_platform(platform) "windows"] == 0}
+}
+
+########################################################################
+#
+# config program start here
+#
+
+wm title . "idn wrapper - Configuration"
+wm iconname . "idn wrapper - Configuration"
+
+
+label .title -bd 1 -relief raised -pady 5 \
+ -text "idn wrapper Configuration Program version $version"
+
+frame .left -bd 1 -relief raised
+frame .right -bd 1 -relief raised
+
+frame .lst
+label .lst.title -text "Wrapped Programs" -pady 3
+listbox .lst.list -width 64 -height 16 -setgrid 1 \
+ -xscrollcommand ".lst.xscroll set" \
+ -yscrollcommand ".lst.yscroll set"
+scrollbar .lst.yscroll -orient vertical -command ".lst.list yview"
+scrollbar .lst.xscroll -orient horizontal -command ".lst.list xview"
+grid .lst.title -row 0 -column 0 -columnspan 2 -sticky news
+grid .lst.list -row 1 -column 0 -sticky news
+grid .lst.xscroll -row 2 -column 0 -sticky news
+grid .lst.yscroll -row 1 -column 1 -sticky news
+grid rowconfig .lst 1 -weight 1
+grid columnconfig .lst 0 -weight 1
+
+frame .btn
+button .btn.wrap -text "Wrap.." -command [list confWrap . .lst.list]
+button .btn.unwrap -text "Unwrap.." -command [list confUnwrap . .lst.list]
+button .btn.unwrapall -text "Unwrap All" -command [list unwrapAll . .lst.list]
+button .btn.rewrapall -text "Rewrap All" -command [list rewrapAll . .lst.list]
+frame .btn.spacing1 -width 1 -height 12 -bd 0
+button .btn.log -text "Log.." -command [list confLog .]
+frame .btn.spacing2 -width 1 -height 12 -bd 0
+button .btn.adv -text "Advanced.." -command [list advancedConf .]
+button .btn.exit -text Exit -command exit
+pack .btn.wrap -side top -fill x -pady 4
+pack .btn.unwrap -side top -fill x -pady 4
+pack .btn.unwrapall -side top -fill x -pady 4
+pack .btn.rewrapall -side top -fill x -pady 4
+pack .btn.spacing1 -side top
+pack .btn.log -side top -fill x -pady 4
+pack .btn.spacing2 -side top
+pack .btn.adv -side top -fill x -pady 4
+pack .btn.exit -side bottom -fill x -pady 4
+
+pack .lst -in .left -padx 4 -pady 4 -fill both -expand on
+pack .btn -in .right -padx 6 -pady 4 -fill both -expand on
+
+pack .title -side top -fill x
+pack .right -side right -fill y
+pack .left -side left -fill y -expand on
+
+#
+# then set current list into listbox
+#
+
+set theList [loadList]
+#saveList $theList
+putList .lst.list $theList
+
+#
+########################################################################
diff --git a/contrib/idn/idnkit-1.0-src/wsock/config/make.wnt b/contrib/idn/idnkit-1.0-src/wsock/config/make.wnt
new file mode 100644
index 0000000..1099fbe
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/config/make.wnt
@@ -0,0 +1,58 @@
+#
+# Makefile for building mDNS Wrapper Configuration Tool
+#
+
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+TARGETS = idnconf.exe
+
+all : $(TARGETS)
+
+idnconf.exe : idnconf.tcl
+ freewrap idnconf.tcl
+
+install : $(TARGETS)
+ copy idnconf.exe ..\bin
+
+clean : force
+ -del idnconf.exe
+
+force :
diff --git a/contrib/idn/idnkit-1.0-src/wsock/make.wnt b/contrib/idn/idnkit-1.0-src/wsock/make.wnt
new file mode 100644
index 0000000..3c45432
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/make.wnt
@@ -0,0 +1,97 @@
+#
+# Top Level Makefile for building WINSOCK idn wrapper
+#
+
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+all : force
+ cd common
+ $(MAKE) -f make.wnt all
+ cd ..
+ cd wsock11
+ $(MAKE) -f make.wnt all
+ cd ..
+ cd wsock20
+ $(MAKE) -f make.wnt all
+ cd ..
+ cd config
+ $(MAKE) -f make.wnt all
+ cd ..
+
+install : force
+ copy ..\win\iconv.dll bin
+ copy ..\lib\idnkit.dll bin
+ copy ..\lib\idnkitlite.dll bin
+ copy ..\map\jp.map bin
+ cd common
+ $(MAKE) -f make.wnt install
+ cd ..
+ cd wsock11
+ $(MAKE) -f make.wnt install
+ cd ..
+ cd wsock20
+ $(MAKE) -f make.wnt install
+ cd ..
+ cd config
+ $(MAKE) -f make.wnt install
+ cd ..
+
+setup : force
+ cd bin
+ iscc idn_wrapper.iss
+ cd ..
+
+clean : force
+ cd common
+ $(MAKE) -f make.wnt clean
+ cd ..
+ cd wsock11
+ $(MAKE) -f make.wnt clean
+ cd ..
+ cd wsock20
+ $(MAKE) -f make.wnt clean
+ cd ..
+ cd config
+ $(MAKE) -f make.wnt clean
+ cd ..
+
+force :
+
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock11/dlldef.h b/contrib/idn/idnkit-1.0-src/wsock/wsock11/dlldef.h
new file mode 100644
index 0000000..569a264
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock11/dlldef.h
@@ -0,0 +1,86 @@
+/*
+ * dlldef.h
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef _DLLDEF_H
+#define _DLLDEF_H
+
+#include "../common/wrapcommon.h"
+
+/*
+ * Execution Tracing
+ */
+
+extern int procPid;
+
+#ifdef DEBUG
+#define TRACE idnPrintf
+#define FATAL idnPrintf
+#else
+#define TRACE
+#define FATAL idnPrintf
+#endif
+
+/*
+ * Stub functions for calling original version.
+ */
+extern int PASCAL
+_org_gethostname(char FAR * name, int namelen);
+
+extern struct hostent FAR * PASCAL
+_org_gethostbyname(const char FAR * name);
+
+extern struct hostent FAR * PASCAL
+_org_gethostbyaddr(const char FAR * addr, int len, int type);
+
+extern HANDLE PASCAL
+_org_WSAAsyncGetHostByName(HWND hWnd, u_int wMsg, const char FAR * name,
+ char FAR * buf, int buflen);
+extern HANDLE PASCAL
+_org_WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, const char FAR * addr,
+ int len, int type, char FAR * buf, int buflen);
+
+
+#endif /* _DLLDEF_H */
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllfunc.c b/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllfunc.c
new file mode 100644
index 0000000..4b709f6
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllfunc.c
@@ -0,0 +1,212 @@
+/*
+ * dllfunc.c - wrapper functions
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <process.h>
+
+#include "dlldef.h"
+
+WRAPPER_EXPORT int PASCAL FAR
+gethostname(char FAR * name, int namelen) {
+ int ret;
+
+ TRACE("ENTER gethostname\n");
+ ret = _org_gethostname(name, namelen);
+ TRACE("LEAVE gethostname %d <%-.100s>\n", ret, name);
+
+ return (ret);
+}
+
+WRAPPER_EXPORT struct hostent FAR * PASCAL FAR
+gethostbyname(const char FAR * name) {
+ struct hostent FAR *ret;
+ char nbuff[256];
+ char hbuff[256];
+ BOOL stat;
+ idn_resconf_t encodeCtx;
+
+ TRACE("ENTER gethostbyname <%-.100s>\n",
+ (name != NULL ? name : "NULL"));
+
+ encodeCtx = idnGetContext();
+
+ if (encodeCtx == NULL) {
+ TRACE("gethostbyname: not encode here\n");
+ ret = _org_gethostbyname(name);
+ } else if (name == NULL) {
+ TRACE("gethostbyname: name is NULL\n");
+ ret = _org_gethostbyname(name);
+ } else {
+ stat = idnConvReq(encodeCtx, name, nbuff, sizeof(nbuff));
+ if (stat == FALSE) {
+ TRACE("idnConvReq failed\n");
+ ret = NULL;
+ } else {
+ TRACE("Converted Name <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ ret = _org_gethostbyname(nbuff);
+ }
+ }
+
+ if (ret != NULL && encodeCtx != NULL) {
+ TRACE("Resulting Name <%s>\n",
+ dumpName(ret->h_name, hbuff, sizeof(hbuff)));
+ stat = idnConvRsp(encodeCtx, ret->h_name, nbuff,
+ sizeof(nbuff));
+ if (stat == FALSE) {
+ TRACE("Decoding failed - return the name verbatim\n");
+ } else {
+ TRACE("Converted Back <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ strcpy(ret->h_name, nbuff);
+ }
+ }
+
+ if (ret == NULL) {
+ TRACE("LEAVE gethostbyname NULL\n");
+ } else {
+ TRACE("LEAVE gethostbyname <%s>\n",
+ dumpHost(ret, hbuff, sizeof(hbuff)));
+ }
+ return (ret);
+}
+
+WRAPPER_EXPORT struct hostent FAR * PASCAL FAR
+gethostbyaddr(const char FAR * addr, int len, int type) {
+ struct hostent FAR *ret;
+ char nbuff[256];
+ char abuff[256];
+ char hbuff[256];
+ BOOL stat;
+ idn_resconf_t encodeCtx;
+
+ TRACE("ENTER gethostbyaddr <%s>\n",
+ dumpAddr(addr, len, abuff, sizeof(abuff)));
+
+ encodeCtx = idnGetContext();
+
+ ret = _org_gethostbyaddr(addr, len, type);
+
+ if (ret != NULL && encodeCtx != NULL) {
+ TRACE("Resulting Name <%s>\n",
+ dumpName(ret->h_name, hbuff, sizeof(hbuff)));
+ stat = idnConvRsp(encodeCtx, ret->h_name,
+ nbuff, sizeof(nbuff));
+ if (stat == FALSE) {
+ TRACE("Decoding failed - return the name verbatim\n");
+ } else {
+ TRACE("Converted Back <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ strcpy(ret->h_name, nbuff);
+ }
+ }
+
+ if (ret == NULL) {
+ TRACE("LEAVE gethostbyaddr NULL\n") ;
+ } else {
+ TRACE("LEAVE gethostbyaddr <%s>\n",
+ dumpHost(ret, hbuff, sizeof(hbuff)));
+ }
+ return (ret);
+}
+
+WRAPPER_EXPORT HANDLE PASCAL FAR
+WSAAsyncGetHostByName(HWND hWnd, u_int wMsg,
+ const char FAR * name, char FAR * buf, int buflen)
+{
+ HANDLE ret;
+ char nbuff[256];
+ char hbuff[256];
+ idn_resconf_t encodeCtx;
+
+ TRACE("ENTER WSAAsyncGetHostByName <%-.100s>\n", name);
+
+ encodeCtx = idnGetContext();
+
+ if (encodeCtx == NULL || name == NULL) {
+ ret = _org_WSAAsyncGetHostByName(hWnd, wMsg, name,
+ buf, buflen);
+ } else {
+ idnHook(hWnd, wMsg, buf, encodeCtx);
+ idnConvReq(encodeCtx, name, nbuff, sizeof(nbuff));
+ TRACE("Converted Name <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ ret = _org_WSAAsyncGetHostByName(hWnd, wMsg, nbuff,
+ buf, buflen);
+ }
+
+ TRACE("LEAVE WSAAsyncGetHostByName HANDLE %08x\n", ret);
+
+ return (ret);
+}
+
+WRAPPER_EXPORT HANDLE PASCAL FAR
+WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, const char FAR * addr,
+ int len, int type, char FAR * buf, int buflen)
+{
+ HANDLE ret;
+ char abuff[256];
+ idn_resconf_t encodeCtx;
+
+ encodeCtx = idnGetContext();
+
+ if (encodeCtx != NULL) {
+ idnHook(hWnd, wMsg, buf, encodeCtx);
+ }
+
+ TRACE("ENTER WSAAsyncGetHostByAddr <%s>\n",
+ dumpAddr(addr, len, abuff, sizeof(abuff)));
+ ret = _org_WSAAsyncGetHostByAddr(hWnd, wMsg, addr, len, type,
+ buf, buflen);
+ TRACE("LEAVE WSAAsyncGetHostByAddr HANDLE %08x\n", ret);
+
+ return (ret);
+}
+
+
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllload.c b/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllload.c
new file mode 100644
index 0000000..68c2a7e
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllload.c
@@ -0,0 +1,63 @@
+/*
+ * dllload.c - load original entries
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <winsock.h>
+#include <nspapi.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <process.h>
+
+#include "dlldef.h"
+
+/*
+ * Manages original DLL
+ */
+
+#define DLLHANDLE idnWinsockHandle()
+
+#include "dllstub.c"
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllmain.c b/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllmain.c
new file mode 100644
index 0000000..177f722
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllmain.c
@@ -0,0 +1,96 @@
+/*
+ * dllmain.c - entry for DLL
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <process.h>
+
+#include "dlldef.h"
+
+/*
+ * Control Variables
+ */
+
+int procPid = 0;
+
+static char procExe[256];
+
+/*
+ * DLL Entry
+ */
+
+BOOL APIENTRY
+DllMain(HMODULE hmod, DWORD reason, LPVOID *resv) {
+ switch (reason) {
+
+ case DLL_PROCESS_ATTACH:
+ procPid = getpid();
+ GetModuleFileName(NULL, procExe, 256);
+
+ idnLogInit("ws11");
+ idnHookInit();
+
+ TRACE("Attached to Process <%s>\n", procExe);
+ return (idnWinsockVersion("1.1"));
+
+ case DLL_PROCESS_DETACH:
+ idnConvDone(idnGetContext());
+ idnHookDone();
+ TRACE("Detached from Process\n");
+ idnLogFinish();
+ break;
+
+ case DLL_THREAD_ATTACH:
+ break;
+ case DLL_THREAD_DETACH:
+ break;
+ }
+
+ return (TRUE);
+}
+
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllstub.c b/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllstub.c
new file mode 100644
index 0000000..534abc4
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock11/dllstub.c
@@ -0,0 +1,1541 @@
+/* $Id: dllstub.c,v 1.1.1.1 2003/06/04 00:27:45 marka Exp $ */
+
+SOCKET PASCAL
+accept(SOCKET a0, struct sockaddr* a1, int* a2)
+{
+ static SOCKET (PASCAL *fp)(SOCKET a0, struct sockaddr* a1, int* a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub accept() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "accept")) == NULL) {
+ FATAL("cannot find entry accept (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+bind(SOCKET a0, const struct sockaddr* a1, int a2)
+{
+ static int (PASCAL *fp)(SOCKET a0, const struct sockaddr* a1, int a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub bind() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "bind")) == NULL) {
+ FATAL("cannot find entry bind (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+closesocket(SOCKET a0)
+{
+ static int (PASCAL *fp)(SOCKET a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub closesocket() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "closesocket")) == NULL) {
+ FATAL("cannot find entry closesocket (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+connect(SOCKET a0, const struct sockaddr* a1, int a2)
+{
+ static int (PASCAL *fp)(SOCKET a0, const struct sockaddr* a1, int a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub connect() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "connect")) == NULL) {
+ FATAL("cannot find entry connect (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+getpeername(SOCKET a0, struct sockaddr* a1, int* a2)
+{
+ static int (PASCAL *fp)(SOCKET a0, struct sockaddr* a1, int* a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getpeername() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getpeername")) == NULL) {
+ FATAL("cannot find entry getpeername (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+getsockname(SOCKET a0, struct sockaddr* a1, int* a2)
+{
+ static int (PASCAL *fp)(SOCKET a0, struct sockaddr* a1, int* a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getsockname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getsockname")) == NULL) {
+ FATAL("cannot find entry getsockname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+getsockopt(SOCKET a0, int a1, int a2, char* a3, int* a4)
+{
+ static int (PASCAL *fp)(SOCKET a0, int a1, int a2, char* a3, int* a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getsockopt() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getsockopt")) == NULL) {
+ FATAL("cannot find entry getsockopt (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+u_long PASCAL
+htonl(u_long a0)
+{
+ static u_long (PASCAL *fp)(u_long a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub htonl() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "htonl")) == NULL) {
+ FATAL("cannot find entry htonl (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+u_short PASCAL
+htons(u_short a0)
+{
+ static u_short (PASCAL *fp)(u_short a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub htons() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "htons")) == NULL) {
+ FATAL("cannot find entry htons (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+unsigned long PASCAL
+inet_addr(const char* a0)
+{
+ static unsigned long (PASCAL *fp)(const char* a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub inet_addr() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "inet_addr")) == NULL) {
+ FATAL("cannot find entry inet_addr (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+ char * PASCAL
+inet_ntoa(struct in_addr a0)
+{
+ static char * (PASCAL *fp)(struct in_addr a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub inet_ntoa() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "inet_ntoa")) == NULL) {
+ FATAL("cannot find entry inet_ntoa (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+ioctlsocket(SOCKET a0, long a1, u_long * a2)
+{
+ static int (PASCAL *fp)(SOCKET a0, long a1, u_long * a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub ioctlsocket() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "ioctlsocket")) == NULL) {
+ FATAL("cannot find entry ioctlsocket (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+listen(SOCKET a0, int a1)
+{
+ static int (PASCAL *fp)(SOCKET a0, int a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub listen() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "listen")) == NULL) {
+ FATAL("cannot find entry listen (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+u_long PASCAL
+ntohl(u_long a0)
+{
+ static u_long (PASCAL *fp)(u_long a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub ntohl() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "ntohl")) == NULL) {
+ FATAL("cannot find entry ntohl (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+u_short PASCAL
+ntohs(u_short a0)
+{
+ static u_short (PASCAL *fp)(u_short a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub ntohs() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "ntohs")) == NULL) {
+ FATAL("cannot find entry ntohs (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+recv(SOCKET a0, char* a1, int a2, int a3)
+{
+ static int (PASCAL *fp)(SOCKET a0, char* a1, int a2, int a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub recv() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "recv")) == NULL) {
+ FATAL("cannot find entry recv (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+int PASCAL
+recvfrom(SOCKET a0, char* a1, int a2, int a3, struct sockaddr* a4, int* a5)
+{
+ static int (PASCAL *fp)(SOCKET a0, char* a1, int a2, int a3, struct sockaddr* a4, int* a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub recvfrom() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "recvfrom")) == NULL) {
+ FATAL("cannot find entry recvfrom (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+int PASCAL
+select(int a0, fd_set* a1, fd_set* a2, fd_set* a3, const struct timeval* a4)
+{
+ static int (PASCAL *fp)(int a0, fd_set* a1, fd_set* a2, fd_set* a3, const struct timeval* a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub select() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "select")) == NULL) {
+ FATAL("cannot find entry select (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+int PASCAL
+send(SOCKET a0, const char* a1, int a2, int a3)
+{
+ static int (PASCAL *fp)(SOCKET a0, const char* a1, int a2, int a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub send() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "send")) == NULL) {
+ FATAL("cannot find entry send (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+int PASCAL
+sendto(SOCKET a0, const char* a1, int a2, int a3, const struct sockaddr* a4, int a5)
+{
+ static int (PASCAL *fp)(SOCKET a0, const char* a1, int a2, int a3, const struct sockaddr* a4, int a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub sendto() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "sendto")) == NULL) {
+ FATAL("cannot find entry sendto (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+int PASCAL
+setsockopt(SOCKET a0, int a1, int a2, const char* a3, int a4)
+{
+ static int (PASCAL *fp)(SOCKET a0, int a1, int a2, const char* a3, int a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub setsockopt() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "setsockopt")) == NULL) {
+ FATAL("cannot find entry setsockopt (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+int PASCAL
+shutdown(SOCKET a0, int a1)
+{
+ static int (PASCAL *fp)(SOCKET a0, int a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub shutdown() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "shutdown")) == NULL) {
+ FATAL("cannot find entry shutdown (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+SOCKET PASCAL
+socket(int a0, int a1, int a2)
+{
+ static SOCKET (PASCAL *fp)(int a0, int a1, int a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub socket() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "socket")) == NULL) {
+ FATAL("cannot find entry socket (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+MigrateWinsockConfiguration(int a0, int a1, int a2)
+{
+ static int (PASCAL *fp)(int a0, int a1, int a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub MigrateWinsockConfiguration() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "MigrateWinsockConfiguration")) == NULL) {
+ FATAL("cannot find entry MigrateWinsockConfiguration (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+ struct hostent * PASCAL
+_org_gethostbyaddr(const char* a0, int a1, int a2)
+{
+ static struct hostent * (PASCAL *fp)(const char* a0, int a1, int a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_gethostbyaddr() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "gethostbyaddr")) == NULL) {
+ FATAL("cannot find entry gethostbyaddr (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+ struct hostent * PASCAL
+_org_gethostbyname(const char* a0)
+{
+ static struct hostent * (PASCAL *fp)(const char* a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_gethostbyname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "gethostbyname")) == NULL) {
+ FATAL("cannot find entry gethostbyname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+ struct protoent * PASCAL
+getprotobyname(const char* a0)
+{
+ static struct protoent * (PASCAL *fp)(const char* a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getprotobyname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getprotobyname")) == NULL) {
+ FATAL("cannot find entry getprotobyname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+ struct protoent * PASCAL
+getprotobynumber(int a0)
+{
+ static struct protoent * (PASCAL *fp)(int a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getprotobynumber() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getprotobynumber")) == NULL) {
+ FATAL("cannot find entry getprotobynumber (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+ struct servent * PASCAL
+getservbyname(const char* a0, const char* a1)
+{
+ static struct servent * (PASCAL *fp)(const char* a0, const char* a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getservbyname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getservbyname")) == NULL) {
+ FATAL("cannot find entry getservbyname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+ struct servent * PASCAL
+getservbyport(int a0, const char* a1)
+{
+ static struct servent * (PASCAL *fp)(int a0, const char* a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getservbyport() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getservbyport")) == NULL) {
+ FATAL("cannot find entry getservbyport (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int PASCAL
+_org_gethostname(char* a0, int a1)
+{
+ static int (PASCAL *fp)(char* a0, int a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_gethostname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "gethostname")) == NULL) {
+ FATAL("cannot find entry gethostname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int PASCAL
+WSAAsyncSelect(SOCKET a0, HWND a1, u_int a2, long a3)
+{
+ static int (PASCAL *fp)(SOCKET a0, HWND a1, u_int a2, long a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAsyncSelect() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncSelect")) == NULL) {
+ FATAL("cannot find entry WSAAsyncSelect (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+HANDLE PASCAL
+_org_WSAAsyncGetHostByAddr(HWND a0, u_int a1, const char* a2, int a3, int a4, char* a5, int a6)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, const char* a2, int a3, int a4, char* a5, int a6);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_WSAAsyncGetHostByAddr() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetHostByAddr")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetHostByAddr (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6);
+}
+
+HANDLE PASCAL
+_org_WSAAsyncGetHostByName(HWND a0, u_int a1, const char* a2, char* a3, int a4)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, const char* a2, char* a3, int a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_WSAAsyncGetHostByName() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetHostByName")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetHostByName (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+HANDLE PASCAL
+WSAAsyncGetProtoByNumber(HWND a0, u_int a1, int a2, char* a3, int a4)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, int a2, char* a3, int a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAsyncGetProtoByNumber() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetProtoByNumber")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetProtoByNumber (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+HANDLE PASCAL
+WSAAsyncGetProtoByName(HWND a0, u_int a1, const char* a2, char* a3, int a4)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, const char* a2, char* a3, int a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAsyncGetProtoByName() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetProtoByName")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetProtoByName (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+HANDLE PASCAL
+WSAAsyncGetServByPort(HWND a0, u_int a1, int a2, const char* a3, char* a4, int a5)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, int a2, const char* a3, char* a4, int a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAsyncGetServByPort() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetServByPort")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetServByPort (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+HANDLE PASCAL
+WSAAsyncGetServByName(HWND a0, u_int a1, const char* a2, const char* a3, char* a4, int a5)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, const char* a2, const char* a3, char* a4, int a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAsyncGetServByName() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetServByName")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetServByName (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+int PASCAL
+WSACancelAsyncRequest(HANDLE a0)
+{
+ static int (PASCAL *fp)(HANDLE a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSACancelAsyncRequest() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSACancelAsyncRequest")) == NULL) {
+ FATAL("cannot find entry WSACancelAsyncRequest (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+FARPROC PASCAL
+WSASetBlockingHook(FARPROC a0)
+{
+ static FARPROC (PASCAL *fp)(FARPROC a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASetBlockingHook() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASetBlockingHook")) == NULL) {
+ FATAL("cannot find entry WSASetBlockingHook (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+WSAUnhookBlockingHook(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAUnhookBlockingHook() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAUnhookBlockingHook")) == NULL) {
+ FATAL("cannot find entry WSAUnhookBlockingHook (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+int PASCAL
+WSAGetLastError(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAGetLastError() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAGetLastError")) == NULL) {
+ FATAL("cannot find entry WSAGetLastError (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+void PASCAL
+WSASetLastError(int a0)
+{
+ static void (PASCAL *fp)(int a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASetLastError() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASetLastError")) == NULL) {
+ FATAL("cannot find entry WSASetLastError (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ (*fp)(a0);
+}
+
+int PASCAL
+WSACancelBlockingCall(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSACancelBlockingCall() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSACancelBlockingCall")) == NULL) {
+ FATAL("cannot find entry WSACancelBlockingCall (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+BOOL PASCAL
+WSAIsBlocking(void)
+{
+ static BOOL (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAIsBlocking() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAIsBlocking")) == NULL) {
+ FATAL("cannot find entry WSAIsBlocking (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+int PASCAL
+WSAStartup(WORD a0, LPWSADATA a1)
+{
+ static int (PASCAL *fp)(WORD a0, LPWSADATA a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAStartup() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAStartup")) == NULL) {
+ FATAL("cannot find entry WSAStartup (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int PASCAL
+WSACleanup(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSACleanup() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSACleanup")) == NULL) {
+ FATAL("cannot find entry WSACleanup (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+int PASCAL
+__WSAFDIsSet(SOCKET a0, fd_set* a1)
+{
+ static int (PASCAL *fp)(SOCKET a0, fd_set* a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub __WSAFDIsSet() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "__WSAFDIsSet")) == NULL) {
+ FATAL("cannot find entry __WSAFDIsSet (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int PASCAL
+WEP(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WEP() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WEP")) == NULL) {
+ FATAL("cannot find entry WEP (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+int PASCAL
+WSApSetPostRoutine(int a0)
+{
+ static int (PASCAL *fp)(int a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSApSetPostRoutine() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSApSetPostRoutine")) == NULL) {
+ FATAL("cannot find entry WSApSetPostRoutine (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+WsControl(int a0, int a1, int a2, int a3, int a4, int a5)
+{
+ static int (PASCAL *fp)(int a0, int a1, int a2, int a3, int a4, int a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WsControl() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WsControl")) == NULL) {
+ FATAL("cannot find entry WsControl (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+int PASCAL
+closesockinfo(int a0)
+{
+ static int (PASCAL *fp)(int a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub closesockinfo() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "closesockinfo")) == NULL) {
+ FATAL("cannot find entry closesockinfo (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+Arecv(int a0, int a1, int a2, int a3)
+{
+ static int (PASCAL *fp)(int a0, int a1, int a2, int a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub Arecv() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "Arecv")) == NULL) {
+ FATAL("cannot find entry Arecv (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+int PASCAL
+Asend(int a0, int a1, int a2, int a3)
+{
+ static int (PASCAL *fp)(int a0, int a1, int a2, int a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub Asend() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "Asend")) == NULL) {
+ FATAL("cannot find entry Asend (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+int PASCAL
+WSHEnumProtocols(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSHEnumProtocols() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSHEnumProtocols")) == NULL) {
+ FATAL("cannot find entry WSHEnumProtocols (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+int PASCAL
+inet_network(int a0)
+{
+ static int (PASCAL *fp)(int a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub inet_network() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "inet_network")) == NULL) {
+ FATAL("cannot find entry inet_network (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+getnetbyname(int a0)
+{
+ static int (PASCAL *fp)(int a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getnetbyname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getnetbyname")) == NULL) {
+ FATAL("cannot find entry getnetbyname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+rcmd(int a0, int a1, int a2, int a3, int a4, int a5)
+{
+ static int (PASCAL *fp)(int a0, int a1, int a2, int a3, int a4, int a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub rcmd() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "rcmd")) == NULL) {
+ FATAL("cannot find entry rcmd (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+int PASCAL
+rexec(int a0, int a1, int a2, int a3, int a4, int a5)
+{
+ static int (PASCAL *fp)(int a0, int a1, int a2, int a3, int a4, int a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub rexec() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "rexec")) == NULL) {
+ FATAL("cannot find entry rexec (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+int PASCAL
+rresvport(int a0)
+{
+ static int (PASCAL *fp)(int a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub rresvport() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "rresvport")) == NULL) {
+ FATAL("cannot find entry rresvport (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+sethostname(int a0, int a1)
+{
+ static int (PASCAL *fp)(int a0, int a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub sethostname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "sethostname")) == NULL) {
+ FATAL("cannot find entry sethostname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int PASCAL
+dn_expand(int a0, int a1, int a2, int a3, int a4)
+{
+ static int (PASCAL *fp)(int a0, int a1, int a2, int a3, int a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub dn_expand() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "dn_expand")) == NULL) {
+ FATAL("cannot find entry dn_expand (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+int PASCAL
+WSARecvEx(SOCKET a0, char* a1, int a2, int* a3)
+{
+ static int (PASCAL *fp)(SOCKET a0, char* a1, int a2, int* a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSARecvEx() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSARecvEx")) == NULL) {
+ FATAL("cannot find entry WSARecvEx (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+int PASCAL
+s_perror(int a0, int a1)
+{
+ static int (PASCAL *fp)(int a0, int a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub s_perror() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "s_perror")) == NULL) {
+ FATAL("cannot find entry s_perror (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+INT PASCAL
+GetAddressByNameA(DWORD a0, LPGUID a1, LPSTR a2, LPINT a3, DWORD a4, LPSERVICE_ASYNC_INFO a5, LPVOID a6, LPDWORD a7, LPSTR a8, LPDWORD a9)
+{
+ static INT (PASCAL *fp)(DWORD a0, LPGUID a1, LPSTR a2, LPINT a3, DWORD a4, LPSERVICE_ASYNC_INFO a5, LPVOID a6, LPDWORD a7, LPSTR a8, LPDWORD a9);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub GetAddressByNameA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "GetAddressByNameA")) == NULL) {
+ FATAL("cannot find entry GetAddressByNameA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
+}
+
+INT PASCAL
+GetAddressByNameW(DWORD a0, LPGUID a1, LPWSTR a2, LPINT a3, DWORD a4, LPSERVICE_ASYNC_INFO a5, LPVOID a6, LPDWORD a7, LPWSTR a8, LPDWORD a9)
+{
+ static INT (PASCAL *fp)(DWORD a0, LPGUID a1, LPWSTR a2, LPINT a3, DWORD a4, LPSERVICE_ASYNC_INFO a5, LPVOID a6, LPDWORD a7, LPWSTR a8, LPDWORD a9);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub GetAddressByNameW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "GetAddressByNameW")) == NULL) {
+ FATAL("cannot find entry GetAddressByNameW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
+}
+
+INT PASCAL
+EnumProtocolsA(LPINT a0, LPVOID a1, LPDWORD a2)
+{
+ static INT (PASCAL *fp)(LPINT a0, LPVOID a1, LPDWORD a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub EnumProtocolsA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "EnumProtocolsA")) == NULL) {
+ FATAL("cannot find entry EnumProtocolsA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT PASCAL
+EnumProtocolsW(LPINT a0, LPVOID a1, LPDWORD a2)
+{
+ static INT (PASCAL *fp)(LPINT a0, LPVOID a1, LPDWORD a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub EnumProtocolsW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "EnumProtocolsW")) == NULL) {
+ FATAL("cannot find entry EnumProtocolsW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT PASCAL
+GetTypeByNameA(LPSTR a0, LPGUID a1)
+{
+ static INT (PASCAL *fp)(LPSTR a0, LPGUID a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub GetTypeByNameA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "GetTypeByNameA")) == NULL) {
+ FATAL("cannot find entry GetTypeByNameA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+INT PASCAL
+GetTypeByNameW(LPWSTR a0, LPGUID a1)
+{
+ static INT (PASCAL *fp)(LPWSTR a0, LPGUID a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub GetTypeByNameW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "GetTypeByNameW")) == NULL) {
+ FATAL("cannot find entry GetTypeByNameW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+INT PASCAL
+GetNameByTypeA(LPGUID a0, LPSTR a1, DWORD a2)
+{
+ static INT (PASCAL *fp)(LPGUID a0, LPSTR a1, DWORD a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub GetNameByTypeA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "GetNameByTypeA")) == NULL) {
+ FATAL("cannot find entry GetNameByTypeA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT PASCAL
+GetNameByTypeW(LPGUID a0, LPWSTR a1, DWORD a2)
+{
+ static INT (PASCAL *fp)(LPGUID a0, LPWSTR a1, DWORD a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub GetNameByTypeW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "GetNameByTypeW")) == NULL) {
+ FATAL("cannot find entry GetNameByTypeW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT PASCAL
+SetServiceA(DWORD a0, DWORD a1, DWORD a2, LPSERVICE_INFOA a3, LPSERVICE_ASYNC_INFO a4, LPDWORD a5)
+{
+ static INT (PASCAL *fp)(DWORD a0, DWORD a1, DWORD a2, LPSERVICE_INFOA a3, LPSERVICE_ASYNC_INFO a4, LPDWORD a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub SetServiceA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "SetServiceA")) == NULL) {
+ FATAL("cannot find entry SetServiceA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+INT PASCAL
+SetServiceW(DWORD a0, DWORD a1, DWORD a2, LPSERVICE_INFOW a3, LPSERVICE_ASYNC_INFO a4, LPDWORD a5)
+{
+ static INT (PASCAL *fp)(DWORD a0, DWORD a1, DWORD a2, LPSERVICE_INFOW a3, LPSERVICE_ASYNC_INFO a4, LPDWORD a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub SetServiceW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "SetServiceW")) == NULL) {
+ FATAL("cannot find entry SetServiceW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+INT PASCAL
+GetServiceA(DWORD a0, LPGUID a1, LPSTR a2, DWORD a3, LPVOID a4, LPDWORD a5, LPSERVICE_ASYNC_INFO a6)
+{
+ static INT (PASCAL *fp)(DWORD a0, LPGUID a1, LPSTR a2, DWORD a3, LPVOID a4, LPDWORD a5, LPSERVICE_ASYNC_INFO a6);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub GetServiceA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "GetServiceA")) == NULL) {
+ FATAL("cannot find entry GetServiceA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6);
+}
+
+INT PASCAL
+GetServiceW(DWORD a0, LPGUID a1, LPWSTR a2, DWORD a3, LPVOID a4, LPDWORD a5, LPSERVICE_ASYNC_INFO a6)
+{
+ static INT (PASCAL *fp)(DWORD a0, LPGUID a1, LPWSTR a2, DWORD a3, LPVOID a4, LPDWORD a5, LPSERVICE_ASYNC_INFO a6);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub GetServiceW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "GetServiceW")) == NULL) {
+ FATAL("cannot find entry GetServiceW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6);
+}
+
+int PASCAL
+NPLoadNameSpaces(int a0, int a1, int a2)
+{
+ static int (PASCAL *fp)(int a0, int a1, int a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub NPLoadNameSpaces() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "NPLoadNameSpaces")) == NULL) {
+ FATAL("cannot find entry NPLoadNameSpaces (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+NSPStartup(int a0, int a1)
+{
+ static int (PASCAL *fp)(int a0, int a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub NSPStartup() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "NSPStartup")) == NULL) {
+ FATAL("cannot find entry NSPStartup (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+BOOL PASCAL
+TransmitFile(SOCKET a0, HANDLE a1, DWORD a2, DWORD a3, LPOVERLAPPED a4, LPTRANSMIT_FILE_BUFFERS a5, DWORD a6)
+{
+ static BOOL (PASCAL *fp)(SOCKET a0, HANDLE a1, DWORD a2, DWORD a3, LPOVERLAPPED a4, LPTRANSMIT_FILE_BUFFERS a5, DWORD a6);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub TransmitFile() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "TransmitFile")) == NULL) {
+ FATAL("cannot find entry TransmitFile (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6);
+}
+
+BOOL PASCAL
+AcceptEx(SOCKET a0, SOCKET a1, PVOID a2, DWORD a3, DWORD a4, DWORD a5, LPDWORD a6, LPOVERLAPPED a7)
+{
+ static BOOL (PASCAL *fp)(SOCKET a0, SOCKET a1, PVOID a2, DWORD a3, DWORD a4, DWORD a5, LPDWORD a6, LPOVERLAPPED a7);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub AcceptEx() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "AcceptEx")) == NULL) {
+ FATAL("cannot find entry AcceptEx (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6, a7);
+}
+
+VOID PASCAL
+GetAcceptExSockaddrs(PVOID a0, DWORD a1, DWORD a2, DWORD a3, struct sockaddr** a4, LPINT a5, struct sockaddr** a6, LPINT a7)
+{
+ static VOID (PASCAL *fp)(PVOID a0, DWORD a1, DWORD a2, DWORD a3, struct sockaddr** a4, LPINT a5, struct sockaddr** a6, LPINT a7);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub GetAcceptExSockaddrs() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "GetAcceptExSockaddrs")) == NULL) {
+ FATAL("cannot find entry GetAcceptExSockaddrs (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ (*fp)(a0, a1, a2, a3, a4, a5, a6, a7);
+}
+
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock11/make.wnt b/contrib/idn/idnkit-1.0-src/wsock/wsock11/make.wnt
new file mode 100644
index 0000000..5543a6d
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock11/make.wnt
@@ -0,0 +1,98 @@
+#
+# Makefile for WinSock Wrapper (for WinSock 1.1)
+#
+
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+!include <win32.mak>
+
+SYSLIBS = $(libcdll) kernel32.lib advapi32.lib user32.lib
+
+#
+# Files to use
+#
+
+HDRS = dlldef.h ..\common\wrapcommon.h
+SRCS = dllmain.c dllload.c dllfunc.c dllstub.c
+OBJS = dllmain.obj dllload.obj dllfunc.obj
+LIBS = ..\common\wrapcommon.lib ..\..\lib\idnkit.lib ..\..\win\iconv.lib
+
+cflags = $(cflags) -I..\..\include
+
+#
+# Targets to Build
+#
+
+TARGETS = wsock32.dll
+
+all : $(TARGETS)
+
+wsock32.dll : wsock32.def $(OBJS) $(LIBS)
+ $(link) $(dlllflags) /OUT:wsock32.dll /DEF:wsock32.def $(OBJS) $(LIBS) $(SYSLIBS)
+
+install : $(TARGETS)
+ copy wsock32.dll ..\bin
+
+clean : force
+ -del *.obj
+ -del *.lib
+ -del *.dll
+ -del *.exp
+
+#
+# Dependencies
+#
+
+dllmain.obj : dllmain.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+dllload.obj : dllload.c dllstub.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+
+dllfunc.obj : dllfunc.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+wsock32o.lib : wsock32o.def
+ LIB /DEF:wsock32o.def /MACHINE:IX86
+
+force :
+
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock11/wsock32.def b/contrib/idn/idnkit-1.0-src/wsock/wsock11/wsock32.def
new file mode 100644
index 0000000..5501d26
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock11/wsock32.def
@@ -0,0 +1,87 @@
+;
+; Library Defition for idn wrapper's wrapper DLL
+;
+LIBRARY wsock32
+DESCRIPTION "JPNIC idn wrapper DLL for WSOCK32"
+EXPORTS
+ accept @1
+ bind @2
+ closesocket @3
+ connect @4
+ getpeername @5
+ getsockname @6
+ getsockopt @7
+ htonl @8
+ htons @9
+ inet_addr @10
+ inet_ntoa @11
+ ioctlsocket @12
+ listen @13
+ ntohl @14
+ ntohs @15
+ recv @16
+ recvfrom @17
+ select @18
+ send @19
+ sendto @20
+ setsockopt @21
+ shutdown @22
+ socket @23
+ MigrateWinsockConfiguration @24
+ gethostbyaddr @51
+ gethostbyname @52
+ getprotobyname @53
+ getprotobynumber @54
+ getservbyname @55
+ getservbyport @56
+ gethostname @57
+ WSAAsyncSelect @101
+ WSAAsyncGetHostByAddr @102
+ WSAAsyncGetHostByName @103
+ WSAAsyncGetProtoByNumber @104
+ WSAAsyncGetProtoByName @105
+ WSAAsyncGetServByPort @106
+ WSAAsyncGetServByName @107
+ WSACancelAsyncRequest @108
+ WSASetBlockingHook @109
+ WSAUnhookBlockingHook @110
+ WSAGetLastError @111
+ WSASetLastError @112
+ WSACancelBlockingCall @113
+ WSAIsBlocking @114
+ WSAStartup @115
+ WSACleanup @116
+ __WSAFDIsSet @151
+ WEP @500
+ WSApSetPostRoutine @1000
+ WsControl @1001
+ closesockinfo @1002
+ Arecv @1003
+ Asend @1004
+ WSHEnumProtocols @1005
+ inet_network @1100
+ getnetbyname @1101
+ rcmd @1102
+ rexec @1103
+ rresvport @1104
+ sethostname @1105
+ dn_expand @1106
+ WSARecvEx @1107
+ s_perror @1108
+ GetAddressByNameA @1109
+ GetAddressByNameW @1110
+ EnumProtocolsA @1111
+ EnumProtocolsW @1112
+ GetTypeByNameA @1113
+ GetTypeByNameW @1114
+ GetNameByTypeA @1115
+ GetNameByTypeW @1116
+ SetServiceA @1117
+ SetServiceW @1118
+ GetServiceA @1119
+ GetServiceW @1120
+ NPLoadNameSpaces @1130
+ NSPStartup @1131
+ TransmitFile @1140
+ AcceptEx @1141
+ GetAcceptExSockaddrs @1142
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock20/dlldef.h b/contrib/idn/idnkit-1.0-src/wsock/wsock20/dlldef.h
new file mode 100644
index 0000000..52a2567
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock20/dlldef.h
@@ -0,0 +1,123 @@
+/*
+ * dlldef.h
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef _DLLDEF_H
+#define _DLLDEF_H
+
+#include "../common/wrapcommon.h"
+
+/*
+ * Execution Tracing
+ */
+
+extern int procPid;
+
+#ifdef DEBUG
+#define TRACE idnPrintf
+#define FATAL idnPrintf
+#else
+#define TRACE
+#define FATAL idnPrintf
+#endif
+
+/*
+ * entry points to wrap
+ */
+
+extern int WSAAPI
+_org_gethostname(char FAR * name, int namelen);
+
+extern struct hostent FAR * WSAAPI
+_org_gethostbyaddr(const char FAR * addr, int len, int type);
+
+extern struct hostent FAR * WSAAPI
+_org_gethostbyname(const char FAR * name);
+
+extern HANDLE WSAAPI
+_org_WSAAsyncGetHostByName(HWND hWnd, u_int wMsg, const char FAR * name,
+ char FAR * buf,int buflen);
+
+extern HANDLE WSAAPI
+_org_WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, const char FAR * addr,
+ int len, int type, char FAR * buf, int buflen);
+
+extern INT WSAAPI
+_org_WSALookupServiceBeginA(LPWSAQUERYSETA lpqsRestrictions,
+ DWORD dwControlFlags,
+ LPHANDLE lphLookup);
+
+extern INT WSAAPI
+_org_WSALookupServiceBeginW(LPWSAQUERYSETW lpqsRestrictions,
+ DWORD dwControlFlags,
+ LPHANDLE lphLookup);
+
+extern INT WSAAPI
+_org_WSALookupServiceNextA(HANDLE hLookup,
+ DWORD dwControlFlags,
+ LPDWORD lpdwBufferLength,
+ LPWSAQUERYSETA lpqsResults);
+
+extern INT WSAAPI
+_org_WSALookupServiceNextW(HANDLE hLookup,
+ DWORD dwControlFlags,
+ LPDWORD lpdwBufferLength,
+ LPWSAQUERYSETW lpqsResults);
+
+extern INT WSAAPI
+_org_WSALookupServiceEnd(HANDLE hLookup);
+
+extern int WSAAPI
+_org_getaddrinfo(const char *nodename, const char *servname,
+ LPVOID hints, LPVOID res);
+
+extern void WSAAPI
+_org_freeaddrinfo(LPVOID aip);
+
+extern int WSAAPI
+_org_getnameinfo(LPVOID sa, DWORD salen, char* host, DWORD hostlen,
+ char* serv, DWORD servlen, int flags);
+
+#endif /* _DLLDEF_H */
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllfunc.c b/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllfunc.c
new file mode 100644
index 0000000..cec2d06
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllfunc.c
@@ -0,0 +1,592 @@
+/*
+ * dllfunc.c - wrapper functions
+ */
+
+/*
+ * Copyright (c) 2000,2002 Japan Network Information Center.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <svcguid.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <process.h>
+
+#include "dlldef.h"
+
+#ifndef EAI_MEMORY
+#define EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
+#endif
+#ifndef EAI_FAIL
+#define EAI_FAIL WSANO_RECOVERY
+#endif
+
+static GUID guid_habn = SVCID_INET_HOSTADDRBYNAME;
+static GUID guid_habis = SVCID_INET_HOSTADDRBYINETSTRING;
+
+#define SVCID_IS_HABN(p) (memcmp(p, &guid_habn, sizeof(GUID)) == 0)
+#define SVCID_IS_HABIS(p) (memcmp(p, &guid_habis, sizeof(GUID)) == 0)
+
+/*
+ * Rename addrinfo to my_addrinfo for avoiding possible name conflict.
+ */
+struct my_addrinfo {
+ int ai_flags;
+ int ai_family;
+ int ai_socktype;
+ int ai_protocol;
+ size_t ai_addrlen;
+ char *ai_canonname;
+ struct sockaddr *ai_addr;
+ struct my_addrinfo *ai_next;
+};
+
+typedef struct obj_lock {
+ void *key;
+ struct obj_lock *next;
+} obj_lock_t;
+
+#define OBJLOCKHASH_SIZE 127
+static obj_lock_t *obj_lock_hash[OBJLOCKHASH_SIZE];
+
+static int obj_hash(void *key);
+static int obj_islocked(void *key);
+static void obj_lock(void *key);
+static void obj_unlock(void *key);
+static char *decode_name_dynamic(const char *name, idn_resconf_t idnctx);
+static struct my_addrinfo
+ *copy_decode_addrinfo_dynamic(struct my_addrinfo *aip,
+ idn_resconf_t idnctx);
+static void free_copied_addrinfo(struct my_addrinfo *aip);
+
+WRAPPER_EXPORT int WSAAPI
+gethostname(char FAR * name, int namelen) {
+ int ret;
+
+ TRACE("ENTER gethostname\n");
+ ret = _org_gethostname(name, namelen);
+ TRACE("LEAVE gethostname %d <%-.100s>\n", ret, name);
+
+ return (ret);
+}
+
+WRAPPER_EXPORT struct hostent FAR * WSAAPI
+gethostbyname(const char FAR * name) {
+ struct hostent FAR *ret;
+ char nbuff[256];
+ char hbuff[256];
+ BOOL stat;
+ idn_resconf_t encodeCtx;
+
+ TRACE("ENTER gethostbyname <%-.100s>\n",
+ (name != NULL ? name : "NULL"));
+
+ encodeCtx = idnGetContext();
+
+ if (encodeCtx == NULL || name == NULL) {
+ ret = _org_gethostbyname(name);
+ } else {
+ stat = idnConvReq(encodeCtx, name, nbuff, sizeof(nbuff));
+ if (stat == FALSE) {
+ TRACE("idnConvReq failed\n");
+ ret = NULL;
+ } else {
+ TRACE("Converted Name <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ ret = _org_gethostbyname(nbuff);
+ }
+ }
+
+ if (ret != NULL && encodeCtx != NULL) {
+ TRACE("Resulting Name <%s>\n",
+ dumpName(ret->h_name, hbuff, sizeof(hbuff)));
+ stat = idnConvRsp(encodeCtx, ret->h_name,
+ nbuff, sizeof(nbuff));
+ if (stat == FALSE) {
+ TRACE("Decoding failed - return the name verbatim\n");
+ } else {
+ TRACE("Converted Back <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ strcpy(ret->h_name, nbuff);
+ }
+ }
+
+ if (ret == NULL) {
+ TRACE("LEAVE gethostbyname NULL\n");
+ } else {
+ TRACE("LEAVE gethostbyname <%s>\n",
+ dumpHost(ret, hbuff, sizeof(hbuff)));
+ }
+ return (ret);
+}
+
+WRAPPER_EXPORT struct hostent FAR * WSAAPI
+gethostbyaddr(const char FAR * addr, int len, int type) {
+ struct hostent FAR *ret;
+ char nbuff[256];
+ char abuff[256];
+ char hbuff[256];
+ BOOL stat;
+ idn_resconf_t encodeCtx;
+
+ TRACE("ENTER gethostbyaddr <%s>\n",
+ dumpAddr(addr, len, abuff, sizeof(abuff)));
+
+ encodeCtx = idnGetContext();
+
+ ret = _org_gethostbyaddr(addr, len, type);
+
+ if (ret != NULL && encodeCtx != NULL) {
+ TRACE("Resulting Name <%s>\n",
+ dumpName(ret->h_name, hbuff, sizeof(hbuff)));
+ stat = idnConvRsp(encodeCtx, ret->h_name,
+ nbuff, sizeof(nbuff));
+ if (stat == FALSE) {
+ TRACE("Decoding failed - return the name verbatim\n");
+ } else {
+ TRACE("Converted Back <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ strcpy(ret->h_name, nbuff);
+ }
+ }
+
+ if (ret == NULL) {
+ TRACE("LEAVE gethostbyaddr NULL\n");
+ } else {
+ TRACE("LEAVE gethostbyaddr <%s>\n",
+ dumpHost(ret, hbuff, sizeof(hbuff)));
+ }
+ return (ret);
+}
+
+WRAPPER_EXPORT HANDLE WSAAPI
+WSAAsyncGetHostByName(HWND hWnd, u_int wMsg,
+ const char FAR * name, char FAR * buf, int buflen)
+{
+ HANDLE ret;
+ char nbuff[256];
+ char hbuff[256];
+ idn_resconf_t encodeCtx;
+
+ TRACE("ENTER WSAAsyncGetHostByName <%-.100s>\n", name);
+
+ encodeCtx = idnGetContext();
+
+ if (encodeCtx == NULL || name == NULL) {
+ ret = _org_WSAAsyncGetHostByName(hWnd, wMsg,
+ name, buf, buflen);
+ } else {
+ idnHook(hWnd, wMsg, buf, encodeCtx);
+ idnConvReq(encodeCtx, name, nbuff, sizeof(nbuff));
+ TRACE("Converted Name <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ ret = _org_WSAAsyncGetHostByName(hWnd, wMsg, nbuff,
+ buf, buflen);
+ }
+
+ TRACE("LEAVE WSAAsyncGetHostByName HANDLE %08x\n", ret);
+
+ return (ret);
+}
+
+WRAPPER_EXPORT HANDLE WSAAPI
+WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, const char FAR * addr,
+ int len, int type, char FAR * buf, int buflen)
+{
+ HANDLE ret;
+ char abuff[256];
+ idn_resconf_t encodeCtx;
+
+ encodeCtx = idnGetContext();
+
+ if (encodeCtx != NULL) {
+ idnHook(hWnd, wMsg, buf, encodeCtx);
+ }
+
+ TRACE("ENTER WSAAsyncGetHostByAddr <%s>\n",
+ dumpAddr(addr, len, abuff, sizeof(abuff)));
+ ret = _org_WSAAsyncGetHostByAddr(hWnd, wMsg, addr, len, type,
+ buf, buflen);
+ TRACE("LEAVE WSAAsyncGetHostByAddr HANDLE %08x\n", ret);
+
+ return (ret);
+}
+
+WRAPPER_EXPORT INT WSAAPI
+WSALookupServiceBeginA(LPWSAQUERYSETA lpqsRestrictions,
+ DWORD dwControlFlags, LPHANDLE lphLookup)
+{
+ INT ret;
+ char nbuff[256];
+ char hbuff[256];
+ LPSTR name = lpqsRestrictions->lpszServiceInstanceName;
+ LPGUID class = lpqsRestrictions->lpServiceClassId;
+ idn_resconf_t encodeCtx;
+
+ TRACE("ENTER WSALookupServiceBeginA <%-.100s>\n",
+ name == NULL ? "<NULL>" : name);
+
+ encodeCtx = idnGetContext();
+
+ if (name != NULL && encodeCtx != NULL && SVCID_IS_HABN(class) == 0) {
+ idnConvReq(encodeCtx, name, nbuff, sizeof(nbuff));
+ TRACE("Converted Name <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ /* strcpy(lpqsRestrictions->lpszQueryString, nbuff); */
+ lpqsRestrictions->lpszServiceInstanceName = nbuff;
+ }
+ ret = _org_WSALookupServiceBeginA(lpqsRestrictions,
+ dwControlFlags, lphLookup);
+ TRACE("LEAVE WSALookupServiceBeginA %d\n", ret);
+
+ return (ret);
+}
+
+WRAPPER_EXPORT INT WSAAPI
+WSALookupServiceNextA(HANDLE hLookup, DWORD dwControlFlags,
+ LPDWORD lpdwBufferLength, LPWSAQUERYSETA lpqsResults)
+{
+ INT ret;
+ char nbuff[256];
+ char hbuff[256];
+ LPGUID class;
+ idn_resconf_t encodeCtx;
+
+ TRACE("ENTER WSALookupServiceNextA\n");
+
+ encodeCtx = idnGetContext();
+
+ ret = _org_WSALookupServiceNextA(hLookup, dwControlFlags,
+ lpdwBufferLength, lpqsResults);
+ class = lpqsResults->lpServiceClassId;
+
+ if (ret == 0 &&
+ encodeCtx != NULL &&
+ (dwControlFlags & LUP_RETURN_NAME) &&
+ (SVCID_IS_HABN(class) || SVCID_IS_HABIS(class))) {
+ TRACE("Resulting Name <%s>\n",
+ dumpName(lpqsResults->lpszServiceInstanceName,
+ hbuff, sizeof(hbuff)));
+ if (idnConvRsp(encodeCtx,
+ lpqsResults->lpszServiceInstanceName,
+ nbuff, sizeof(nbuff)) == FALSE) {
+ TRACE("Decoding failed - return the name verbatim\n");
+ } else {
+ TRACE("Converted Back <%s>\n",
+ dumpName(nbuff, hbuff, sizeof(hbuff)));
+ strcpy(lpqsResults->lpszServiceInstanceName, nbuff);
+ }
+ }
+ TRACE("LEAVE WSALookupServiceNextA %d <%s>\n", ret, nbuff);
+
+ return (ret);
+}
+
+WRAPPER_EXPORT INT WSAAPI
+WSALookupServiceBeginW(LPWSAQUERYSETW lpqsRestrictions,
+ DWORD dwControlFlags, LPHANDLE lphLookup)
+{
+ INT ret;
+
+ TRACE("ENTER WSALookupServiceBeginW\n");
+ ret = _org_WSALookupServiceBeginW(lpqsRestrictions,
+ dwControlFlags,lphLookup);
+ TRACE("LEAVE WSALookupServiceBeginW %d\n", ret);
+
+ return (ret);
+}
+
+WRAPPER_EXPORT INT WSAAPI
+WSALookupServiceNextW(HANDLE hLookup, DWORD dwControlFlags,
+ LPDWORD lpdwBufferLength, LPWSAQUERYSETW lpqsResults)
+{
+ INT ret;
+
+ TRACE("ENTER WSALookupServiceNextW\n");
+ ret = _org_WSALookupServiceNextW(hLookup, dwControlFlags,
+ lpdwBufferLength, lpqsResults);
+ TRACE("LEAVE WSALookupServiceNextW %d\n", ret);
+
+ return (ret);
+}
+
+WRAPPER_EXPORT INT WSAAPI
+WSALookupServiceEnd(HANDLE hLookup) {
+ INT ret;
+
+ TRACE("ENTER WSALookupServiceEnd\n");
+ ret = _org_WSALookupServiceEnd(hLookup);
+ TRACE("LEAVE WSALookupServiceEnd %d\n", ret);
+
+ return (ret);
+}
+
+static int
+obj_hash(void *key) {
+ /*
+ * Hash function for obj_*.
+ * 'key' is supposed to be an address.
+ */
+ unsigned long v = (unsigned long)key;
+
+ return ((v >> 3) % OBJLOCKHASH_SIZE);
+}
+
+static int
+obj_islocked(void *key)
+{
+ /*
+ * Check if the object specified by 'key' is locked.
+ * Return 1 if so, 0 otherwise.
+ */
+ int h = obj_hash(key);
+ obj_lock_t *olp = obj_lock_hash[h];
+
+ while (olp != NULL) {
+ if (olp->key == key)
+ return (1);
+ olp = olp->next;
+ }
+ return (0);
+}
+
+static void
+obj_lock(void *key)
+{
+ /*
+ * Lock an object specified by 'key'.
+ */
+ int h = obj_hash(key);
+ obj_lock_t *olp;
+
+ olp = malloc(sizeof(obj_lock_t));
+ if (olp != NULL) {
+ olp->key = key;
+ olp->next = obj_lock_hash[h];
+ obj_lock_hash[h] = olp;
+ }
+}
+
+static void
+obj_unlock(void *key)
+{
+ /*
+ * Unlock an object specified by 'key'.
+ */
+ int h = obj_hash(key);
+ obj_lock_t *olp, *olp0;
+
+ olp = obj_lock_hash[h];
+ olp0 = NULL;
+ while (olp != NULL) {
+ if (olp->key == key) {
+ if (olp0 == NULL)
+ obj_lock_hash[h] = olp->next;
+ else
+ olp0->next = olp->next;
+ free(olp);
+ return;
+ }
+ olp0 = olp;
+ olp = olp->next;
+ }
+}
+
+static char *
+decode_name_dynamic(const char *name, idn_resconf_t idnctx) {
+ BOOL stat;
+ char buf[256], tmp[256];
+ char *s;
+
+ if (idnConvRsp(idnctx, name, buf, sizeof(buf)) == TRUE) {
+ TRACE("Converted Back <%s>\n",
+ dumpName(buf, tmp, sizeof(tmp)));
+ name = buf;
+ } else {
+ TRACE("Decoding failed - return the name verbatim\n");
+ }
+ s = malloc(strlen(name) + 1);
+ if (s == NULL)
+ return (NULL);
+ else
+ return (strcpy(s, name));
+}
+
+static struct my_addrinfo *
+copy_decode_addrinfo_dynamic(struct my_addrinfo *aip, idn_resconf_t idnctx)
+{
+ struct my_addrinfo *newaip;
+
+ if (aip == NULL)
+ return (NULL);
+
+ newaip = malloc(sizeof(struct my_addrinfo) + aip->ai_addrlen);
+ if (newaip == NULL)
+ return (NULL);
+
+ *newaip = *aip;
+ newaip->ai_addr = (struct sockaddr *)(newaip + 1);
+ memcpy(newaip->ai_addr, aip->ai_addr, aip->ai_addrlen);
+
+ if (newaip->ai_canonname != NULL)
+ newaip->ai_canonname = decode_name_dynamic(aip->ai_canonname,
+ idnctx);
+
+ newaip->ai_next = copy_decode_addrinfo_dynamic(aip->ai_next, idnctx);
+ return (newaip);
+}
+
+static void
+free_copied_addrinfo(struct my_addrinfo *aip) {
+ while (aip != NULL) {
+ struct my_addrinfo *next = aip->ai_next;
+
+ if (aip->ai_canonname != NULL)
+ free(aip->ai_canonname);
+ free(aip);
+ aip = next;
+ }
+}
+
+WRAPPER_EXPORT int WSAAPI
+getaddrinfo(const char *nodename, const char *servname,
+ const struct my_addrinfo *hints, struct my_addrinfo **res)
+{
+ char namebuf[256];
+ BOOL stat;
+ struct my_addrinfo *aip;
+ int err;
+ idn_resconf_t encodeCtx;
+
+ TRACE("ENTER getaddrinfo <%-.100s>\n", nodename ? nodename : "NULL");
+
+ encodeCtx = idnGetContext();
+
+ if (nodename == NULL || encodeCtx == NULL) {
+ TRACE("conversion unnecessary\n");
+ err = _org_getaddrinfo(nodename, servname, hints, res);
+ } else {
+ stat = idnConvReq(encodeCtx, nodename,
+ namebuf, sizeof(namebuf));
+ if (stat == TRUE) {
+ nodename = namebuf;
+ TRACE("Converted Name <%-.100s>\n", namebuf);
+ }
+
+ err = _org_getaddrinfo(nodename, servname, hints, &aip);
+ if (err == 0 && aip != NULL) {
+ *res = copy_decode_addrinfo_dynamic(aip, encodeCtx);
+ if (*res == NULL)
+ err = EAI_FAIL;
+ else
+ obj_lock(*res);
+ if (aip != NULL)
+ _org_freeaddrinfo(aip);
+ }
+ }
+
+ TRACE("LEAVE getaddrinfo %d\n", err);
+ return (err);
+}
+
+WRAPPER_EXPORT void WSAAPI
+freeaddrinfo(struct my_addrinfo *aip) {
+ TRACE("ENTER freeaddrinfo aip=%p\n", (void *)aip);
+
+ if (obj_islocked(aip)) {
+ /*
+ * We allocated the data.
+ */
+ obj_unlock(aip);
+ free_copied_addrinfo(aip);
+ } else {
+ /*
+ * It was allocated the original getaddrinfo().
+ */
+ TRACE("Not allocated by the wrapper\n");
+ _org_freeaddrinfo(aip);
+ }
+ TRACE("LEAVE freeaddrinfo\n");
+}
+
+WRAPPER_EXPORT int WSAAPI
+getnameinfo(const struct sockaddr *sa, DWORD salen,
+ char *host, DWORD hostlen, char *serv,
+ DWORD servlen, int flags)
+{
+ char name[256];
+ size_t namelen = sizeof(name);
+ int code;
+ BOOL stat;
+ idn_resconf_t encodeCtx;
+
+ TRACE("ENTER getnameinfo\n");
+
+ encodeCtx = idnGetContext();
+
+ if (host == NULL || hostlen == 0 || encodeCtx == NULL) {
+ TRACE("conversion unnecessary\n");
+ code = _org_getnameinfo(sa, salen, host, hostlen,
+ serv, servlen, flags);
+ } else {
+ code = _org_getnameinfo(sa, salen, name, namelen,
+ serv, servlen, flags);
+ if (code == 0 && name[0] != '\0') {
+ stat = idnConvRsp(encodeCtx, name, host, hostlen);
+ if (stat == FALSE) {
+ TRACE("Decoding failed - return the name verbatim\n");
+ if (strlen(name) >= hostlen) {
+ code = EAI_FAIL;
+ } else {
+ strcpy(host, name);
+ }
+ } else {
+ TRACE("Converted Back <%s>\n",
+ dumpName(host, name, sizeof(name)));
+ }
+ }
+ }
+
+ TRACE("LEAVE getnameinfo %d\n", code);
+ return (code);
+}
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllload.c b/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllload.c
new file mode 100644
index 0000000..0f1257e
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllload.c
@@ -0,0 +1,62 @@
+/*
+ * dllload.c - load original entries
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <winsock2.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <process.h>
+
+#include "dlldef.h"
+
+/*
+ * Manages original DLL
+ */
+
+#define DLLHANDLE idnWinsockHandle()
+
+#include "dllstub.c"
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllmain.c b/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllmain.c
new file mode 100644
index 0000000..c6609bc
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllmain.c
@@ -0,0 +1,94 @@
+/*
+ * dllmain.c - entry for DLL
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+ * Chiyoda-ku, Tokyo 101-0047, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+ *
+ * 4. The name of JPNIC may not be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <process.h>
+
+#include "dlldef.h"
+
+/*
+ * Control Variables
+ */
+
+int procPid = 0;
+
+static char procExe[256];
+
+/*
+ * DLL Entry
+ */
+
+BOOL APIENTRY
+DllMain(HMODULE hmod, DWORD reason, LPVOID *resv) {
+ switch (reason) {
+ case DLL_PROCESS_ATTACH:
+ procPid = getpid();
+ GetModuleFileName(NULL, procExe, 256);
+
+ idnLogInit("ws20");
+ idnHookInit();
+
+ TRACE("Attached to Process <%s>\n", procExe);
+ return (idnWinsockVersion("2.0"));
+
+ case DLL_PROCESS_DETACH:
+ idnConvDone(idnGetContext());
+ idnHookDone();
+ TRACE("Detached from Process\n");
+ idnLogFinish();
+ break;
+
+ case DLL_THREAD_ATTACH:
+ break;
+ case DLL_THREAD_DETACH:
+ break;
+ }
+
+ return (TRUE);
+}
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllstub.c b/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllstub.c
new file mode 100644
index 0000000..afc4537
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock20/dllstub.c
@@ -0,0 +1,2168 @@
+/* $Id: dllstub.c,v 1.1.1.1 2003/06/04 00:27:51 marka Exp $ */
+
+SOCKET PASCAL
+accept(SOCKET a0, struct sockaddr* a1, int* a2)
+{
+ static SOCKET (PASCAL *fp)(SOCKET a0, struct sockaddr* a1, int* a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub accept() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "accept")) == NULL) {
+ FATAL("cannot find entry accept (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+bind(SOCKET a0, const struct sockaddr* a1, int a2)
+{
+ static int (PASCAL *fp)(SOCKET a0, const struct sockaddr* a1, int a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub bind() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "bind")) == NULL) {
+ FATAL("cannot find entry bind (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+closesocket(SOCKET a0)
+{
+ static int (PASCAL *fp)(SOCKET a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub closesocket() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "closesocket")) == NULL) {
+ FATAL("cannot find entry closesocket (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+connect(SOCKET a0, const struct sockaddr* a1, int a2)
+{
+ static int (PASCAL *fp)(SOCKET a0, const struct sockaddr* a1, int a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub connect() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "connect")) == NULL) {
+ FATAL("cannot find entry connect (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+getpeername(SOCKET a0, struct sockaddr* a1, int* a2)
+{
+ static int (PASCAL *fp)(SOCKET a0, struct sockaddr* a1, int* a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getpeername() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getpeername")) == NULL) {
+ FATAL("cannot find entry getpeername (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+getsockname(SOCKET a0, struct sockaddr* a1, int* a2)
+{
+ static int (PASCAL *fp)(SOCKET a0, struct sockaddr* a1, int* a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getsockname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getsockname")) == NULL) {
+ FATAL("cannot find entry getsockname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+getsockopt(SOCKET a0, int a1, int a2, char* a3, int* a4)
+{
+ static int (PASCAL *fp)(SOCKET a0, int a1, int a2, char* a3, int* a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getsockopt() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getsockopt")) == NULL) {
+ FATAL("cannot find entry getsockopt (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+u_long PASCAL
+htonl(u_long a0)
+{
+ static u_long (PASCAL *fp)(u_long a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub htonl() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "htonl")) == NULL) {
+ FATAL("cannot find entry htonl (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+u_short PASCAL
+htons(u_short a0)
+{
+ static u_short (PASCAL *fp)(u_short a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub htons() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "htons")) == NULL) {
+ FATAL("cannot find entry htons (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+ioctlsocket(SOCKET a0, long a1, u_long * a2)
+{
+ static int (PASCAL *fp)(SOCKET a0, long a1, u_long * a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub ioctlsocket() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "ioctlsocket")) == NULL) {
+ FATAL("cannot find entry ioctlsocket (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+unsigned long PASCAL
+inet_addr(const char* a0)
+{
+ static unsigned long (PASCAL *fp)(const char* a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub inet_addr() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "inet_addr")) == NULL) {
+ FATAL("cannot find entry inet_addr (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+ char * PASCAL
+inet_ntoa(struct in_addr a0)
+{
+ static char * (PASCAL *fp)(struct in_addr a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub inet_ntoa() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "inet_ntoa")) == NULL) {
+ FATAL("cannot find entry inet_ntoa (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+listen(SOCKET a0, int a1)
+{
+ static int (PASCAL *fp)(SOCKET a0, int a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub listen() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "listen")) == NULL) {
+ FATAL("cannot find entry listen (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+u_long PASCAL
+ntohl(u_long a0)
+{
+ static u_long (PASCAL *fp)(u_long a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub ntohl() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "ntohl")) == NULL) {
+ FATAL("cannot find entry ntohl (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+u_short PASCAL
+ntohs(u_short a0)
+{
+ static u_short (PASCAL *fp)(u_short a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub ntohs() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "ntohs")) == NULL) {
+ FATAL("cannot find entry ntohs (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+recv(SOCKET a0, char* a1, int a2, int a3)
+{
+ static int (PASCAL *fp)(SOCKET a0, char* a1, int a2, int a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub recv() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "recv")) == NULL) {
+ FATAL("cannot find entry recv (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+int PASCAL
+recvfrom(SOCKET a0, char* a1, int a2, int a3, struct sockaddr* a4, int* a5)
+{
+ static int (PASCAL *fp)(SOCKET a0, char* a1, int a2, int a3, struct sockaddr* a4, int* a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub recvfrom() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "recvfrom")) == NULL) {
+ FATAL("cannot find entry recvfrom (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+int PASCAL
+select(int a0, fd_set* a1, fd_set* a2, fd_set* a3, const struct timeval* a4)
+{
+ static int (PASCAL *fp)(int a0, fd_set* a1, fd_set* a2, fd_set* a3, const struct timeval* a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub select() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "select")) == NULL) {
+ FATAL("cannot find entry select (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+int PASCAL
+send(SOCKET a0, const char* a1, int a2, int a3)
+{
+ static int (PASCAL *fp)(SOCKET a0, const char* a1, int a2, int a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub send() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "send")) == NULL) {
+ FATAL("cannot find entry send (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+int PASCAL
+sendto(SOCKET a0, const char* a1, int a2, int a3, const struct sockaddr* a4, int a5)
+{
+ static int (PASCAL *fp)(SOCKET a0, const char* a1, int a2, int a3, const struct sockaddr* a4, int a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub sendto() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "sendto")) == NULL) {
+ FATAL("cannot find entry sendto (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+int PASCAL
+setsockopt(SOCKET a0, int a1, int a2, const char* a3, int a4)
+{
+ static int (PASCAL *fp)(SOCKET a0, int a1, int a2, const char* a3, int a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub setsockopt() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "setsockopt")) == NULL) {
+ FATAL("cannot find entry setsockopt (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+int PASCAL
+shutdown(SOCKET a0, int a1)
+{
+ static int (PASCAL *fp)(SOCKET a0, int a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub shutdown() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "shutdown")) == NULL) {
+ FATAL("cannot find entry shutdown (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+SOCKET PASCAL
+socket(int a0, int a1, int a2)
+{
+ static SOCKET (PASCAL *fp)(int a0, int a1, int a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub socket() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "socket")) == NULL) {
+ FATAL("cannot find entry socket (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int PASCAL
+WSApSetPostRoutine(int a0)
+{
+ static int (PASCAL *fp)(int a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSApSetPostRoutine() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSApSetPostRoutine")) == NULL) {
+ FATAL("cannot find entry WSApSetPostRoutine (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+WSAEVENT WSAAPI
+WPUCompleteOverlappedRequest(SOCKET a0, LPWSAOVERLAPPED a1, DWORD a2, DWORD a3, LPINT a4)
+{
+ static WSAEVENT (WSAAPI *fp)(SOCKET a0, LPWSAOVERLAPPED a1, DWORD a2, DWORD a3, LPINT a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WPUCompleteOverlappedRequest() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WPUCompleteOverlappedRequest")) == NULL) {
+ FATAL("cannot find entry WPUCompleteOverlappedRequest (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+SOCKET WINAPI
+WSAAccept(SOCKET a0, struct sockaddr * a1, LPINT a2, LPCONDITIONPROC a3, DWORD a4)
+{
+ static SOCKET (WINAPI *fp)(SOCKET a0, struct sockaddr * a1, LPINT a2, LPCONDITIONPROC a3, DWORD a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAccept() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAccept")) == NULL) {
+ FATAL("cannot find entry WSAAccept (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+INT WINAPI
+WSAAddressToStringA(LPSOCKADDR a0, DWORD a1, LPWSAPROTOCOL_INFOA a2, LPSTR a3, LPDWORD a4)
+{
+ static INT (WINAPI *fp)(LPSOCKADDR a0, DWORD a1, LPWSAPROTOCOL_INFOA a2, LPSTR a3, LPDWORD a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAddressToStringA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAddressToStringA")) == NULL) {
+ FATAL("cannot find entry WSAAddressToStringA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+INT WINAPI
+WSAAddressToStringW(LPSOCKADDR a0, DWORD a1, LPWSAPROTOCOL_INFOW a2, LPWSTR a3, LPDWORD a4)
+{
+ static INT (WINAPI *fp)(LPSOCKADDR a0, DWORD a1, LPWSAPROTOCOL_INFOW a2, LPWSTR a3, LPDWORD a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAddressToStringW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAddressToStringW")) == NULL) {
+ FATAL("cannot find entry WSAAddressToStringW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+BOOL WINAPI
+WSACloseEvent(WSAEVENT a0)
+{
+ static BOOL (WINAPI *fp)(WSAEVENT a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSACloseEvent() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSACloseEvent")) == NULL) {
+ FATAL("cannot find entry WSACloseEvent (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int WINAPI
+WSAConnect(SOCKET a0, const struct sockaddr * a1, int a2, LPWSABUF a3, LPWSABUF a4, LPQOS a5, LPQOS a6)
+{
+ static int (WINAPI *fp)(SOCKET a0, const struct sockaddr * a1, int a2, LPWSABUF a3, LPWSABUF a4, LPQOS a5, LPQOS a6);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAConnect() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAConnect")) == NULL) {
+ FATAL("cannot find entry WSAConnect (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6);
+}
+
+WSAEVENT WINAPI
+WSACreateEvent(void)
+{
+ static WSAEVENT (WINAPI *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSACreateEvent() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSACreateEvent")) == NULL) {
+ FATAL("cannot find entry WSACreateEvent (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+int WINAPI
+WSADuplicateSocketA(SOCKET a0, DWORD a1, LPWSAPROTOCOL_INFOA a2)
+{
+ static int (WINAPI *fp)(SOCKET a0, DWORD a1, LPWSAPROTOCOL_INFOA a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSADuplicateSocketA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSADuplicateSocketA")) == NULL) {
+ FATAL("cannot find entry WSADuplicateSocketA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int WINAPI
+WSADuplicateSocketW(SOCKET a0, DWORD a1, LPWSAPROTOCOL_INFOW a2)
+{
+ static int (WINAPI *fp)(SOCKET a0, DWORD a1, LPWSAPROTOCOL_INFOW a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSADuplicateSocketW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSADuplicateSocketW")) == NULL) {
+ FATAL("cannot find entry WSADuplicateSocketW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT WINAPI
+WSAEnumNameSpaceProvidersA(LPDWORD a0, LPWSANAMESPACE_INFOA a1)
+{
+ static INT (WINAPI *fp)(LPDWORD a0, LPWSANAMESPACE_INFOA a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAEnumNameSpaceProvidersA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAEnumNameSpaceProvidersA")) == NULL) {
+ FATAL("cannot find entry WSAEnumNameSpaceProvidersA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+INT WINAPI
+WSAEnumNameSpaceProvidersW(LPDWORD a0, LPWSANAMESPACE_INFOW a1)
+{
+ static INT (WINAPI *fp)(LPDWORD a0, LPWSANAMESPACE_INFOW a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAEnumNameSpaceProvidersW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAEnumNameSpaceProvidersW")) == NULL) {
+ FATAL("cannot find entry WSAEnumNameSpaceProvidersW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int WINAPI
+WSAEnumNetworkEvents(SOCKET a0, WSAEVENT a1, LPWSANETWORKEVENTS a2)
+{
+ static int (WINAPI *fp)(SOCKET a0, WSAEVENT a1, LPWSANETWORKEVENTS a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAEnumNetworkEvents() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAEnumNetworkEvents")) == NULL) {
+ FATAL("cannot find entry WSAEnumNetworkEvents (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int WINAPI
+WSAEnumProtocolsA(LPINT a0, LPWSAPROTOCOL_INFOA a1, LPDWORD a2)
+{
+ static int (WINAPI *fp)(LPINT a0, LPWSAPROTOCOL_INFOA a1, LPDWORD a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAEnumProtocolsA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAEnumProtocolsA")) == NULL) {
+ FATAL("cannot find entry WSAEnumProtocolsA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int WINAPI
+WSAEnumProtocolsW(LPINT a0, LPWSAPROTOCOL_INFOW a1, LPDWORD a2)
+{
+ static int (WINAPI *fp)(LPINT a0, LPWSAPROTOCOL_INFOW a1, LPDWORD a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAEnumProtocolsW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAEnumProtocolsW")) == NULL) {
+ FATAL("cannot find entry WSAEnumProtocolsW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int WINAPI
+WSAEventSelect(SOCKET a0, WSAEVENT a1, long a2)
+{
+ static int (WINAPI *fp)(SOCKET a0, WSAEVENT a1, long a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAEventSelect() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAEventSelect")) == NULL) {
+ FATAL("cannot find entry WSAEventSelect (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+BOOL WINAPI
+WSAGetOverlappedResult(SOCKET a0, LPWSAOVERLAPPED a1, LPDWORD a2, BOOL a3, LPDWORD a4)
+{
+ static BOOL (WINAPI *fp)(SOCKET a0, LPWSAOVERLAPPED a1, LPDWORD a2, BOOL a3, LPDWORD a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAGetOverlappedResult() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAGetOverlappedResult")) == NULL) {
+ FATAL("cannot find entry WSAGetOverlappedResult (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+BOOL WINAPI
+WSAGetQOSByName(SOCKET a0, LPWSABUF a1, LPQOS a2)
+{
+ static BOOL (WINAPI *fp)(SOCKET a0, LPWSABUF a1, LPQOS a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAGetQOSByName() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAGetQOSByName")) == NULL) {
+ FATAL("cannot find entry WSAGetQOSByName (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT WINAPI
+WSAGetServiceClassInfoA(LPGUID a0, LPGUID a1, LPDWORD a2, LPWSASERVICECLASSINFOA a3)
+{
+ static INT (WINAPI *fp)(LPGUID a0, LPGUID a1, LPDWORD a2, LPWSASERVICECLASSINFOA a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAGetServiceClassInfoA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAGetServiceClassInfoA")) == NULL) {
+ FATAL("cannot find entry WSAGetServiceClassInfoA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+INT WINAPI
+WSAGetServiceClassInfoW(LPGUID a0, LPGUID a1, LPDWORD a2, LPWSASERVICECLASSINFOW a3)
+{
+ static INT (WINAPI *fp)(LPGUID a0, LPGUID a1, LPDWORD a2, LPWSASERVICECLASSINFOW a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAGetServiceClassInfoW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAGetServiceClassInfoW")) == NULL) {
+ FATAL("cannot find entry WSAGetServiceClassInfoW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+INT WINAPI
+WSAGetServiceClassNameByClassIdA(LPGUID a0, LPSTR a1, LPDWORD a2)
+{
+ static INT (WINAPI *fp)(LPGUID a0, LPSTR a1, LPDWORD a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAGetServiceClassNameByClassIdA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAGetServiceClassNameByClassIdA")) == NULL) {
+ FATAL("cannot find entry WSAGetServiceClassNameByClassIdA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT WINAPI
+WSAGetServiceClassNameByClassIdW(LPGUID a0, LPWSTR a1, LPDWORD a2)
+{
+ static INT (WINAPI *fp)(LPGUID a0, LPWSTR a1, LPDWORD a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAGetServiceClassNameByClassIdW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAGetServiceClassNameByClassIdW")) == NULL) {
+ FATAL("cannot find entry WSAGetServiceClassNameByClassIdW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int WINAPI
+WSAHtonl(SOCKET a0, unsigned long a1, unsigned long * a2)
+{
+ static int (WINAPI *fp)(SOCKET a0, unsigned long a1, unsigned long * a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAHtonl() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAHtonl")) == NULL) {
+ FATAL("cannot find entry WSAHtonl (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int WINAPI
+WSAHtons(SOCKET a0, unsigned short a1, unsigned short * a2)
+{
+ static int (WINAPI *fp)(SOCKET a0, unsigned short a1, unsigned short * a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAHtons() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAHtons")) == NULL) {
+ FATAL("cannot find entry WSAHtons (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT WINAPI
+WSAInstallServiceClassA(LPWSASERVICECLASSINFOA a0)
+{
+ static INT (WINAPI *fp)(LPWSASERVICECLASSINFOA a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAInstallServiceClassA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAInstallServiceClassA")) == NULL) {
+ FATAL("cannot find entry WSAInstallServiceClassA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+INT WINAPI
+WSAInstallServiceClassW(LPWSASERVICECLASSINFOW a0)
+{
+ static INT (WINAPI *fp)(LPWSASERVICECLASSINFOW a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAInstallServiceClassW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAInstallServiceClassW")) == NULL) {
+ FATAL("cannot find entry WSAInstallServiceClassW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int WINAPI
+WSAIoctl(SOCKET a0, DWORD a1, LPVOID a2, DWORD a3, LPVOID a4, DWORD a5, LPDWORD a6, LPWSAOVERLAPPED a7, LPWSAOVERLAPPED_COMPLETION_ROUTINE a8)
+{
+ static int (WINAPI *fp)(SOCKET a0, DWORD a1, LPVOID a2, DWORD a3, LPVOID a4, DWORD a5, LPDWORD a6, LPWSAOVERLAPPED a7, LPWSAOVERLAPPED_COMPLETION_ROUTINE a8);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAIoctl() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAIoctl")) == NULL) {
+ FATAL("cannot find entry WSAIoctl (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+}
+
+ struct hostent * PASCAL
+_org_gethostbyaddr(const char* a0, int a1, int a2)
+{
+ static struct hostent * (PASCAL *fp)(const char* a0, int a1, int a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_gethostbyaddr() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "gethostbyaddr")) == NULL) {
+ FATAL("cannot find entry gethostbyaddr (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+ struct hostent * PASCAL
+_org_gethostbyname(const char* a0)
+{
+ static struct hostent * (PASCAL *fp)(const char* a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_gethostbyname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "gethostbyname")) == NULL) {
+ FATAL("cannot find entry gethostbyname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+ struct protoent * PASCAL
+getprotobyname(const char* a0)
+{
+ static struct protoent * (PASCAL *fp)(const char* a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getprotobyname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getprotobyname")) == NULL) {
+ FATAL("cannot find entry getprotobyname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+ struct protoent * PASCAL
+getprotobynumber(int a0)
+{
+ static struct protoent * (PASCAL *fp)(int a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getprotobynumber() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getprotobynumber")) == NULL) {
+ FATAL("cannot find entry getprotobynumber (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+ struct servent * PASCAL
+getservbyname(const char* a0, const char* a1)
+{
+ static struct servent * (PASCAL *fp)(const char* a0, const char* a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getservbyname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getservbyname")) == NULL) {
+ FATAL("cannot find entry getservbyname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+ struct servent * PASCAL
+getservbyport(int a0, const char* a1)
+{
+ static struct servent * (PASCAL *fp)(int a0, const char* a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub getservbyport() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getservbyport")) == NULL) {
+ FATAL("cannot find entry getservbyport (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int PASCAL
+_org_gethostname(char* a0, int a1)
+{
+ static int (PASCAL *fp)(char* a0, int a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_gethostname() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "gethostname")) == NULL) {
+ FATAL("cannot find entry gethostname (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+SOCKET WINAPI
+WSAJoinLeaf(SOCKET a0, const struct sockaddr * a1, int a2, LPWSABUF a3, LPWSABUF a4, LPQOS a5, LPQOS a6, DWORD a7)
+{
+ static SOCKET (WINAPI *fp)(SOCKET a0, const struct sockaddr * a1, int a2, LPWSABUF a3, LPWSABUF a4, LPQOS a5, LPQOS a6, DWORD a7);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAJoinLeaf() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAJoinLeaf")) == NULL) {
+ FATAL("cannot find entry WSAJoinLeaf (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6, a7);
+}
+
+INT WINAPI
+_org_WSALookupServiceBeginA(LPWSAQUERYSETA a0, DWORD a1, LPHANDLE a2)
+{
+ static INT (WINAPI *fp)(LPWSAQUERYSETA a0, DWORD a1, LPHANDLE a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_WSALookupServiceBeginA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSALookupServiceBeginA")) == NULL) {
+ FATAL("cannot find entry WSALookupServiceBeginA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT WINAPI
+_org_WSALookupServiceBeginW(LPWSAQUERYSETW a0, DWORD a1, LPHANDLE a2)
+{
+ static INT (WINAPI *fp)(LPWSAQUERYSETW a0, DWORD a1, LPHANDLE a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_WSALookupServiceBeginW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSALookupServiceBeginW")) == NULL) {
+ FATAL("cannot find entry WSALookupServiceBeginW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT WINAPI
+_org_WSALookupServiceEnd(HANDLE a0)
+{
+ static INT (WINAPI *fp)(HANDLE a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_WSALookupServiceEnd() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSALookupServiceEnd")) == NULL) {
+ FATAL("cannot find entry WSALookupServiceEnd (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+INT WINAPI
+_org_WSALookupServiceNextA(HANDLE a0, DWORD a1, LPDWORD a2, LPWSAQUERYSETA a3)
+{
+ static INT (WINAPI *fp)(HANDLE a0, DWORD a1, LPDWORD a2, LPWSAQUERYSETA a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_WSALookupServiceNextA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSALookupServiceNextA")) == NULL) {
+ FATAL("cannot find entry WSALookupServiceNextA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+INT WINAPI
+_org_WSALookupServiceNextW(HANDLE a0, DWORD a1, LPDWORD a2, LPWSAQUERYSETW a3)
+{
+ static INT (WINAPI *fp)(HANDLE a0, DWORD a1, LPDWORD a2, LPWSAQUERYSETW a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_WSALookupServiceNextW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSALookupServiceNextW")) == NULL) {
+ FATAL("cannot find entry WSALookupServiceNextW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+int WINAPI
+WSANtohl(SOCKET a0, unsigned long a1, unsigned long * a2)
+{
+ static int (WINAPI *fp)(SOCKET a0, unsigned long a1, unsigned long * a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSANtohl() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSANtohl")) == NULL) {
+ FATAL("cannot find entry WSANtohl (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int WINAPI
+WSANtohs(SOCKET a0, unsigned short a1, unsigned short * a2)
+{
+ static int (WINAPI *fp)(SOCKET a0, unsigned short a1, unsigned short * a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSANtohs() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSANtohs")) == NULL) {
+ FATAL("cannot find entry WSANtohs (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int WSAAPI
+WSAProviderConfigChange(LPHANDLE a0, LPWSAOVERLAPPED a1, LPWSAOVERLAPPED_COMPLETION_ROUTINE a2)
+{
+ static int (WSAAPI *fp)(LPHANDLE a0, LPWSAOVERLAPPED a1, LPWSAOVERLAPPED_COMPLETION_ROUTINE a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAProviderConfigChange() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAProviderConfigChange")) == NULL) {
+ FATAL("cannot find entry WSAProviderConfigChange (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+int WINAPI
+WSARecv(SOCKET a0, LPWSABUF a1, DWORD a2, LPDWORD a3, LPDWORD a4, LPWSAOVERLAPPED a5, LPWSAOVERLAPPED_COMPLETION_ROUTINE a6)
+{
+ static int (WINAPI *fp)(SOCKET a0, LPWSABUF a1, DWORD a2, LPDWORD a3, LPDWORD a4, LPWSAOVERLAPPED a5, LPWSAOVERLAPPED_COMPLETION_ROUTINE a6);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSARecv() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSARecv")) == NULL) {
+ FATAL("cannot find entry WSARecv (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6);
+}
+
+int WINAPI
+WSARecvDisconnect(SOCKET a0, LPWSABUF a1)
+{
+ static int (WINAPI *fp)(SOCKET a0, LPWSABUF a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSARecvDisconnect() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSARecvDisconnect")) == NULL) {
+ FATAL("cannot find entry WSARecvDisconnect (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int WINAPI
+WSARecvFrom(SOCKET a0, LPWSABUF a1, DWORD a2, LPDWORD a3, LPDWORD a4, struct sockaddr * a5, LPINT a6, LPWSAOVERLAPPED a7, LPWSAOVERLAPPED_COMPLETION_ROUTINE a8)
+{
+ static int (WINAPI *fp)(SOCKET a0, LPWSABUF a1, DWORD a2, LPDWORD a3, LPDWORD a4, struct sockaddr * a5, LPINT a6, LPWSAOVERLAPPED a7, LPWSAOVERLAPPED_COMPLETION_ROUTINE a8);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSARecvFrom() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSARecvFrom")) == NULL) {
+ FATAL("cannot find entry WSARecvFrom (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+}
+
+INT WINAPI
+WSARemoveServiceClass(LPGUID a0)
+{
+ static INT (WINAPI *fp)(LPGUID a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSARemoveServiceClass() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSARemoveServiceClass")) == NULL) {
+ FATAL("cannot find entry WSARemoveServiceClass (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+BOOL WINAPI
+WSAResetEvent(WSAEVENT a0)
+{
+ static BOOL (WINAPI *fp)(WSAEVENT a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAResetEvent() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAResetEvent")) == NULL) {
+ FATAL("cannot find entry WSAResetEvent (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int WINAPI
+WSASend(SOCKET a0, LPWSABUF a1, DWORD a2, LPDWORD a3, DWORD a4, LPWSAOVERLAPPED a5, LPWSAOVERLAPPED_COMPLETION_ROUTINE a6)
+{
+ static int (WINAPI *fp)(SOCKET a0, LPWSABUF a1, DWORD a2, LPDWORD a3, DWORD a4, LPWSAOVERLAPPED a5, LPWSAOVERLAPPED_COMPLETION_ROUTINE a6);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASend() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASend")) == NULL) {
+ FATAL("cannot find entry WSASend (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6);
+}
+
+int WINAPI
+WSASendDisconnect(SOCKET a0, LPWSABUF a1)
+{
+ static int (WINAPI *fp)(SOCKET a0, LPWSABUF a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASendDisconnect() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASendDisconnect")) == NULL) {
+ FATAL("cannot find entry WSASendDisconnect (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int WINAPI
+WSASendTo(SOCKET a0, LPWSABUF a1, DWORD a2, LPDWORD a3, DWORD a4, const struct sockaddr * a5, int a6, LPWSAOVERLAPPED a7, LPWSAOVERLAPPED_COMPLETION_ROUTINE a8)
+{
+ static int (WINAPI *fp)(SOCKET a0, LPWSABUF a1, DWORD a2, LPDWORD a3, DWORD a4, const struct sockaddr * a5, int a6, LPWSAOVERLAPPED a7, LPWSAOVERLAPPED_COMPLETION_ROUTINE a8);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASendTo() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASendTo")) == NULL) {
+ FATAL("cannot find entry WSASendTo (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+}
+
+BOOL WINAPI
+WSASetEvent(WSAEVENT a0)
+{
+ static BOOL (WINAPI *fp)(WSAEVENT a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASetEvent() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASetEvent")) == NULL) {
+ FATAL("cannot find entry WSASetEvent (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+INT WSAAPI
+WSASetServiceA(LPWSAQUERYSETA a0, WSAESETSERVICEOP a1, DWORD a2)
+{
+ static INT (WSAAPI *fp)(LPWSAQUERYSETA a0, WSAESETSERVICEOP a1, DWORD a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASetServiceA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASetServiceA")) == NULL) {
+ FATAL("cannot find entry WSASetServiceA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+INT WINAPI
+WSASetServiceW(LPWSAQUERYSETW a0, WSAESETSERVICEOP a1, DWORD a2)
+{
+ static INT (WINAPI *fp)(LPWSAQUERYSETW a0, WSAESETSERVICEOP a1, DWORD a2);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASetServiceW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASetServiceW")) == NULL) {
+ FATAL("cannot find entry WSASetServiceW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2);
+}
+
+SOCKET WINAPI
+WSASocketA(int a0, int a1, int a2, LPWSAPROTOCOL_INFOA a3, GROUP a4, DWORD a5)
+{
+ static SOCKET (WINAPI *fp)(int a0, int a1, int a2, LPWSAPROTOCOL_INFOA a3, GROUP a4, DWORD a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASocketA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASocketA")) == NULL) {
+ FATAL("cannot find entry WSASocketA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+SOCKET WINAPI
+WSASocketW(int a0, int a1, int a2, LPWSAPROTOCOL_INFOW a3, GROUP a4, DWORD a5)
+{
+ static SOCKET (WINAPI *fp)(int a0, int a1, int a2, LPWSAPROTOCOL_INFOW a3, GROUP a4, DWORD a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASocketW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASocketW")) == NULL) {
+ FATAL("cannot find entry WSASocketW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+INT WINAPI
+WSAStringToAddressA(LPSTR a0, INT a1, LPWSAPROTOCOL_INFOA a2, LPSOCKADDR a3, LPINT a4)
+{
+ static INT (WINAPI *fp)(LPSTR a0, INT a1, LPWSAPROTOCOL_INFOA a2, LPSOCKADDR a3, LPINT a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAStringToAddressA() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAStringToAddressA")) == NULL) {
+ FATAL("cannot find entry WSAStringToAddressA (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+INT WINAPI
+WSAStringToAddressW(LPWSTR a0, INT a1, LPWSAPROTOCOL_INFOW a2, LPSOCKADDR a3, LPINT a4)
+{
+ static INT (WINAPI *fp)(LPWSTR a0, INT a1, LPWSAPROTOCOL_INFOW a2, LPSOCKADDR a3, LPINT a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAStringToAddressW() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAStringToAddressW")) == NULL) {
+ FATAL("cannot find entry WSAStringToAddressW (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+DWORD WINAPI
+WSAWaitForMultipleEvents(DWORD a0, const WSAEVENT * a1, BOOL a2, DWORD a3, BOOL a4)
+{
+ static DWORD (WINAPI *fp)(DWORD a0, const WSAEVENT * a1, BOOL a2, DWORD a3, BOOL a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAWaitForMultipleEvents() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAWaitForMultipleEvents")) == NULL) {
+ FATAL("cannot find entry WSAWaitForMultipleEvents (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+int WINAPI
+WSCDeinstallProvider(LPGUID a0, LPINT a1)
+{
+ static int (WINAPI *fp)(LPGUID a0, LPINT a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSCDeinstallProvider() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSCDeinstallProvider")) == NULL) {
+ FATAL("cannot find entry WSCDeinstallProvider (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int WINAPI
+WSCEnableNSProvider(LPGUID a0, BOOL a1)
+{
+ static int (WINAPI *fp)(LPGUID a0, BOOL a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSCEnableNSProvider() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSCEnableNSProvider")) == NULL) {
+ FATAL("cannot find entry WSCEnableNSProvider (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int WINAPI
+WSCEnumProtocols(LPINT a0, LPWSAPROTOCOL_INFOW a1, LPDWORD a2, LPINT a3)
+{
+ static int (WINAPI *fp)(LPINT a0, LPWSAPROTOCOL_INFOW a1, LPDWORD a2, LPINT a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSCEnumProtocols() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSCEnumProtocols")) == NULL) {
+ FATAL("cannot find entry WSCEnumProtocols (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+int WINAPI
+WSCGetProviderPath(LPGUID a0, LPWSTR a1, LPINT a2, LPINT a3)
+{
+ static int (WINAPI *fp)(LPGUID a0, LPWSTR a1, LPINT a2, LPINT a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSCGetProviderPath() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSCGetProviderPath")) == NULL) {
+ FATAL("cannot find entry WSCGetProviderPath (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+int WINAPI
+WSCInstallNameSpace(LPWSTR a0, LPWSTR a1, DWORD a2, DWORD a3, LPGUID a4)
+{
+ static int (WINAPI *fp)(LPWSTR a0, LPWSTR a1, DWORD a2, DWORD a3, LPGUID a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSCInstallNameSpace() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSCInstallNameSpace")) == NULL) {
+ FATAL("cannot find entry WSCInstallNameSpace (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+int WINAPI
+WSCInstallProvider(const LPGUID a0, const LPWSTR a1, const LPWSAPROTOCOL_INFOW a2, DWORD a3, LPINT a4)
+{
+ static int (WINAPI *fp)(const LPGUID a0, const LPWSTR a1, const LPWSAPROTOCOL_INFOW a2, DWORD a3, LPINT a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSCInstallProvider() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSCInstallProvider")) == NULL) {
+ FATAL("cannot find entry WSCInstallProvider (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+int WINAPI
+WSCUnInstallNameSpace(LPGUID a0)
+{
+ static int (WINAPI *fp)(LPGUID a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSCUnInstallNameSpace() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSCUnInstallNameSpace")) == NULL) {
+ FATAL("cannot find entry WSCUnInstallNameSpace (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+WSAAsyncSelect(SOCKET a0, HWND a1, u_int a2, long a3)
+{
+ static int (PASCAL *fp)(SOCKET a0, HWND a1, u_int a2, long a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAsyncSelect() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncSelect")) == NULL) {
+ FATAL("cannot find entry WSAAsyncSelect (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+HANDLE PASCAL
+_org_WSAAsyncGetHostByAddr(HWND a0, u_int a1, const char* a2, int a3, int a4, char* a5, int a6)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, const char* a2, int a3, int a4, char* a5, int a6);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_WSAAsyncGetHostByAddr() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetHostByAddr")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetHostByAddr (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6);
+}
+
+HANDLE PASCAL
+_org_WSAAsyncGetHostByName(HWND a0, u_int a1, const char* a2, char* a3, int a4)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, const char* a2, char* a3, int a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_WSAAsyncGetHostByName() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetHostByName")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetHostByName (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+HANDLE PASCAL
+WSAAsyncGetProtoByNumber(HWND a0, u_int a1, int a2, char* a3, int a4)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, int a2, char* a3, int a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAsyncGetProtoByNumber() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetProtoByNumber")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetProtoByNumber (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+HANDLE PASCAL
+WSAAsyncGetProtoByName(HWND a0, u_int a1, const char* a2, char* a3, int a4)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, const char* a2, char* a3, int a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAsyncGetProtoByName() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetProtoByName")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetProtoByName (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+HANDLE PASCAL
+WSAAsyncGetServByPort(HWND a0, u_int a1, int a2, const char* a3, char* a4, int a5)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, int a2, const char* a3, char* a4, int a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAsyncGetServByPort() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetServByPort")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetServByPort (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+HANDLE PASCAL
+WSAAsyncGetServByName(HWND a0, u_int a1, const char* a2, const char* a3, char* a4, int a5)
+{
+ static HANDLE (PASCAL *fp)(HWND a0, u_int a1, const char* a2, const char* a3, char* a4, int a5);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAAsyncGetServByName() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAAsyncGetServByName")) == NULL) {
+ FATAL("cannot find entry WSAAsyncGetServByName (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5);
+}
+
+int PASCAL
+WSACancelAsyncRequest(HANDLE a0)
+{
+ static int (PASCAL *fp)(HANDLE a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSACancelAsyncRequest() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSACancelAsyncRequest")) == NULL) {
+ FATAL("cannot find entry WSACancelAsyncRequest (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+FARPROC PASCAL
+WSASetBlockingHook(FARPROC a0)
+{
+ static FARPROC (PASCAL *fp)(FARPROC a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASetBlockingHook() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASetBlockingHook")) == NULL) {
+ FATAL("cannot find entry WSASetBlockingHook (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0);
+}
+
+int PASCAL
+WSAUnhookBlockingHook(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAUnhookBlockingHook() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAUnhookBlockingHook")) == NULL) {
+ FATAL("cannot find entry WSAUnhookBlockingHook (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+int PASCAL
+WSAGetLastError(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAGetLastError() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAGetLastError")) == NULL) {
+ FATAL("cannot find entry WSAGetLastError (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+void PASCAL
+WSASetLastError(int a0)
+{
+ static void (PASCAL *fp)(int a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSASetLastError() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSASetLastError")) == NULL) {
+ FATAL("cannot find entry WSASetLastError (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ (*fp)(a0);
+}
+
+int PASCAL
+WSACancelBlockingCall(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSACancelBlockingCall() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSACancelBlockingCall")) == NULL) {
+ FATAL("cannot find entry WSACancelBlockingCall (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+BOOL PASCAL
+WSAIsBlocking(void)
+{
+ static BOOL (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAIsBlocking() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAIsBlocking")) == NULL) {
+ FATAL("cannot find entry WSAIsBlocking (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+int PASCAL
+WSAStartup(WORD a0, LPWSADATA a1)
+{
+ static int (PASCAL *fp)(WORD a0, LPWSADATA a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSAStartup() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSAStartup")) == NULL) {
+ FATAL("cannot find entry WSAStartup (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int PASCAL
+WSACleanup(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSACleanup() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSACleanup")) == NULL) {
+ FATAL("cannot find entry WSACleanup (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+int PASCAL
+__WSAFDIsSet(SOCKET a0, fd_set* a1)
+{
+ static int (PASCAL *fp)(SOCKET a0, fd_set* a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub __WSAFDIsSet() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "__WSAFDIsSet")) == NULL) {
+ FATAL("cannot find entry __WSAFDIsSet (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int PASCAL
+WEP(void)
+{
+ static int (PASCAL *fp)(void);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WEP() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WEP")) == NULL) {
+ FATAL("cannot find entry WEP (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)();
+}
+
+int PASCAL
+WSCWriteNameSpaceOrder(int a0, int a1)
+{
+ static int (PASCAL *fp)(int a0, int a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSCWriteNameSpaceOrder() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSCWriteNameSpaceOrder")) == NULL) {
+ FATAL("cannot find entry WSCWriteNameSpaceOrder (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int PASCAL
+WSCWriteProviderOrder(LPDWORD a0, DWORD a1)
+{
+ static int (PASCAL *fp)(LPDWORD a0, DWORD a1);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSCWriteProviderOrder() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSCWriteProviderOrder")) == NULL) {
+ FATAL("cannot find entry WSCWriteProviderOrder (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1);
+}
+
+int PASCAL
+WSANSPIoctl(HANDLE a0, DWORD a1, LPVOID a2, DWORD a3, LPVOID a4, DWORD a5, LPDWORD a6, LPVOID a7)
+{
+ static int (PASCAL *fp)(HANDLE a0, DWORD a1, LPVOID a2, DWORD a3, LPVOID a4, DWORD a5, LPDWORD a6, LPVOID a7);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSANSPIoctl() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSANSPIoctl")) == NULL) {
+ FATAL("cannot find entry WSANSPIoctl (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6, a7);
+}
+
+int PASCAL
+WSCUpdateProvider(LPGUID a0, const WCHAR FAR* a1, const LPVOID a2, DWORD a3, LPINT a4)
+{
+ static int (PASCAL *fp)(LPGUID a0, const WCHAR FAR* a1, const LPVOID a2, DWORD a3, LPINT a4);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub WSCUpdateProvider() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "WSCUpdateProvider")) == NULL) {
+ FATAL("cannot find entry WSCUpdateProvider (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4);
+}
+
+int PASCAL
+_org_getaddrinfo(const char* a0, const char* a1, LPVOID a2, LPVOID a3)
+{
+ static int (PASCAL *fp)(const char* a0, const char* a1, LPVOID a2, LPVOID a3);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_getaddrinfo() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getaddrinfo")) == NULL) {
+ FATAL("cannot find entry getaddrinfo (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3);
+}
+
+void PASCAL
+_org_freeaddrinfo(LPVOID a0)
+{
+ static void (PASCAL *fp)(LPVOID a0);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_freeaddrinfo() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "freeaddrinfo")) == NULL) {
+ FATAL("cannot find entry freeaddrinfo (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ (*fp)(a0);
+}
+
+int PASCAL
+_org_getnameinfo(LPVOID a0, DWORD a1, char* a2, DWORD a3, char* a4, DWORD a5, int a6)
+{
+ static int (PASCAL *fp)(LPVOID a0, DWORD a1, char* a2, DWORD a3, char* a4, DWORD a5, int a6);
+
+#ifdef DEBUG_STUB
+ idnLogPrintf(idn_log_level_trace, "stub _org_getnameinfo() called\n");
+#endif
+ if (fp == NULL) {
+ void *p;
+ if ((p = GetProcAddress(DLLHANDLE, "getnameinfo")) == NULL) {
+ FATAL("cannot find entry getnameinfo (%d)\n", GetLastError());
+ abort();
+ }
+ fp = p;
+ }
+ return (*fp)(a0, a1, a2, a3, a4, a5, a6);
+}
+
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock20/make.wnt b/contrib/idn/idnkit-1.0-src/wsock/wsock20/make.wnt
new file mode 100644
index 0000000..b5283aa
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock20/make.wnt
@@ -0,0 +1,97 @@
+#
+# Makefile for WinSock Wrapper (for WinSock 2.0)
+#
+
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
+# Chiyoda-ku, Tokyo 101-0047, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
+#
+# 4. The name of JPNIC may not be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+!include <win32.mak>
+
+SYSLIBS = $(libcdll) kernel32.lib advapi32.lib user32.lib
+
+#
+# Files to use
+#
+
+HDRS = dlldef.h ..\common\wrapcommon.h
+SRCS = dllmain.c dllload.obj dllfunc.c dllstub.c
+OBJS = dllmain.obj dllload.obj dllfunc.obj
+LIBS = ..\common\wrapcommon.lib ..\..\lib\idnkit.lib ..\..\win\iconv.lib
+
+cflags = $(cflags) -I..\..\include
+
+#
+# Targets to Build
+#
+
+TARGETS = ws2_32.dll
+
+all : $(TARGETS)
+
+ws2_32.dll : ws2_32.def $(OBJS) $(LIBS)
+ $(link) $(dlllflags) /OUT:ws2_32.dll /DEF:ws2_32.def $(OBJS) $(LIBS) $(SYSLIBS)
+
+install : $(TARGETS)
+ copy ws2_32.dll ..\bin
+
+clean : force
+ -del *.obj
+ -del *.lib
+ -del *.dll
+ -del *.exp
+
+#
+# Dependencies
+#
+
+dllmain.obj : dllmain.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+dllload.obj : dllload.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+dllfunc.obj : dllfunc.c dllstub.c $(HDRS)
+ $(cc) $(cflags) $(cvarsdll) -DDEBUG $*.c
+
+ws2_32o.lib : ws2_32o.def
+ LIB /DEF:ws2_32o.def /MACHINE:IX86
+
+force:
+
diff --git a/contrib/idn/idnkit-1.0-src/wsock/wsock20/ws2_32.def b/contrib/idn/idnkit-1.0-src/wsock/wsock20/ws2_32.def
new file mode 100644
index 0000000..ba9a44c
--- /dev/null
+++ b/contrib/idn/idnkit-1.0-src/wsock/wsock20/ws2_32.def
@@ -0,0 +1,120 @@
+;
+; Library Defition for idn wrapper's wrapper DLL
+;
+LIBRARY ws2_32
+DESCRIPTION "JPNIC idn warpper DLL for WS2_32"
+EXPORTS
+ accept @1
+ bind @2
+ closesocket @3
+ connect @4
+ getpeername @5
+ getsockname @6
+ getsockopt @7
+ htonl @8
+ htons @9
+ ioctlsocket @10
+ inet_addr @11
+ inet_ntoa @12
+ listen @13
+ ntohl @14
+ ntohs @15
+ recv @16
+ recvfrom @17
+ select @18
+ send @19
+ sendto @20
+ setsockopt @21
+ shutdown @22
+ socket @23
+ WSApSetPostRoutine @24
+ WPUCompleteOverlappedRequest @25
+ WSAAccept @26
+ WSAAddressToStringA @27
+ WSAAddressToStringW @28
+ WSACloseEvent @29
+ WSAConnect @30
+ WSACreateEvent @31
+ WSADuplicateSocketA @32
+ WSADuplicateSocketW @33
+ WSAEnumNameSpaceProvidersA @34
+ WSAEnumNameSpaceProvidersW @35
+ WSAEnumNetworkEvents @36
+ WSAEnumProtocolsA @37
+ WSAEnumProtocolsW @38
+ WSAEventSelect @39
+ WSAGetOverlappedResult @40
+ WSAGetQOSByName @41
+ WSAGetServiceClassInfoA @42
+ WSAGetServiceClassInfoW @43
+ WSAGetServiceClassNameByClassIdA @44
+ WSAGetServiceClassNameByClassIdW @45
+ WSAHtonl @46
+ WSAHtons @47
+ WSAInstallServiceClassA @48
+ WSAInstallServiceClassW @49
+ WSAIoctl @50
+ gethostbyaddr @51
+ gethostbyname @52
+ getprotobyname @53
+ getprotobynumber @54
+ getservbyname @55
+ getservbyport @56
+ gethostname @57
+ WSAJoinLeaf @58
+ WSALookupServiceBeginA @59
+ WSALookupServiceBeginW @60
+ WSALookupServiceEnd @61
+ WSALookupServiceNextA @62
+ WSALookupServiceNextW @63
+ WSANtohl @64
+ WSANtohs @65
+ WSAProviderConfigChange @66
+ WSARecv @67
+ WSARecvDisconnect @68
+ WSARecvFrom @69
+ WSARemoveServiceClass @70
+ WSAResetEvent @71
+ WSASend @72
+ WSASendDisconnect @73
+ WSASendTo @74
+ WSASetEvent @75
+ WSASetServiceA @76
+ WSASetServiceW @77
+ WSASocketA @78
+ WSASocketW @79
+ WSAStringToAddressA @80
+ WSAStringToAddressW @81
+ WSAWaitForMultipleEvents @82
+ WSCDeinstallProvider @83
+ WSCEnableNSProvider @84
+ WSCEnumProtocols @85
+ WSCGetProviderPath @86
+ WSCInstallNameSpace @87
+ WSCInstallProvider @88
+ WSCUnInstallNameSpace @89
+ WSCWriteNameSpaceOrder @90
+ WSCWriteProviderOrder @91
+ freeaddrinfo @94
+ getaddrinfo @95
+ getnameinfo @96
+ WSAAsyncSelect @101
+ WSAAsyncGetHostByAddr @102
+ WSAAsyncGetHostByName @103
+ WSAAsyncGetProtoByNumber @104
+ WSAAsyncGetProtoByName @105
+ WSAAsyncGetServByPort @106
+ WSAAsyncGetServByName @107
+ WSACancelAsyncRequest @108
+ WSASetBlockingHook @109
+ WSAUnhookBlockingHook @110
+ WSAGetLastError @111
+ WSASetLastError @112
+ WSACancelBlockingCall @113
+ WSAIsBlocking @114
+ WSAStartup @115
+ WSACleanup @116
+ __WSAFDIsSet @151
+ WEP @500
+ WSANSPIoctl @600
+ WSCUpdateProvider @601