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 |
| |<-------| |
+--------