                 =============================
                 Null-modem emulator (com0com)
                 =============================

PREREQUISITES
=============

You will need the following to build com0com from source code:

1.  Microsoft Windows Driver Development Kit (DDK) or Windows Driver Kit (WDK).
    When the DDK/WDK is installed, it defines the Start menu shortcuts for
    several different build environments. To open a DDK/WDK build environment
    window choose one of the environment shortcuts.

    NOTE: Microsoft removed Windows 2000 from its list of supported platforms
    for the new WDKs. So for Windows 2000 you'll need one of the previous
    releases of the DDK/WDK:

    6001.18002 - WDK for Windows Server 2008.
                 This WDK provides a Windows 2000 build environment for the
                 development of drivers targeting Windows 2000.
                 (6.1.6001.18002.081017-1400_wdksp-WDK18002SP_EN_DVD.iso).
    1830       - DDK for Windows Server 2003 SP1.
                 This DDK can be installed to Windows 2000.
                 (1830_usa_ddk.iso).

2.  Microsoft Visual C++ 2005 Express Edition (MSVC).
    It's required for building the GUI-based setup utility.
    When the MSVC is installed, it defines the Start menu shortcut for
    build environment. To open a MSVC build environment window choose it.

3.  Nullsoft Scriptable Install System (http://nsis.sourceforge.net/).
    It's required for building the installer.


BUILDING
========

1.  Build the driver.

    For example execute in the DDK/WDK build environment window:

      cd C:\com0com
      build -wcZ -M 1

    It will create the com0com.sys, setup.dll and setupc.exe files in the
    C:\com0com\<CPU>\ directory, where <CPU> is i386, ia64 or amd64
    and depends from choosen DDK build environment.

2.  If you build driver for x64-based versions of
    Windows Vista/Windows Server 2008/Windows 7/8 then create
    a test certificate and sign com0com.sys file.

    For example execute in the WDK build environment window:

      mkdir C:\com0com\cert
      cd C:\com0com\cert
      makecert -r -n "CN=com0com (test)" -sv com0com.pvk com0com.cer
      pvk2pfx -pvk com0com.pvk -spc com0com.cer -pfx com0com.pfx
      signtool sign /v /f com0com.pfx /t "http://timestamp.verisign.com/scripts/timestamp.dll" ..\amd64\com0com.sys

    It will test-sign the C:\com0com\amd64\com0com.sys file.

3.  Build the GUI-based setup utility.

    For example execute in the MSVC build environment window:

      vcbuild C:\com0com\setupg\setup.vcproj Release

    It will create the C:\com0com\setupg\Release\setupg.exe file.

4.  If you build driver for Windows Vista/Windows Server 2008/Windows 7/8 then
    embed requireAdministrator.manifest to the executables.

    For example execute in the MSVC build environment window:

      mt.exe -manifest C:\com0com\requireAdministrator.manifest -updateresource:"C:\com0com\setupg\Release\setupg.exe";#1
      mt.exe -manifest C:\com0com\requireAdministrator.manifest -outputresource:"C:\com0com\<CPU>\setupc.exe";#1

    where <CPU> is i386, ia64 or amd64

5.  Build the installer.

    For example execute in the DDK build environment window:

      "C:\Program Files\NSIS\makensis.exe" /V2 "C:\com0com\NSIS\install.nsi"

    It will create the installer in the C:\com0com\<CPU>\setup.exe file.


FAQs & HOWTOs
=============

Q. Is it possible to build a single installer suitable for both 32-bit and 64-bit systems?
A. Yes, it is possible. Use /DADD_TARGET_CPU_<CPU> and /DOUTPUT_FILE=<path> options, for example:

      "C:\Program Files\NSIS\makensis.exe" /V2 /DADD_TARGET_CPU_i386 /DADD_TARGET_CPU_amd64 /DOUTPUT_FILE="C:\com0com\setup.exe" "C:\com0com\NSIS\install.nsi"

    It will create the installer in the C:\com0com\setup.exe file suitable for both 32-bit and 64-bit systems.
