summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Nilsson <troglobit@gmail.com>2019-10-19 15:49:33 +0200
committerJoachim Nilsson <troglobit@gmail.com>2019-10-19 15:50:59 +0200
commitd35a59602c6fee6d94b3fd8c5375dbf8a12a4b93 (patch)
tree0468afc667876411973fb7f8ea203841b9e3e3a1
parenta0940795f3da8fb81c362e1a83b5b82ef16d26bc (diff)
downloadlibnet-d35a59602c6fee6d94b3fd8c5375dbf8a12a4b93.tar.gz
Cleanup and style, me vs us, formatting etc.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
-rw-r--r--README.win32138
1 files changed, 74 insertions, 64 deletions
diff --git a/README.win32 b/README.win32
index acc095b..04b122a 100644
--- a/README.win32
+++ b/README.win32
@@ -1,5 +1,5 @@
Information, Recommendations and Build Instructions for Windows
-**************************************************************************
+***************************************************************
_____________________________ IMPORTANT _____________________________
The execution of the currently shipped msvcbuild.bat batch script will
@@ -41,7 +41,7 @@ Contents
1.1 Microsoft Visual C++ and GCC/MinGW
---------------------------------------------------------------
+--------------------------------------
The Microsoft Visual C++ compiler (aka MSVC) and the GCC Windows port
(aka MinGW) are unfortunately not fully compatible. Although MSVC is a
@@ -59,51 +59,51 @@ On the other hand, the two can work well together:
If you for instance build libnet with MinGW, and you want to use it
with MSVC too (or vice versa), you can use the DLL and the supplied
-"libnet*.def" file located in <libnet-root>/win32/ (this file is always
+`libnet*.def` file located in <libnet-root>/win32/ (this file is always
rebuild at the end of every successful build on windows) to create an
MSVC compatible import library that you can use to link your projects
with without the need of rebuilding libnet again.
To produce a MinGW compatible import library from any libnet DLL:
-$ dlltool -D path/to/libnet*.dll -d path/to/libnet*.def -l libnet.dll.a
+ dlltool -D path/to/libnet*.dll -d path/to/libnet*.def -l libnet.dll.a
To produce a MSVC compatible import library from any libnet DLL:
-$ lib /machine:X64 /def:example.def (for x64)
+ lib /machine:X64 /def:example.def
or
-$ lib /machine:X86 /def:example.def (for x86)
+
+ lib /machine:X86 /def:example.def
Note 1: If you have removed any or all symbol information from the DLL
-(aka "stripped" it), during build, by for example running configure
-with "--enable-fast", then this obviously won't work.
+ (aka "stripped" it), during build, by for example running
+ configure with `--enable-fast`, then this obviously won't work.
1.2 WinPcap/Npcap
-----------------
Currently, the supported method of sending packets under Windows is with
-WinPcap (http://www.winpcap.org). However, libnet's support for
-Npcap (http://www.npcap.org), an update of WinPcap sponsored by the
-Nmap Project, is being seriously considered.
-Windows users should know that with the switch to Npcap, WinPcap compatibility
-is expected to be deprecated.
+WinPcap <http://www.winpcap.org>. However, libnet's support for Npcap
+<http://www.npcap.org>, an update of WinPcap sponsored by the Nmap
+Project, is being seriously considered.
+
+> Windows users should know that with the switch to Npcap, WinPcap
+> compatibility is expected to be deprecated.
Please be sure to install the WinPcap/Npcap driver/DLL and make sure
that the content of the Wpdpack's/Npcap SDK's Include and Lib directories
are somewhat reachable by your compiler.
Note 2: Remember that you cannot use MSVC-generated .lib files to create
-shared libraries with MinGW, you have to use the lib*.a files.
-WinPcap development came to a standstill before the Developer's Pack ever
-provided x64 compatible lib*.a files for use with MinGW/Cygwin. And since
-libnet depends on WinPcap, you would have to compile 64-bit lib*.a libraries
-yourself if you want to be able to produce 64-bit compatible libnet builds
-with MinGW/Cygwin.
+ shared libraries with MinGW, you have to use the lib*.a files.
+ WinPcap development came to a standstill before the Developer's
+ Pack ever provided x64 compatible lib*.a files for use with
+ MinGW/Cygwin. And since libnet depends on WinPcap, you would
+ have to compile 64-bit lib*.a libraries yourself if you want to
+ be able to produce 64-bit compatible libnet builds with
+ MinGW/Cygwin.
-Luckily for you, this has been taken care of by me. 64-bit compatible
-WinPcap libraries as well as DIY instructions can be found in
-<libnet-root>/win32/wpdpack/.
1.3 Supported Operating Systems
-------------------------------
@@ -114,9 +114,8 @@ I can think of too many better things to do than to continuously deal with
error handling and backwards compatibility (msvcrt vs crtdll) for EOL systems.
Remnants in the source suggests that building libnet with Cygwin must have
-been possible at some point. This may or may not be the case these days.
-If it still works, let me know. If you get it to work (again), let me know.
-And if you need to get it to work, let me know.
+been possible at some point. This may or may not be the case these days.
+If it still works or you get it to work (again), let us know.
2. MinGW Compiler
@@ -127,86 +126,97 @@ few possibilities and options to choose from. If you just want to get
over with it, follow these steps:
Known traps are:
-- Setting the wrong (or no) prefix. (important when running 'make install')
+
+- Setting the wrong (or no) prefix. (important when running `make install`)
- Using incompatible WinPcap libraries for x64 (see Note 2)
- Not having said WinPcap libraries and header files in your compiler's path
-Note 3: If you're building with MinGW, and want to install libnet to your
-compiler's lib and include directories, you almost always want to set your
-prefix manually. If you don't know what that means, run "gcc -v", look for
-"--prefix=/some/path" and use that.
+Note 3: If you're building with MinGW, and want to install libnet to
+ your compiler's lib and include directories, you almost always
+ want to set the prefix manually. If you don't know what that
+ means, run `gcc -v`, look for `--prefix=/some/path` -- use that.
-Note 4: If you're using a multilib MinGW-w64 GCC compiler, make sure to add
-the -m32 or -m64 CFLAGS to instruct the compiler to build for your desired
-architecture.
+Note 4: If you're using a multilib MinGW-w64 GCC compiler, make sure to
+ add the `-m32` or `-m64` to `CFLAGS` to instruct the compiler to
+ build for your desired architecture.
2.1 Native
----------
The recommended MinGW distribution for building libnet is Msys2.
+
First, follow the installation instructions for Msys2 available at
-msys2.github.io. Then, depending on your desired target architecture,
-open a mingw32 or mingw64 shell, navigate to the source directory,
-and execute the following commands:
+<https://msys2.github.io>.
+
+Then, depending on your desired target architecture, open a mingw32 or
+mingw64 shell, navigate to the source directory, and execute the
+following commands:
-1. If you want to produce 32 bit binaries:
+If you want to produce 32 bit binaries:
-$ CFLAGS="-O2 -Wall -I$(pwd)/win32/wpdpack/Include" LDFLAGS="-L$(pwd)/win32/wpdpack/Lib/" ./configure --prefix=/mingw64
+ CFLAGS="-I$(pwd)/win32/wpdpack/Include" LDFLAGS="-L$(pwd)/win32/wpdpack/Lib/" ./configure --prefix=/mingw64
If you want to produce 64 bit binaries:
-$ CFLAGS="-O2 -Wall -I$(pwd)/win32/wpdpack/Include" LDFLAGS="-L$(pwd)/win32/wpdpack/Lib/x64" ./configure --prefix=/mingw64
+ CFLAGS="-I$(pwd)/win32/wpdpack/Include" LDFLAGS="-L$(pwd)/win32/wpdpack/Lib/x64" ./configure --prefix=/mingw64
-2. $ make
+Followed by:
-3. $ make install (optional)
+ make
+ sudo make install
2.2 Cross-Compiling
-------------------
-Note 5: During sample building, you may see a warning similar this:
+During sample building, you may see a warning similar this:
- Could not determine the host path corresponding to
- `... a path ...'
- Continuing, but uninstalled executables may not work.
+ Could not determine the host path corresponding to
+ ... a path ...
+ Continuing, but uninstalled executables may not work.
+
+This, among other things, means that the samples will depend on a shared
+version of libgcc (aka `libgcc_s_sjlj-1.dll`). If no shared version of
+libgcc was built when the compiler was configured, you most likely won't
+be able to execute them.
-This, among other things, means that the samples will depend on
-a shared version of libgcc (aka libgcc_s_sjlj-1.dll). If no shared
-version of libgcc was built when the compiler was configured, you
-most likely won't be able to execute them.
In that case, your best bet is to link with the static version
of libgcc by disabling shared libraries altogether
-(./configure --disable-shared).
+ ./configure --disable-shared
In general, you should know what you're doing and what your host, target
and compiler are all about beforehand.
+
These steps have been successfully tested on Ubuntu and the default
-mingw32-w32 toolchain (GCC 4.8).
-The recommended steps to build libnet therefore are:
+mingw32-w32 toolchain (GCC 4.8). The recommended steps to build libnet
+therefore are:
+
+If you're targeting x86:
-1. If you're targeting x86:
-$ CFLAGS="-O2 -Wall -I$(pwd)/win32/wpdpack/Include" LDFLAGS="-L$(pwd)/win32/wpdpack/Lib" ./configure --host=i686-w64-mingw32 --prefix=/usr/i686-w64-mingw32
+ CFLAGS="-I$(pwd)/win32/wpdpack/Include" LDFLAGS="-L$(pwd)/win32/wpdpack/Lib" ./configure --host=i686-w64-mingw32 --prefix=/usr/i686-w64-mingw32
If you're targeting x64:
-$ CFLAGS="-O2 -Wall -I$(pwd)/win32/wpdpack/Include" LDFLAGS="-L$(pwd)/win32/wpdpack/Lib/x64" ./configure --host=x86_64-w64-mingw32 --prefix=/usr/x86_64-w64-mingw32
-2. make
+ CFLAGS="-I$(pwd)/win32/wpdpack/Include" LDFLAGS="-L$(pwd)/win32/wpdpack/Lib/x64" ./configure --host=x86_64-w64-mingw32 --prefix=/usr/x86_64-w64-mingw32
-3. (optionally) sudo make install
+Followed by:
+
+ make
+ sudo make install
Notice that the --host option is usually all you need for cross-compiling.
-Note 6: Although the steps should be very similar, if you're using any
-other distribution of MinGW (cross or native), you're pretty much on
-your own. Suggestions, bug reports/fixes, and pull requests, see:
-https://github.com/libnet/libnet/issues
+Note 5: Although the steps should be very similar, if you're using any
+ other distribution of MinGW (cross or native), you're pretty
+ much on your own. Suggestions, bug reports/fixes, and pull
+ requests, see: https://github.com/libnet/libnet/issues
3. Microsoft Visual C++
=======================
+
Known traps are:
- Not using the correct (x86 or x64) version of the Visual Studio command prompt
- Using incompatible WinPcap libraries for x64 (see Note 2)
@@ -225,7 +235,7 @@ Run msvcbuild.bat to build for Win32 with MSVC
The batch file takes arguments and sets the appropriate path and environment
variables for the desired built by running either vsvars32.bat (for x86),
vcvars64.bat (for x64) or vcvarsall.bat (for Cross development).
-Type "msvcbuild.bat help" for a description of all available options.
+Type `msvcbuild.bat help` for a description of all available options.
If no argument is specified, x86 is assumed.
The batch file copies pre-prepared headers out of win32/, avoiding the
@@ -242,6 +252,6 @@ For Visual Studio 2015, the shell can be found at:
Program Files (x86) >> Microsoft Visual Studio 14.0 >> Common7 >> Tools >> VsDevCmd.bat
-After building, libnet libraries and .obj files are found in newly created
-"<libnet-root>\libnet\src\[Win32|Win64]\" "<libnet-root>\libnet\lib\[x86|x64]\"
+After building, libnet libraries and `.obj` files are found in newly created
+`<libnet-root>\libnet\src\[Win32|Win64]\` `<libnet-root>\libnet\lib\[x86|x64]\`
respectively.