[Forensics-changes] [SCM] debian-forensics/libewf branch, debian, updated. debian/20091003-1-6-ga8e7c73

Cristian Greco cristian at regolo.cc
Wed Nov 25 23:31:19 UTC 2009


The following commit has been merged in the debian branch:
commit 06d776dac6f4bc50ba20bbc05b7c1f179720b36c
Author: Cristian Greco <cristian at regolo.cc>
Date:   Wed Nov 25 22:07:49 2009 +0100

    Imported Upstream version 20091114

diff --git a/AUTHORS b/AUTHORS
index 33bb1d2..5aca506 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,7 +1,7 @@
 Acknowledgements: libewf
 
-Copyright (c) 2006-2008, Joachim Metz <forensics at hoffmannbv.nl>,
-Hoffmann Investigations. All rights reserved.
+Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
+Hoffmann Investigations.
 
 This code is derived from information and software contributed by:
 - Expert Witness Compression Format specification by Andrew Rosen
diff --git a/ChangeLog b/ChangeLog
index addb648..568b8ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,7 @@
 Roadmap:
 * support missing segment files (chunks)
 * multiple platform device handle
-* libbfio API extensions
+* libbfio API extensions (partial)
 * low and high level API
   - to allow low level access to sections etc. (for recovery)
 * lvf support
@@ -12,7 +12,7 @@ Roadmap:
   - getoptlong
 * internationalisation
   - Unicode support (added)
-  - locale support
+  - locale support (partial)
   - multi language string support (gettext)
 * enhance thread safety
   - protect writing to internal data structures
@@ -72,6 +72,8 @@ Possible performance improvements:
 * optimize empty block test
 * optimize string functions
   - pass length/size as much as possible
+* pass zero byte empty block compressed data cache as a pointer
+  do not copy data to compressed chunk cache
 
 Error handling/tollerance
 * what about a function that translates error into an equivalent errno?
@@ -146,6 +148,7 @@ ewftools:
   - handle different input and ouput chunk sizes in low level functions build
   - allow different input and output header codepages?
   - handle ewf/raw like in smioexport
+  - creates write only raw export file with msvscpp compilation
 * ewfdebug
   - create a tool to analyse a single segment file
   - implement low and high level api separation
@@ -196,14 +199,48 @@ Work in progress:
 Beta after next stable release
 * remove DISABLED in ewfexport
 * move manuals/ewfexport.1.backup to manuals/ewfexport.1
-
-Next stable release:
-* full test
-* remove/disable --enable-v1-api from configure
-* remove/disable ewfdebug
 * check into resume write error for 32-bit compile
 * check make distclean
 
+20091114
+* moved codepage definitions to libewf_codepage.h
+* updated libbfio
+* updated MacOS-X package project file
+* removed ewfalter and ewfdebug from stable
+
+20091109
+* fix for borland c compilation
+* update to MSVSCPP project files
+
+20091108
+* fix for MSVSCPP compilation
+* fixed incorrect return value in libsystem_glob
+* fix for print of program name
+
+20091031
+* fix for local use of libewf
+
+20091030
+* changed endian.h into byte_stream.h
+* updated libuna, libbfio
+* updated behavior of unmanaged file io handle
+
+20091024
+* add falign in device handle, small performance improvement
+
+20091020
+* fixed overflow of chunks_section_number in write io handle
+
+20091018
+* worked on aligned empty block test
+* fixed error in help output of ewfacquirestream
+* fixed error in ewfacquirestream regarding missing strings
+* worked on cached zero byte emtpy block based on idea by Bas Kloet
+
+20091017
+* preperation for stable release
+* removed All rights reserved because it has no additional legal value what so ever
+
 20091003
 * several fixes for Debian integration based on patches by Cristian Greco
 * corrected license in list and array type and several of the pfftool handles
diff --git a/Makefile.am b/Makefile.am
index a4358b0..5852a00 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,43 +17,6 @@ SUBDIRS = \
 	borlandc \
 	msvscpp
 
-DPKG_FILES = \
-	dpkg/changelog \
-	dpkg/changelog.in \
-	dpkg/compat \
-	dpkg/control \
-	dpkg/copyright \
-	dpkg/cron.d.ex \
-	dpkg/emacsen-install.ex \
-	dpkg/emacsen-startup.ex \
-	dpkg/emacsen-remove.ex \
-	dpkg/init.d.ex \
-	dpkg/libewf.install \
-	dpkg/libewf.dirs \
-	dpkg/libewf.docs \
-	dpkg/libewf.postinst.debhelper \
-	dpkg/libewf.postrm.debhelper \
-	dpkg/libewf-default.ex \
-	dpkg/libewf-dev.dirs \
-	dpkg/libewf-dev.docs \
-	dpkg/libewf-dev.install \
-	dpkg/libewf-tools.dirs \
-	dpkg/libewf-tools.docs \
-	dpkg/libewf-tools.install \
-	dpkg/libewf.doc-base.EX \
-	dpkg/manpage.1.ex \
-	dpkg/manpage.sgml.ex \
-	dpkg/manpage.xml.ex \
-	dpkg/menu.ex \
-	dpkg/rules \
-	dpkg/postinst.ex \
-	dpkg/postrm.ex \
-	dpkg/preinst.ex \
-	dpkg/prerm.ex \
-	dpkg/shlibs.local.ex \
-	dpkg/shlibs.local.ex.in \
-	dpkg/watch.ex
-
 SPEC_FILES = \
 	libewf.spec \
 	libewf.spec.in
@@ -89,8 +52,6 @@ distclean: clean
 	/bin/rm -f config.log
 	/bin/rm -f libewf.pc
 	/bin/rm -f libewf.spec
-	/bin/rm -f dpkg/changelog
-	/bin/rm -f dpkg/shlibs.local.ex
 	@for dir in ${subdirs}; do \
 		(cd $$dir && $(MAKE) distclean) \
 		|| case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \
diff --git a/Makefile.in b/Makefile.in
index d9f01d1..cd9f12e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -38,8 +38,6 @@ subdir = .
 DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in $(srcdir)/libewf.pc.in \
 	$(srcdir)/libewf.spec.in $(top_srcdir)/configure \
-	$(top_srcdir)/dpkg/changelog.in \
-	$(top_srcdir)/dpkg/shlibs.local.ex.in \
 	$(top_srcdir)/include/libewf/definitions.h.in \
 	$(top_srcdir)/include/libewf/features.h.in \
 	$(top_srcdir)/include/libewf/types.h.in AUTHORS COPYING \
@@ -57,8 +55,8 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/common/config.h
 CONFIG_CLEAN_FILES = include/libewf/definitions.h \
-	include/libewf/features.h include/libewf/types.h \
-	dpkg/changelog dpkg/shlibs.local.ex libewf.pc libewf.spec
+	include/libewf/features.h include/libewf/types.h libewf.pc \
+	libewf.spec
 CONFIG_CLEAN_VPATH_FILES =
 SOURCES =
 DIST_SOURCES =
@@ -314,43 +312,6 @@ SUBDIRS = \
 	borlandc \
 	msvscpp
 
-DPKG_FILES = \
-	dpkg/changelog \
-	dpkg/changelog.in \
-	dpkg/compat \
-	dpkg/control \
-	dpkg/copyright \
-	dpkg/cron.d.ex \
-	dpkg/emacsen-install.ex \
-	dpkg/emacsen-startup.ex \
-	dpkg/emacsen-remove.ex \
-	dpkg/init.d.ex \
-	dpkg/libewf.install \
-	dpkg/libewf.dirs \
-	dpkg/libewf.docs \
-	dpkg/libewf.postinst.debhelper \
-	dpkg/libewf.postrm.debhelper \
-	dpkg/libewf-default.ex \
-	dpkg/libewf-dev.dirs \
-	dpkg/libewf-dev.docs \
-	dpkg/libewf-dev.install \
-	dpkg/libewf-tools.dirs \
-	dpkg/libewf-tools.docs \
-	dpkg/libewf-tools.install \
-	dpkg/libewf.doc-base.EX \
-	dpkg/manpage.1.ex \
-	dpkg/manpage.sgml.ex \
-	dpkg/manpage.xml.ex \
-	dpkg/menu.ex \
-	dpkg/rules \
-	dpkg/postinst.ex \
-	dpkg/postrm.ex \
-	dpkg/preinst.ex \
-	dpkg/prerm.ex \
-	dpkg/shlibs.local.ex \
-	dpkg/shlibs.local.ex.in \
-	dpkg/watch.ex
-
 SPEC_FILES = \
 	libewf.spec \
 	libewf.spec.in
@@ -408,10 +369,6 @@ include/libewf/features.h: $(top_builddir)/config.status $(top_srcdir)/include/l
 	cd $(top_builddir) && $(SHELL) ./config.status $@
 include/libewf/types.h: $(top_builddir)/config.status $(top_srcdir)/include/libewf/types.h.in
 	cd $(top_builddir) && $(SHELL) ./config.status $@
-dpkg/changelog: $(top_builddir)/config.status $(top_srcdir)/dpkg/changelog.in
-	cd $(top_builddir) && $(SHELL) ./config.status $@
-dpkg/shlibs.local.ex: $(top_builddir)/config.status $(top_srcdir)/dpkg/shlibs.local.ex.in
-	cd $(top_builddir) && $(SHELL) ./config.status $@
 libewf.pc: $(top_builddir)/config.status $(srcdir)/libewf.pc.in
 	cd $(top_builddir) && $(SHELL) ./config.status $@
 libewf.spec: $(top_builddir)/config.status $(srcdir)/libewf.spec.in
@@ -896,8 +853,6 @@ distclean: clean
 	/bin/rm -f config.log
 	/bin/rm -f libewf.pc
 	/bin/rm -f libewf.spec
-	/bin/rm -f dpkg/changelog
-	/bin/rm -f dpkg/shlibs.local.ex
 	@for dir in ${subdirs}; do \
 		(cd $$dir && $(MAKE) distclean) \
 		|| case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \
diff --git a/borlandc/codegear/libewf/libewf.cbproj b/borlandc/codegear/libewf/libewf.cbproj
index e1a1b66..3584ba5 100644
--- a/borlandc/codegear/libewf/libewf.cbproj
+++ b/borlandc/codegear/libewf/libewf.cbproj
@@ -43,269 +43,188 @@
 		<ItemGroup>
 			<LibFiles Include="..\Release\liberror.lib">
 				<IgnorePath>true</IgnorePath>
-				<BuildOrder>52</BuildOrder>
 			</LibFiles>
 			<LibFiles Include="..\Release\libbfio.lib">
 				<IgnorePath>true</IgnorePath>
-				<BuildOrder>73</BuildOrder>
 			</LibFiles>
 			<LibFiles Include="..\Release\libnotify.lib">
 				<IgnorePath>true</IgnorePath>
-				<BuildOrder>71</BuildOrder>
 			</LibFiles>
 			<LibFiles Include="..\Release\libuna.lib">
 				<IgnorePath>true</IgnorePath>
-				<BuildOrder>72</BuildOrder>
 			</LibFiles>
 			<None Include="..\..\..\libewf\libewf_write_io_handle.h">
-				<BuildOrder>4</BuildOrder>
 			</None>
 			<None Include="..\..\..\libewf\ewf_crc.h">
-				<BuildOrder>5</BuildOrder>
 			</None>
 			<None Include="..\..\..\libewf\ewf_data.h">
-				<BuildOrder>6</BuildOrder>
 			</None>
 			<None Include="..\..\..\libewf\ewf_definitions.h">
-				<BuildOrder>7</BuildOrder>
 			</None>
 			<None Include="..\..\..\libewf\ewf_digest.h">
-				<BuildOrder>8</BuildOrder>
 			</None>
 			<None Include="..\..\..\libewf\ewf_error2.h">
-				<BuildOrder>9</BuildOrder>
 			</None>
 			<None Include="..\..\..\libewf\ewf_file_header.h">
-				<BuildOrder>10</BuildOrder>
 			</None>
 			<None Include="..\..\..\libewf\ewf_hash.h">
-				<BuildOrder>11</BuildOrder>
 			</None>
 			<None Include="..\..\..\libewf\ewf_ltree.h">
-				<BuildOrder>12</BuildOrder>
 			</None>
 			<None Include="..\..\..\libewf\ewf_section.h">
-				<BuildOrder>13</BuildOrder>
 			</None>
 			<None Include="..\..\..\libewf\ewf_session.h">
-				<BuildOrder>14</BuildOrder>
 			</None>
 			<None Include="..\..\..\libewf\ewf_table.h">
-				<BuildOrder>15</BuildOrder>
 			</None>
 			<None Include="..\..\..\libewf\ewf_volume.h">
-				<BuildOrder>16</BuildOrder>
 			</None>
 			<None Include="..\..\..\libewf\ewf_volume_smart.h">
-				<BuildOrder>17</BuildOrder>
 			</None>
 			<None Include="..\..\..\libewf\ewfx_delta_chunk.h">
-				<BuildOrder>18</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf.c">
-				<BuildOrder>19</BuildOrder>
 			</CppCompile>
 			<CppCompile Include="..\..\..\libewf\libewf_chunk_cache.c">
-				<BuildOrder>20</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_chunk_cache.h">
-				<BuildOrder>21</BuildOrder>
 			</None>
 			<None Include="..\..\..\libewf\libewf_chunk_offset.h">
-				<BuildOrder>22</BuildOrder>
+			</None>
+			<None Include="..\..\..\libewf\libewf_codepage.h">
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_compression.c">
-				<BuildOrder>23</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_compression.h">
-				<BuildOrder>24</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_date_time.c">
-				<BuildOrder>25</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_date_time.h">
-				<BuildOrder>26</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_date_time_values.c">
-				<BuildOrder>27</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_date_time_values.h">
-				<BuildOrder>28</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_debug.c">
-				<BuildOrder>29</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_debug.h">
-				<BuildOrder>30</BuildOrder>
 			</None>
 			<None Include="..\..\..\libewf\libewf_definitions.h">
-				<BuildOrder>31</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_error.c">
-				<BuildOrder>33</BuildOrder>
+			</CppCompile>
+			<None Include="..\..\..\libewf\libewf_empty_block.h">
+			</None>
+			<CppCompile Include="..\..\..\libewf\libewf_empty_block.c">
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_error.h">
-				<BuildOrder>34</BuildOrder>
 			</None>
 			<None Include="..\..\..\libewf\libewf_extern.h">
-				<BuildOrder>35</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_filename.c">
-				<BuildOrder>36</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_filename.h">
-				<BuildOrder>37</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_handle.c">
-				<BuildOrder>38</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_handle.h">
-				<BuildOrder>39</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_hash_sections.c">
-				<BuildOrder>40</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_hash_sections.h">
-				<BuildOrder>41</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_hash_values.c">
-				<BuildOrder>42</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_hash_values.h">
-				<BuildOrder>43</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_header_sections.c">
-				<BuildOrder>44</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_header_sections.h">
-				<BuildOrder>45</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_header_values.c">
-				<BuildOrder>46</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_header_values.h">
-				<BuildOrder>47</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_io_handle.c">
-				<BuildOrder>48</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_io_handle.h">
-				<BuildOrder>49</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_legacy.c">
-				<BuildOrder>50</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_legacy.h">
-				<BuildOrder>51</BuildOrder>
 			</None>
 			<None Include="..\..\..\libewf\libewf_libbfio.h">
-				<BuildOrder>52</BuildOrder>
 			</None>
 			<None Include="..\..\..\libewf\libewf_libuna.h">
-				<BuildOrder>53</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_list_type.c">
-				<BuildOrder>54</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_list_type.h">
-				<BuildOrder>55</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_media_values.c">
-				<BuildOrder>56</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_media_values.h">
-				<BuildOrder>57</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_metadata.c">
-				<BuildOrder>58</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_metadata.h">
-				<BuildOrder>59</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_notify.c">
-				<BuildOrder>60</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_notify.h">
-				<BuildOrder>61</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_offset_table.c">
-				<BuildOrder>62</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_offset_table.h">
-				<BuildOrder>63</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_read_io_handle.c">
-				<BuildOrder>64</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_read_io_handle.h">
-				<BuildOrder>65</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_section.c">
-				<BuildOrder>66</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_section.h">
-				<BuildOrder>67</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_section_list.c">
-				<BuildOrder>68</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_section_list.h">
-				<BuildOrder>69</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_sector_table.c">
-				<BuildOrder>70</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_sector_table.h">
-				<BuildOrder>71</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_segment_file.c">
-				<BuildOrder>72</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_segment_file.h">
-				<BuildOrder>73</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_segment_file_handle.c">
-				<BuildOrder>74</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_segment_file_handle.h">
-				<BuildOrder>75</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_segment_table.c">
-				<BuildOrder>76</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_segment_table.h">
-				<BuildOrder>77</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_string.c">
-				<BuildOrder>78</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_string.h">
-				<BuildOrder>79</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_support.c">
-				<BuildOrder>80</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_support.h">
-				<BuildOrder>81</BuildOrder>
 			</None>
 			<None Include="..\..\..\libewf\libewf_system_string.h">
-				<BuildOrder>82</BuildOrder>
 			</None>
 			<None Include="..\..\..\libewf\libewf_types.h">
-				<BuildOrder>83</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_values_table.c">
-				<BuildOrder>84</BuildOrder>
 			</CppCompile>
 			<None Include="..\..\..\libewf\libewf_values_table.h">
-				<BuildOrder>85</BuildOrder>
 			</None>
 			<CppCompile Include="..\..\..\libewf\libewf_write_io_handle.c">
-				<BuildOrder>86</BuildOrder>
 			</CppCompile>
 			<LibFiles Include="..\Release\zlib.lib">
 				<IgnorePath>true</IgnorePath>
-				<BuildOrder>87</BuildOrder>
 			</LibFiles>
 			<BuildConfiguration Include="Base">
 				<Key>Base</Key>
diff --git a/borlandc/codegear/libuna/libuna.cbproj b/borlandc/codegear/libuna/libuna.cbproj
index e7b60bd..65214dd 100644
--- a/borlandc/codegear/libuna/libuna.cbproj
+++ b/borlandc/codegear/libuna/libuna.cbproj
@@ -37,6 +37,14 @@
 			<TASM_Debugging>None</TASM_Debugging>
 		</PropertyGroup>
 		<ItemGroup>
+			<CppCompile Include="..\..\..\libuna\libuna_base64_stream.c">
+			</CppCompile>
+			<None Include="..\..\..\libuna\libuna_base64_stream.h">
+			</None>
+			<CppCompile Include="..\..\..\libuna\libuna_base64url_stream.c">
+			</CppCompile>
+			<None Include="..\..\..\libuna\libuna_base64url_stream.h">
+			</None>
 			<CppCompile Include="..\..\..\libuna\libuna_byte_stream.c">
 			</CppCompile>
 			<None Include="..\..\..\libuna\libuna_byte_stream.h">
diff --git a/common/Makefile.am b/common/Makefile.am
index 18cbbac..5dc92d2 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -1,11 +1,11 @@
 AM_CPPFLAGS = -I$(top_srcdir)/include
 
 EXTRA_DIST = \
+	byte_stream.h \
 	common.h \
 	config.h \
 	config_borlandc.h \
 	config_msc.h \
-	endian.h \
 	file_stream.h \
 	memory.h \
 	narrow_string.h \
@@ -13,13 +13,6 @@ EXTRA_DIST = \
 	types.h.in \
 	wide_string.h
 
-if HAVE_MEMWATCH
-noinst_LTLIBRARIES = libmemwatch.la
-
-libmemwatch_la_SOURCES = \
-        memwatch.c memwatch.h
-endif
-
 distclean: clean
 	/bin/rm -f config.h
 	/bin/rm -f types.h
diff --git a/common/Makefile.in b/common/Makefile.in
index f1b4a12..92d71fa 100644
--- a/common/Makefile.in
+++ b/common/Makefile.in
@@ -14,7 +14,6 @@
 # PARTICULAR PURPOSE.
 
 @SET_MAKE@
-
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
@@ -48,29 +47,8 @@ mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = config.h
 CONFIG_CLEAN_FILES = types.h
 CONFIG_CLEAN_VPATH_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
-libmemwatch_la_LIBADD =
-am__libmemwatch_la_SOURCES_DIST = memwatch.c memwatch.h
- at HAVE_MEMWATCH_TRUE@am_libmemwatch_la_OBJECTS = memwatch.lo
-libmemwatch_la_OBJECTS = $(am_libmemwatch_la_OBJECTS)
- at HAVE_MEMWATCH_TRUE@am_libmemwatch_la_rpath =
-DEFAULT_INCLUDES = -I. at am__isrc@
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
-	$(LDFLAGS) -o $@
-SOURCES = $(libmemwatch_la_SOURCES)
-DIST_SOURCES = $(am__libmemwatch_la_SOURCES_DIST)
-ETAGS = etags
-CTAGS = ctags
+SOURCES =
+DIST_SOURCES =
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -234,11 +212,11 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 AM_CPPFLAGS = -I$(top_srcdir)/include
 EXTRA_DIST = \
+	byte_stream.h \
 	common.h \
 	config.h \
 	config_borlandc.h \
 	config_msc.h \
-	endian.h \
 	file_stream.h \
 	memory.h \
 	narrow_string.h \
@@ -246,15 +224,10 @@ EXTRA_DIST = \
 	types.h.in \
 	wide_string.h
 
- at HAVE_MEMWATCH_TRUE@noinst_LTLIBRARIES = libmemwatch.la
- at HAVE_MEMWATCH_TRUE@libmemwatch_la_SOURCES = \
- at HAVE_MEMWATCH_TRUE@        memwatch.c memwatch.h
-
 all: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-am
 
 .SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -305,103 +278,17 @@ distclean-hdr:
 types.h: $(top_builddir)/config.status $(srcdir)/types.h.in
 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 
-clean-noinstLTLIBRARIES:
-	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
-	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
-	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
-	  test "$$dir" != "$$p" || dir=.; \
-	  echo "rm -f \"$${dir}/so_locations\""; \
-	  rm -f "$${dir}/so_locations"; \
-	done
-libmemwatch.la: $(libmemwatch_la_OBJECTS) $(libmemwatch_la_DEPENDENCIES) 
-	$(LINK) $(am_libmemwatch_la_rpath) $(libmemwatch_la_OBJECTS) $(libmemwatch_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
-	-rm -f *.$(OBJEXT)
-
-distclean-compile:
-	-rm -f *.tab.c
-
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/memwatch.Plo at am__quote@
-
-.c.o:
- at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(COMPILE) -c $<
-
-.c.obj:
- at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
-
-.c.lo:
- at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
-
 mostlyclean-libtool:
 	-rm -f *.lo
 
 clean-libtool:
 	-rm -rf .libs _libs
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
 tags: TAGS
+TAGS:
 
-TAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	set x; \
-	here=`pwd`; \
-	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	shift; \
-	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  if test $$# -gt 0; then \
-	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	      "$$@" $$unique; \
-	  else \
-	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	      $$unique; \
-	  fi; \
-	fi
 ctags: CTAGS
-CTAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$unique" \
-	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$unique
-
-GTAGS:
-	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && $(am__cd) $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) "$$here"
-
-distclean-tags:
-	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+CTAGS:
+
 
 distdir: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
@@ -435,7 +322,7 @@ distdir: $(DISTFILES)
 	done
 check-am: all-am
 check: check-am
-all-am: Makefile $(LTLIBRARIES) config.h
+all-am: Makefile config.h
 installdirs:
 install: install-am
 install-exec: install-exec-am
@@ -464,11 +351,9 @@ maintainer-clean-generic:
 	@echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
-clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
-	mostlyclean-am
+clean-am: clean-generic clean-libtool mostlyclean-am
 
-distclean-am: clean-am distclean-compile distclean-generic \
-	distclean-hdr distclean-tags
+distclean-am: clean-am distclean-generic distclean-hdr
 
 dvi: dvi-am
 
@@ -511,14 +396,12 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
 mostlyclean: mostlyclean-am
 
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
-	mostlyclean-libtool
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
 
 pdf: pdf-am
 
@@ -532,19 +415,17 @@ uninstall-am:
 
 .MAKE: all install-am install-strip
 
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-noinstLTLIBRARIES ctags distclean \
-	distclean-compile distclean-generic distclean-hdr \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-compile \
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-hdr distclean-libtool \
+	distdir dvi dvi-am html html-am info info-am install \
+	install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am
+	uninstall uninstall-am
 
 
 distclean: clean
diff --git a/common/byte_stream.h b/common/byte_stream.h
new file mode 100644
index 0000000..49826b5
--- /dev/null
+++ b/common/byte_stream.h
@@ -0,0 +1,157 @@
+/*
+ * Byte stream functions
+ *
+ * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
+ * Hoffmann Investigations.
+ *
+ * Refer to AUTHORS for acknowledgements.
+ *
+ * This software is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#if !defined( _BYTE_STREAM_H )
+#define _BYTE_STREAM_H
+
+#include "common.h"
+#include "types.h"
+
+#if defined( __cplusplus )
+extern "C" {
+#endif
+
+#define _BYTE_STREAM_ENDIAN_BIG		(uint8_t) 'b'
+#define _BYTE_STREAM_ENDIAN_LITTLE	(uint8_t) 'l'
+
+typedef union byte_stream_float32
+{
+	float floating_point;
+	uint32_t integer;
+
+} byte_stream_float32_t;
+
+typedef union byte_stream_float64
+{
+	double floating_point;
+	uint64_t integer;
+
+} byte_stream_float64_t;
+
+#define byte_stream_copy_to_uint16_big_endian( byte_stream, value ) \
+	value   = ( byte_stream )[ 0 ]; \
+	value <<= 8; \
+	value  |= ( byte_stream )[ 1 ];
+
+#define byte_stream_copy_to_uint16_little_endian( byte_stream, value ) \
+	value   = ( byte_stream )[ 1 ]; \
+	value <<= 8; \
+	value  |= ( byte_stream )[ 0 ];
+
+#define byte_stream_copy_to_uint32_big_endian( byte_stream, value ) \
+	value   = ( byte_stream )[ 0 ]; \
+	value <<= 8; \
+	value  |= ( byte_stream )[ 1 ]; \
+	value <<= 8; \
+	value  |= ( byte_stream )[ 2 ]; \
+	value <<= 8; \
+	value  |= ( byte_stream )[ 3 ];
+
+#define byte_stream_copy_to_uint32_little_endian( byte_stream, value ) \
+	value   = ( byte_stream )[ 3 ]; \
+	value <<= 8; \
+	value  |= ( byte_stream )[ 2 ]; \
+	value <<= 8; \
+	value  |= ( byte_stream )[ 1 ]; \
+	value <<= 8; \
+	value  |= ( byte_stream )[ 0 ];
+
+#define byte_stream_copy_to_uint64_big_endian( byte_stream, value ) \
+	value   = ( byte_stream )[ 0 ]; \
+	value <<= 8; \
+	value  |= ( byte_stream )[ 1 ]; \
+	value <<= 8; \
+	value  |= ( byte_stream )[ 2 ]; \
+	value <<= 8; \
+	value  |= ( byte_stream )[ 3 ]; \
+	value <<= 8; \
+	value   = ( byte_stream )[ 4 ]; \
+	value <<= 8; \
+	value  |= ( byte_stream )[ 5 ]; \
+	value <<= 8; \
+	value  |= ( byte_stream )[ 6 ]; \
+	value <<= 8; \
+	value  |= ( byte_stream )[ 7 ];
+
+#define byte_stream_copy_to_uint64_little_endian( byte_stream, value ) \
+	value   = ( byte_stream )[ 7 ]; \
+	value <<= 8; \
+	value  |= ( byte_stream )[ 6 ]; \
+	value <<= 8; \
+	value  |= ( byte_stream )[ 5 ]; \
+	value <<= 8; \
+	value  |= ( byte_stream )[ 4 ]; \
+	value <<= 8; \
+	value   = ( byte_stream )[ 3 ]; \
+	value <<= 8; \
+	value  |= ( byte_stream )[ 2 ]; \
+	value <<= 8; \
+	value  |= ( byte_stream )[ 1 ]; \
+	value <<= 8; \
+	value  |= ( byte_stream )[ 0 ];
+
+#define byte_stream_copy_from_uint16_big_endian( byte_stream, value ) \
+	( byte_stream )[ 0 ] = (uint8_t) ( ( value >> 8 ) & 0x0ff ); \
+	( byte_stream )[ 1 ] = (uint8_t) ( value & 0x0ff )
+
+#define byte_stream_copy_from_uint16_little_endian( byte_stream, value ) \
+	( byte_stream )[ 1 ] = (uint8_t) ( ( value >> 8 ) & 0x0ff ); \
+	( byte_stream )[ 0 ] = (uint8_t) ( value & 0x0ff )
+
+#define byte_stream_copy_from_uint32_big_endian( byte_stream, value ) \
+	( byte_stream )[ 0 ] = (uint8_t) ( ( value >> 24 ) & 0x0ff ); \
+	( byte_stream )[ 1 ] = (uint8_t) ( ( value >> 16 ) & 0x0ff ); \
+	( byte_stream )[ 2 ] = (uint8_t) ( ( value >> 8 ) & 0x0ff ); \
+	( byte_stream )[ 3 ] = (uint8_t) ( value & 0x0ff )
+
+#define byte_stream_copy_from_uint32_little_endian( byte_stream, value ) \
+	( byte_stream )[ 3 ] = (uint8_t) ( ( value >> 24 ) & 0x0ff ); \
+	( byte_stream )[ 2 ] = (uint8_t) ( ( value >> 16 ) & 0x0ff ); \
+	( byte_stream )[ 1 ] = (uint8_t) ( ( value >> 8 ) & 0x0ff ); \
+	( byte_stream )[ 0 ] = (uint8_t) ( value & 0x0ff )
+
+#define byte_stream_copy_from_uint64_big_endian( byte_stream, value ) \
+	( byte_stream )[ 0 ] = (uint8_t) ( ( value >> 56 ) & 0x0ff ); \
+	( byte_stream )[ 1 ] = (uint8_t) ( ( value >> 48 ) & 0x0ff ); \
+	( byte_stream )[ 2 ] = (uint8_t) ( ( value >> 40 ) & 0x0ff ); \
+	( byte_stream )[ 3 ] = (uint8_t) ( ( value >> 32 ) & 0x0ff ); \
+	( byte_stream )[ 4 ] = (uint8_t) ( ( value >> 24 ) & 0x0ff ); \
+	( byte_stream )[ 5 ] = (uint8_t) ( ( value >> 16 ) & 0x0ff ); \
+	( byte_stream )[ 6 ] = (uint8_t) ( ( value >> 8 ) & 0x0ff ); \
+	( byte_stream )[ 7 ] = (uint8_t) ( value & 0x0ff )
+
+#define byte_stream_copy_from_uint64_little_endian( byte_stream, value ) \
+	( byte_stream )[ 7 ] = (uint8_t) ( ( value >> 56 ) & 0x0ff ); \
+	( byte_stream )[ 6 ] = (uint8_t) ( ( value >> 48 ) & 0x0ff ); \
+	( byte_stream )[ 5 ] = (uint8_t) ( ( value >> 40 ) & 0x0ff ); \
+	( byte_stream )[ 4 ] = (uint8_t) ( ( value >> 32 ) & 0x0ff ); \
+	( byte_stream )[ 3 ] = (uint8_t) ( ( value >> 24 ) & 0x0ff ); \
+	( byte_stream )[ 2 ] = (uint8_t) ( ( value >> 16 ) & 0x0ff ); \
+	( byte_stream )[ 1 ] = (uint8_t) ( ( value >> 8 ) & 0x0ff ); \
+	( byte_stream )[ 0 ] = (uint8_t) ( value & 0x0ff )
+
+#if defined( __cplusplus )
+}
+#endif
+
+#endif
+
diff --git a/common/common.h b/common/common.h
index 27cbc71..80c2ec1 100644
--- a/common/common.h
+++ b/common/common.h
@@ -2,7 +2,7 @@
  * Common include file
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/common/config.h b/common/config.h
index 5329904..57952c4 100644
--- a/common/config.h
+++ b/common/config.h
@@ -208,6 +208,9 @@
 /* Define to 1 if you have the <openssl/sha.h> header file. */
 /* #undef HAVE_OPENSSL_SHA_H */
 
+/* Define to 1 if you have the `posix_fadvise' function. */
+#define HAVE_POSIX_FADVISE 1
+
 /* Define to 1 whether printf supports the conversion specifier "%jd". */
 #define HAVE_PRINTF_JD 1
 
@@ -256,9 +259,6 @@
 /* Define to 1 if you have the <stdlib.h> header file. */
 #define HAVE_STDLIB_H 1
 
-/* Define to 1 if you have the `strcasecmp' function. */
-/* #undef HAVE_STRCASECMP */
-
 /* Define to 1 if you have the `strchr' function. */
 #define HAVE_STRCHR 1
 
@@ -280,9 +280,6 @@
 /* Define to 1 if you have the `strlen' function. */
 #define HAVE_STRLEN 1
 
-/* Define to 1 if you have the `strncasecmp' function. */
-#define HAVE_STRNCASECMP 1
-
 /* Define to 1 if you have the `strncmp' function. */
 #define HAVE_STRNCMP 1
 
@@ -361,9 +358,6 @@
 /* Define to 1 if you have the <wchar.h> header file. */
 /* #undef HAVE_WCHAR_H */
 
-/* Define to 1 if you have the `wcscasecmp' function. */
-/* #undef HAVE_WCSCASECMP */
-
 /* Define to 1 if you have the `wcschr' function. */
 /* #undef HAVE_WCSCHR */
 
@@ -376,9 +370,6 @@
 /* Define to 1 if you have the `wcslen' function. */
 /* #undef HAVE_WCSLEN */
 
-/* Define to 1 if you have the `wcsncasecmp' function. */
-/* #undef HAVE_WCSNCASECMP */
-
 /* Define to 1 if you have the `wcsncmp' function. */
 /* #undef HAVE_WCSNCMP */
 
@@ -432,13 +423,13 @@
 #define PACKAGE_NAME "libewf"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "libewf 20091003"
+#define PACKAGE_STRING "libewf 20091114"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "libewf"
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "20091003"
+#define PACKAGE_VERSION "20091114"
 
 /* The size of `off_t', as computed by sizeof. */
 #define SIZEOF_OFF_T 8
@@ -462,7 +453,7 @@
 /* #undef TM_IN_SYS_TIME */
 
 /* Version number of package */
-#define VERSION "20091003"
+#define VERSION "20091114"
 
 /* Number of bits in a file offset, on hosts where this is settable. */
 /* #undef _FILE_OFFSET_BITS */
diff --git a/common/config.h.in b/common/config.h.in
index f7ca1a9..aea500f 100644
--- a/common/config.h.in
+++ b/common/config.h.in
@@ -207,6 +207,9 @@
 /* Define to 1 if you have the <openssl/sha.h> header file. */
 #undef HAVE_OPENSSL_SHA_H
 
+/* Define to 1 if you have the `posix_fadvise' function. */
+#undef HAVE_POSIX_FADVISE
+
 /* Define to 1 whether printf supports the conversion specifier "%jd". */
 #undef HAVE_PRINTF_JD
 
@@ -255,9 +258,6 @@
 /* Define to 1 if you have the <stdlib.h> header file. */
 #undef HAVE_STDLIB_H
 
-/* Define to 1 if you have the `strcasecmp' function. */
-#undef HAVE_STRCASECMP
-
 /* Define to 1 if you have the `strchr' function. */
 #undef HAVE_STRCHR
 
@@ -279,9 +279,6 @@
 /* Define to 1 if you have the `strlen' function. */
 #undef HAVE_STRLEN
 
-/* Define to 1 if you have the `strncasecmp' function. */
-#undef HAVE_STRNCASECMP
-
 /* Define to 1 if you have the `strncmp' function. */
 #undef HAVE_STRNCMP
 
@@ -360,9 +357,6 @@
 /* Define to 1 if you have the <wchar.h> header file. */
 #undef HAVE_WCHAR_H
 
-/* Define to 1 if you have the `wcscasecmp' function. */
-#undef HAVE_WCSCASECMP
-
 /* Define to 1 if you have the `wcschr' function. */
 #undef HAVE_WCSCHR
 
@@ -375,9 +369,6 @@
 /* Define to 1 if you have the `wcslen' function. */
 #undef HAVE_WCSLEN
 
-/* Define to 1 if you have the `wcsncasecmp' function. */
-#undef HAVE_WCSNCASECMP
-
 /* Define to 1 if you have the `wcsncmp' function. */
 #undef HAVE_WCSNCMP
 
diff --git a/common/config_borlandc.h b/common/config_borlandc.h
index 4823c32..fbd9c91 100644
--- a/common/config_borlandc.h
+++ b/common/config_borlandc.h
@@ -2,7 +2,7 @@
  * Configuration file for Borland/CodeGear C++ Builder compiler
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -69,7 +69,13 @@
 #define HAVE_DEBUG_OUTPUT       1
  */
 
+/* Enable the v1 API
+ */
 #define HAVE_V1_API		1
 
+/* Enable the v2 API
+#define HAVE_V2_API		1
+ */
+
 #endif
 
diff --git a/common/config_msc.h b/common/config_msc.h
index 699ea12..a343d9c 100644
--- a/common/config_msc.h
+++ b/common/config_msc.h
@@ -2,7 +2,7 @@
  * Configuration file for Microsoft Visual Studio C++ compiler
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -62,18 +62,20 @@
  */
 
 /* Enable verbose output
-#define HAVE_VERBOSE_OUTPUT     1
+#define HAVE_VERBOSE_OUTPUT	1
  */
 
 /* Enable debug output
-#define HAVE_DEBUG_OUTPUT       1
+#define HAVE_DEBUG_OUTPUT	1
  */
 
+/* Enable the v1 API
+ */
 #define HAVE_V1_API		1
 
-/* Enable version 2 API
+/* Enable the v2 API
 #define HAVE_V2_API		1
-*/
+ */
 
 #endif
 
diff --git a/common/endian.h b/common/endian.h
deleted file mode 100644
index c908ed0..0000000
--- a/common/endian.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Endian functions
- *
- * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
- *
- * Refer to AUTHORS for acknowledgements.
- *
- * This software is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this software.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#if !defined( _ENDIAN_H )
-#define _ENDIAN_H
-
-#include "common.h"
-#include "types.h"
-
-#if defined( __cplusplus )
-extern "C" {
-#endif
-
-#define _ENDIAN_BIG      (uint8_t) 'b'
-#define _ENDIAN_LITTLE   (uint8_t) 'l'
-
-#define endian_big_convert_16bit( value, bytes ) \
-	value = ( (uint16_t) ( bytes[ 0 ] ) << 8 ) \
-	      | (uint16_t) ( bytes[ 1 ] )
-
-#define endian_big_convert_32bit( value, bytes ) \
-	value = ( (uint32_t) ( bytes[ 0 ] ) << 24 ) \
-	      | ( (uint32_t) ( bytes[ 1 ] ) << 16 ) \
-	      | ( (uint32_t) ( bytes[ 2 ] ) << 8 ) \
-	      | (uint32_t) ( bytes[ 3 ] )
-
-#define endian_big_convert_64bit( value, bytes ) \
-	value = ( (uint64_t) ( bytes[ 0 ] ) << 56 ) \
-	      | ( (uint64_t) ( bytes[ 1 ] ) << 48 ) \
-	      | ( (uint64_t) ( bytes[ 2 ] ) << 40 ) \
-	      | ( (uint64_t) ( bytes[ 3 ] ) << 32 ) \
-	      | ( (uint64_t) ( bytes[ 4 ] ) << 24 ) \
-	      | ( (uint64_t) ( bytes[ 5 ] ) << 16 ) \
-	      | ( (uint64_t) ( bytes[ 6 ] ) << 8 ) \
-	      | (uint64_t) ( bytes[ 7 ] )
-
-#define endian_little_convert_16bit( value, bytes ) \
-	value = ( (uint16_t) ( bytes[ 1 ] ) << 8 ) \
-	      | (uint16_t) ( bytes[ 0 ] )
-
-#define endian_little_convert_32bit( value, bytes ) \
-	value = ( (uint32_t) ( bytes[ 3 ] ) << 24 ) \
-	      | ( (uint32_t) ( bytes[ 2 ] ) << 16 ) \
-	      | ( (uint32_t) ( bytes[ 1 ] ) << 8 ) \
-	      | (uint32_t) ( bytes[ 0 ] )
-
-#define endian_little_convert_64bit( value, bytes ) \
-	value = ( (uint64_t) ( bytes[ 7 ] ) << 56 ) \
-	      | ( (uint64_t) ( bytes[ 6 ] ) << 48 ) \
-	      | ( (uint64_t) ( bytes[ 5 ] ) << 40 ) \
-	      | ( (uint64_t) ( bytes[ 4 ] ) << 32 ) \
-	      | ( (uint64_t) ( bytes[ 3 ] ) << 24 ) \
-	      | ( (uint64_t) ( bytes[ 2 ] ) << 16 ) \
-	      | ( (uint64_t) ( bytes[ 1 ] ) << 8 ) \
-	      | (uint64_t) ( bytes[ 0 ] )
-
-#define endian_big_revert_16bit( bytes, value ) \
-	bytes[ 0 ] = (uint8_t) ( ( value >> 8 ) & 0x0ff ); \
-	bytes[ 1 ] = (uint8_t) ( value & 0x0ff )
-
-#define endian_big_revert_32bit( bytes, value ) \
-	bytes[ 0 ] = (uint8_t) ( ( value >> 24 ) & 0x0ff ); \
-	bytes[ 1 ] = (uint8_t) ( ( value >> 16 ) & 0x0ff ); \
-	bytes[ 2 ] = (uint8_t) ( ( value >> 8 ) & 0x0ff ); \
-	bytes[ 3 ] = (uint8_t) ( value & 0x0ff )
-
-#define endian_big_revert_64bit( bytes, value ) \
-	bytes[ 0 ] = (uint8_t) ( ( value >> 56 ) & 0x0ff ); \
-	bytes[ 1 ] = (uint8_t) ( ( value >> 48 ) & 0x0ff ); \
-	bytes[ 2 ] = (uint8_t) ( ( value >> 40 ) & 0x0ff ); \
-	bytes[ 3 ] = (uint8_t) ( ( value >> 32 ) & 0x0ff ); \
-	bytes[ 4 ] = (uint8_t) ( ( value >> 24 ) & 0x0ff ); \
-	bytes[ 5 ] = (uint8_t) ( ( value >> 16 ) & 0x0ff ); \
-	bytes[ 6 ] = (uint8_t) ( ( value >> 8 ) & 0x0ff ); \
-	bytes[ 7 ] = (uint8_t) ( value & 0x0ff )
-
-#define endian_little_revert_16bit( bytes, value ) \
-	bytes[ 1 ] = (uint8_t) ( ( value >> 8 ) & 0x0ff ); \
-	bytes[ 0 ] = (uint8_t) ( value & 0x0ff )
-
-#define endian_little_revert_32bit( bytes, value ) \
-	bytes[ 3 ] = (uint8_t) ( ( value >> 24 ) & 0x0ff ); \
-	bytes[ 2 ] = (uint8_t) ( ( value >> 16 ) & 0x0ff ); \
-	bytes[ 1 ] = (uint8_t) ( ( value >> 8 ) & 0x0ff ); \
-	bytes[ 0 ] = (uint8_t) ( value & 0x0ff )
-
-#define endian_little_revert_64bit( bytes, value ) \
-	bytes[ 7 ] = (uint8_t) ( ( value >> 56 ) & 0x0ff ); \
-	bytes[ 6 ] = (uint8_t) ( ( value >> 48 ) & 0x0ff ); \
-	bytes[ 5 ] = (uint8_t) ( ( value >> 40 ) & 0x0ff ); \
-	bytes[ 4 ] = (uint8_t) ( ( value >> 32 ) & 0x0ff ); \
-	bytes[ 3 ] = (uint8_t) ( ( value >> 24 ) & 0x0ff ); \
-	bytes[ 2 ] = (uint8_t) ( ( value >> 16 ) & 0x0ff ); \
-	bytes[ 1 ] = (uint8_t) ( ( value >> 8 ) & 0x0ff ); \
-	bytes[ 0 ] = (uint8_t) ( value & 0x0ff )
-
-#if defined( __cplusplus )
-}
-#endif
-
-#endif
-
diff --git a/common/file_stream.h b/common/file_stream.h
index 22eb466..7828681 100644
--- a/common/file_stream.h
+++ b/common/file_stream.h
@@ -2,7 +2,7 @@
  * FILE stream functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/common/memory.h b/common/memory.h
index 5826884..c825beb 100644
--- a/common/memory.h
+++ b/common/memory.h
@@ -2,7 +2,7 @@
  * Memory functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/common/memwatch.c b/common/memwatch.c
deleted file mode 100644
index cdf37d2..0000000
--- a/common/memwatch.c
+++ /dev/null
@@ -1,2666 +0,0 @@
-/*
-** MEMWATCH.C
-** Nonintrusive ANSI C memory leak / overwrite detection
-** Copyright (C) 1992-2003 Johan Lindh
-** All rights reserved.
-** Version 2.71
-
-	This file is part of MEMWATCH.
-
-    MEMWATCH is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    MEMWATCH is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with MEMWATCH; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-**
-** 920810 JLI   [1.00]
-** 920830 JLI   [1.10 double-free detection]
-** 920912 JLI   [1.15 mwPuts, mwGrab/Drop, mwLimit]
-** 921022 JLI   [1.20 ASSERT and VERIFY]
-** 921105 JLI   [1.30 C++ support and TRACE]
-** 921116 JLI   [1.40 mwSetOutFunc]
-** 930215 JLI   [1.50 modified ASSERT/VERIFY]
-** 930327 JLI   [1.51 better auto-init & PC-lint support]
-** 930506 JLI   [1.55 MemWatch class, improved C++ support]
-** 930507 JLI   [1.60 mwTest & CHECK()]
-** 930809 JLI   [1.65 Abort/Retry/Ignore]
-** 930820 JLI   [1.70 data dump when unfreed]
-** 931016 JLI   [1.72 modified C++ new/delete handling]
-** 931108 JLI   [1.77 mwSetAssertAction() & some small changes]
-** 940110 JLI   [1.80 no-mans-land alloc/checking]
-** 940328 JLI   [2.00 version 2.0 rewrite]
-**              Improved NML (no-mans-land) support.
-**              Improved performance (especially for free()ing!).
-**              Support for 'read-only' buffers (checksums)
-**              ^^ NOTE: I never did this... maybe I should?
-**              FBI (free'd block info) tagged before freed blocks
-**              Exporting of the mwCounter variable
-**              mwBreakOut() localizes debugger support
-**              Allocation statistics (global, per-module, per-line)
-**              Self-repair ability with relinking
-** 950913 JLI   [2.10 improved garbage handling]
-** 951201 JLI   [2.11 improved auto-free in emergencies]
-** 960125 JLI   [X.01 implemented auto-checking using mwAutoCheck()]
-** 960514 JLI   [2.12 undefining of existing macros]
-** 960515 JLI   [2.13 possibility to use default new() & delete()]
-** 960516 JLI   [2.20 suppression of file flushing on unfreed msgs]
-** 960516 JLI   [2.21 better support for using MEMWATCH with DLL's]
-** 960710 JLI   [X.02 multiple logs and mwFlushNow()]
-** 960801 JLI   [2.22 merged X.01 version with current]
-** 960805 JLI   [2.30 mwIsXXXXAddr() to avoid unneeded GP's]
-** 960805 JLI   [2.31 merged X.02 version with current]
-** 961002 JLI   [2.32 support for realloc() + fixed STDERR bug]
-** 961222 JLI   [2.40 added mwMark() & mwUnmark()]
-** 970101 JLI   [2.41 added over/underflow checking after failed ASSERT/VERIFY]
-** 970113 JLI   [2.42 added support for PC-Lint 7.00g]
-** 970207 JLI   [2.43 added support for strdup()]
-** 970209 JLI   [2.44 changed default filename to lowercase]
-** 970405 JLI   [2.45 fixed bug related with atexit() and some C++ compilers]
-** 970723 JLI   [2.46 added MW_ARI_NULLREAD flag]
-** 970813 JLI   [2.47 stabilized marker handling]
-** 980317 JLI   [2.48 ripped out C++ support; wasn't working good anyway]
-** 980318 JLI   [2.50 improved self-repair facilities & SIGSEGV support]
-** 980417 JLI	[2.51 more checks for invalid addresses]
-** 980512 JLI	[2.52 moved MW_ARI_NULLREAD to occur before aborting]
-** 990112 JLI	[2.53 added check for empty heap to mwIsOwned]
-** 990217 JLI	[2.55 improved the emergency repairs diagnostics and NML]
-** 990224 JLI	[2.56 changed ordering of members in structures]
-** 990303 JLI	[2.57 first maybe-fixit-for-hpux test]
-** 990516 JLI	[2.58 added 'static' to the definition of mwAutoInit]
-** 990517 JLI	[2.59 fixed some high-sensitivity warnings]
-** 990610 JLI	[2.60 fixed some more high-sensitivity warnings]
-** 990715 JLI	[2.61 changed TRACE/ASSERT/VERIFY macro names]
-** 991001 JLI	[2.62 added CHECK_BUFFER() and mwTestBuffer()]
-** 991007 JLI	[2.63 first shot at a 64-bit compatible version]
-** 991009 JLI	[2.64 undef's strdup() if defined, mwStrdup made const]
-** 000704 JLI	[2.65 added some more detection for 64-bits]
-** 010502 JLI   [2.66 incorporated some user fixes]
-**              [mwRelink() could print out garbage pointer (thanks mac at phobos.ca)]
-**				[added array destructor for C++ (thanks rdasilva at connecttel.com)]
-**				[added mutex support (thanks rdasilva at connecttel.com)]
-** 010531 JLI	[2.67 fix: mwMutexXXX() was declared even if MW_HAVE_MUTEX was not defined]
-** 010619 JLI	[2.68 fix: mwRealloc() could leave the mutex locked]
-** 020918 JLI	[2.69 changed to GPL, added C++ array allocation by Howard Cohen]
-** 030212 JLI	[2.70 mwMalloc() bug for very large allocations (4GB on 32bits)]
-** 030520 JLI	[2.71 added ULONG_LONG_MAX as a 64-bit detector (thanks Sami Salonen)]
-*/
-
-#define __MEMWATCH_C 1
-
-#ifdef MW_NOCPP
-#define MEMWATCH_NOCPP
-#endif
-#ifdef MW_STDIO
-#define MEMWATCH_STDIO
-#endif
-
-/***********************************************************************
-** Include files
-***********************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <signal.h>
-#include <setjmp.h>
-#include <time.h>
-#include <limits.h>
-#include "memwatch.h"
-
-#ifndef toupper
-#include <ctype.h>
-#endif
-
-#if defined(WIN32) || defined(__WIN32__)
-#define MW_HAVE_MUTEX 1
-#include <windows.h>
-#endif
-
-#if defined(MW_PTHREADS) || defined(HAVE_PTHREAD_H)
-#define MW_HAVE_MUTEX 1
-#include <pthread.h>
-#endif
-
-/***********************************************************************
-** Defines & other weird stuff
-***********************************************************************/
-
-/*lint -save -e767 */
-#define MWVERSION   "2.71"         /* the current version number */
-#define CHKVAL(mw)  (0xFE0180L^(long)mw->count^(long)mw->size^(long)mw->line)
-#define FLUSH()     mwFlush()
-#define TESTS(f,l)  if(mwTestAlways) (void)mwTestNow(f,l,1)
-#define PRECHK      0x01234567L
-#define POSTCHK     0x76543210L
-#define mwBUFFER_TO_MW(p) ( (mwData*) (void*) ( ((char*)p)-mwDataSize-mwOverflowZoneSize ) )
-/*lint -restore */
-
-#define MW_NML      0x0001
-
-#ifdef _MSC_VER
-#define COMMIT "c"  /* Microsoft C requires the 'c' to perform as desired */
-#else
-#define COMMIT ""   /* Normal ANSI */
-#endif /* _MSC_VER */
-
-#ifdef __cplusplus
-#define CPPTEXT "++"
-#else
-#define CPPTEXT ""
-#endif /* __cplusplus */
-
-#ifdef MEMWATCH_STDIO
-#define mwSTDERR stderr
-#else
-#define mwSTDERR mwLog
-#endif
-
-#ifdef MW_HAVE_MUTEX
-#define MW_MUTEX_INIT()		mwMutexInit()
-#define MW_MUTEX_TERM()		mwMutexTerm()
-#define MW_MUTEX_LOCK()		mwMutexLock()
-#define MW_MUTEX_UNLOCK()	mwMutexUnlock()
-#else
-#define MW_MUTEX_INIT()
-#define MW_MUTEX_TERM()
-#define MW_MUTEX_LOCK()
-#define MW_MUTEX_UNLOCK()
-#endif
-
-/***********************************************************************
-** If you really, really know what you're doing,
-** you can predefine these things yourself.
-***********************************************************************/
-
-#ifndef mwBYTE_DEFINED
-# if CHAR_BIT != 8
-#  error need CHAR_BIT to be 8!
-# else
-typedef unsigned char mwBYTE;
-#  define mwBYTE_DEFINED 1
-# endif
-#endif
-
-#if defined(ULONGLONG_MAX) || defined(ULLONG_MAX) || defined(_UI64_MAX) || defined(ULONG_LONG_MAX)
-# define mw64BIT 1
-# define mwROUNDALLOC_DEFAULT 8
-#else
-# if UINT_MAX <= 0xFFFFUL
-#  define mw16BIT 1
-#  define mwROUNDALLOC_DEFAULT	2
-# else
-#  if ULONG_MAX > 0xFFFFFFFFUL
-#   define mw64BIT 1
-#   define mwROUNDALLOC_DEFAULT	8
-#  else
-#   define mw32BIT 1
-#   define mwROUNDALLOC_DEFAULT	4
-#  endif
-# endif
-#endif
-
-/* mwROUNDALLOC is the number of bytes to */
-/* round up to, to ensure that the end of */
-/* the buffer is suitable for storage of */
-/* any kind of object */
-#ifndef mwROUNDALLOC
-# define mwROUNDALLOC mwROUNDALLOC_DEFAULT
-#endif
-
-#ifndef mwDWORD_DEFINED
-#if ULONG_MAX == 0xFFFFFFFFUL
-typedef unsigned long mwDWORD;
-#define mwDWORD_DEFINED "unsigned long"
-#endif
-#endif
-
-#ifndef mwDWORD_DEFINED
-#if UINT_MAX == 0xFFFFFFFFUL
-typedef unsigned int mwDWORD;
-#define mwDWORD_DEFINED "unsigned int"
-#endif
-#endif
-
-#ifndef mwDWORD_DEFINED
-#if USHRT_MAX == 0xFFFFFFFFUL
-typedef unsigned short mwDWORD;
-#define mwDWORD_DEFINED "unsigned short"
-#endif
-#endif
-
-#ifndef mwBYTE_DEFINED
-#error "can't find out the correct type for a 8 bit scalar"
-#endif
-
-#ifndef mwDWORD_DEFINED
-#error "can't find out the correct type for a 32 bit scalar"
-#endif
-
-/***********************************************************************
-** Typedefs & structures
-***********************************************************************/
-
-/* main data holding area, precedes actual allocation */
-typedef struct mwData_ mwData;
-struct mwData_ {
-    mwData*     prev;   /* previous allocation in chain */
-    mwData*     next;   /* next allocation in chain */
-    const char* file;   /* file name where allocated */
-    long        count;  /* action count */
-    long        check;  /* integrity check value */
-#if 0
-    long        crc;    /* data crc value */
-#endif
-    size_t      size;   /* size of allocation */
-    int         line;   /* line number where allocated */
-    unsigned    flag;   /* flag word */
-    };
-
-/* statistics structure */
-typedef struct mwStat_ mwStat;
-struct mwStat_ {
-    mwStat*     next;   /* next statistic buffer */
-    const char* file;
-    long        total;  /* total bytes allocated */
-    long        num;    /* total number of allocations */
-    long        max;    /* max allocated at one time */
-    long        curr;   /* current allocations */
-    int         line;
-    };
-
-/* grabbing structure, 1K in size */
-typedef struct mwGrabData_ mwGrabData;
-struct mwGrabData_ {
-    mwGrabData* next;
-    int         type;
-    char        blob[ 1024 - sizeof(mwGrabData*) - sizeof(int) ];
-    };
-
-typedef struct mwMarker_ mwMarker;
-struct mwMarker_ {
-    void *host;
-    char *text;
-    mwMarker *next;
-    int level;
-    };
-
-#if defined(WIN32) || defined(__WIN32__)
-typedef HANDLE          mwMutex;
-#endif
-
-#if defined(MW_PTHREADS) || defined(HAVE_PTHREAD_H)
-typedef pthread_mutex_t mwMutex;
-#endif
-
-/***********************************************************************
-** Static variables
-***********************************************************************/
-
-static int      mwInited =      0;
-static int      mwInfoWritten = 0;
-static int      mwUseAtexit =   0;
-static FILE*    mwLog =         NULL;
-static int      mwFlushing =    0;
-static int      mwStatLevel =   MW_STAT_DEFAULT;
-static int      mwNML =         MW_NML_DEFAULT;
-static int      mwFBI =         0;
-static long     mwAllocLimit =  0L;
-static int      mwUseLimit =    0;
-
-static long     mwNumCurAlloc = 0L;
-static mwData*  mwHead = 		NULL;
-static mwData*  mwTail = 		NULL;
-static int		mwDataSize =	0;
-static unsigned char mwOverflowZoneTemplate[] = "mEmwAtch";
-static int		mwOverflowZoneSize = mwROUNDALLOC;
-
-static void     (*mwOutFunction)(int) = NULL;
-static int      (*mwAriFunction)(const char*) = NULL;
-static int      mwAriAction = MW_ARI_ABORT;
-
-static char     mwPrintBuf[MW_TRACE_BUFFER+8];
-
-static unsigned long mwCounter = 0L;
-static long     mwErrors =      0L;
-
-static int      mwTestFlags =   0;
-static int      mwTestAlways =  0;
-
-static FILE*    mwLogB1 =       NULL;
-static int      mwFlushingB1 =  0;
-
-static mwStat*  mwStatList = NULL;
-static long     mwStatTotAlloc = 0L;
-static long     mwStatMaxAlloc = 0L;
-static long     mwStatNumAlloc = 0L;
-static long     mwStatCurAlloc = 0L;
-static long     mwNmlNumAlloc = 0L;
-static long     mwNmlCurAlloc = 0L;
-
-static mwGrabData* mwGrabList = NULL;
-static long     mwGrabSize = 0L;
-
-static void *   mwLastFree[MW_FREE_LIST];
-static const char *mwLFfile[MW_FREE_LIST];
-static int      mwLFline[MW_FREE_LIST];
-static int      mwLFcur = 0;
-
-static mwMarker* mwFirstMark = NULL;
-
-static FILE*    mwLogB2 =       NULL;
-static int      mwFlushingB2 =  0;
-
-#ifdef MW_HAVE_MUTEX
-static mwMutex	mwGlobalMutex;
-#endif
-
-/***********************************************************************
-** Static function declarations
-***********************************************************************/
-
-static void     mwAutoInit( void );
-static FILE*    mwLogR( void );
-static void     mwLogW( FILE* );
-static int      mwFlushR( void );
-static void     mwFlushW( int );
-static void     mwFlush( void );
-static void     mwIncErr( void );
-static void     mwUnlink( mwData*, const char* file, int line );
-static int      mwRelink( mwData*, const char* file, int line );
-static int      mwIsHeapOK( mwData *mw );
-static int      mwIsOwned( mwData* mw, const char* file, int line );
-static int      mwTestBuf( mwData* mw, const char* file, int line );
-static void     mwDefaultOutFunc( int );
-static void     mwWrite( const char* format, ... );
-static void     mwLogFile( const char* name );
-static size_t   mwFreeUp( size_t, int );
-static const void *mwTestMem( const void *, unsigned, int );
-static int      mwStrCmpI( const char *s1, const char *s2 );
-static int      mwTestNow( const char *file, int line, int always_invoked );
-static void     mwDropAll( void );
-static const char *mwGrabType( int type );
-static unsigned mwGrab_( unsigned kb, int type, int silent );
-static unsigned mwDrop_( unsigned kb, int type, int silent );
-static int      mwARI( const char* text );
-static void     mwStatReport( void );
-static mwStat*  mwStatGet( const char*, int, int );
-static void     mwStatAlloc( size_t, const char*, int );
-static void     mwStatFree( size_t, const char*, int );
-static int		mwCheckOF( const void * p );
-static void		mwWriteOF( void * p );
-static char		mwDummy( char c );
-#ifdef MW_HAVE_MUTEX
-static void		mwMutexInit( void );
-static void		mwMutexTerm( void );
-static void		mwMutexLock( void );
-static void		mwMutexUnlock( void );
-#endif
-
-/***********************************************************************
-** System functions
-***********************************************************************/
-
-void mwInit( void ) {
-    time_t tid;
-
-    if( mwInited++ > 0 ) return;
-
-	MW_MUTEX_INIT();
-
-    /* start a log if none is running */
-    if( mwLogR() == NULL ) mwLogFile( "memwatch.log" );
-    if( mwLogR() == NULL ) {
-        int i;
-        char buf[32];
-        /* oops, could not open it! */
-        /* probably because it's already open */
-        /* so we try some other names */
-        for( i=1; i<100; i++ ) {
-            sprintf( buf, "memwat%02d.log", i );
-            mwLogFile( buf );
-            if( mwLogR() != NULL ) break;
-            }
-        }
-
-    /* initialize the statistics */
-    mwStatList = NULL;
-    mwStatTotAlloc = 0L;
-    mwStatCurAlloc = 0L;
-    mwStatMaxAlloc = 0L;
-    mwStatNumAlloc = 0L;
-	mwNmlCurAlloc = 0L;
-	mwNmlNumAlloc = 0L;
-
-	/* calculate the buffer size to use for a mwData */
-	mwDataSize = sizeof(mwData);
-	while( mwDataSize % mwROUNDALLOC ) mwDataSize ++;
-
-    /* write informational header if needed */
-    if( !mwInfoWritten ) {
-        mwInfoWritten = 1;
-        (void) time( &tid );
-        mwWrite(
-            "\n============="
-            " MEMWATCH " MWVERSION " Copyright (C) 1992-1999 Johan Lindh "
-            "=============\n");
-        mwWrite( "\nStarted at %s\n", ctime( &tid ) );
-
-/**************************************************************** Generic */
-		mwWrite( "Modes: " );
-#ifdef mwNew
-        mwWrite( "C++ " );
-#endif /* mwNew */
-#ifdef __STDC__
-        mwWrite( "__STDC__ " );
-#endif /* __STDC__ */
-#ifdef mw16BIT
-		mwWrite( "16-bit " );
-#endif
-#ifdef mw32BIT
-		mwWrite( "32-bit " );
-#endif
-#ifdef mw64BIT
-		mwWrite( "64-bit " );
-#endif
-		mwWrite( "mwDWORD==(" mwDWORD_DEFINED ")\n" );
-		mwWrite( "mwROUNDALLOC==%d sizeof(mwData)==%d mwDataSize==%d\n",
-			mwROUNDALLOC, sizeof(mwData), mwDataSize );
-/**************************************************************** Generic */
-
-/************************************************************ Microsoft C */
-#ifdef _MSC_VER
-        mwWrite( "Compiled using Microsoft C" CPPTEXT
-            " %d.%02d\n", _MSC_VER / 100, _MSC_VER % 100 );
-#endif /* _MSC_VER */
-/************************************************************ Microsoft C */
-
-/************************************************************** Borland C */
-#ifdef __BORLANDC__
-        mwWrite( "Compiled using Borland C"
-#ifdef __cplusplus
-            "++ %d.%01d\n", __BCPLUSPLUS__/0x100, (__BCPLUSPLUS__%0x100)/0x10 );
-#else
-            " %d.%01d\n", __BORLANDC__/0x100, (__BORLANDC__%0x100)/0x10 );
-#endif /* __cplusplus */
-#endif /* __BORLANDC__ */
-/************************************************************** Borland C */
-
-/************************************************************** Watcom C */
-#ifdef __WATCOMC__
-        mwWrite( "Compiled using Watcom C %d.%02d ",
-            __WATCOMC__/100, __WATCOMC__%100 );
-#ifdef __FLAT__
-        mwWrite( "(32-bit flat model)" );
-#endif /* __FLAT__ */
-        mwWrite( "\n" );
-#endif /* __WATCOMC__ */
-/************************************************************** Watcom C */
-
-        mwWrite( "\n" );
-        FLUSH();
-        }
-
-    if( mwUseAtexit ) (void) atexit( mwAbort );
-    return;
-    }
-
-void mwAbort( void ) {
-    mwData *mw;
-    mwMarker *mrk;
-    char *data;
-    time_t tid;
-    int c, i, j;
-	int errors;
-
-    tid = time( NULL );
-    mwWrite( "\nStopped at %s\n", ctime( &tid) );
-
-    if( !mwInited )
-        mwWrite( "internal: mwAbort(): MEMWATCH not initialized!\n" );
-
-    /* release the grab list */
-    mwDropAll();
-
-    /* report mwMarked items */
-    while( mwFirstMark ) {
-        mrk = mwFirstMark->next;
-        mwWrite( "mark: %p: %s\n", mwFirstMark->host, mwFirstMark->text );
-        free( mwFirstMark->text );
-        free( mwFirstMark );
-        mwFirstMark = mrk;
-        mwErrors ++;
-        }
-
-    /* release all still allocated memory */
-	errors = 0;
-    while( mwHead != NULL && errors < 3 ) {
-		if( !mwIsOwned(mwHead, __FILE__, __LINE__ ) ) {
-			if( errors < 3 )
-			{
-				errors ++;
-				mwWrite( "internal: NML/unfreed scan restarting\n" );
-				FLUSH();
-				mwHead = mwHead;
-				continue;
-			}
-			mwWrite( "internal: NML/unfreed scan aborted, heap too damaged\n" );
-			FLUSH();
-			break;
-			}
-        mwFlushW(0);
-        if( !(mwHead->flag & MW_NML) ) {
-            mwErrors++;
-            data = ((char*)mwHead)+mwDataSize;
-            mwWrite( "unfreed: <%ld> %s(%d), %ld bytes at %p ",
-                mwHead->count, mwHead->file, mwHead->line, (long)mwHead->size, data+mwOverflowZoneSize );
-            if( mwCheckOF( data ) ) {
-                mwWrite( "[underflowed] ");
-                FLUSH();
-                }
-            if( mwCheckOF( (data+mwOverflowZoneSize+mwHead->size) ) ) {
-                mwWrite( "[overflowed] ");
-                FLUSH();
-                }
-            mwWrite( " \t{" );
-            j = 64; if( mwHead->size < 16 ) j = (int) mwHead->size;
-            for( i=0;i<16;i++ ) {
-                if( i<j ) mwWrite( "%02X ",
-                    (unsigned char) *(data+mwOverflowZoneSize+i) );
-                else mwWrite( ".. " );
-                }
-            for( i=0;i<j;i++ ) {
-                c = *(data+mwOverflowZoneSize+i);
-                if( c < 32 || c > 126 ) c = '.';
-                mwWrite( "%c", c );
-                }
-            mwWrite( "}\n" );
-			mw = mwHead;
-			mwUnlink( mw, __FILE__, __LINE__ );
-            free( mw );
-            }
-        else {
-            data = ((char*)mwHead) + mwDataSize + mwOverflowZoneSize;
-            if( mwTestMem( data, mwHead->size, MW_VAL_NML ) ) {
-                mwErrors++;
-                mwWrite( "wild pointer: <%ld> NoMansLand %p alloc'd at %s(%d)\n",
-                    mwHead->count, data + mwOverflowZoneSize, mwHead->file, mwHead->line );
-                FLUSH();
-                }
-			mwNmlNumAlloc --;
-			mwNmlCurAlloc -= mwHead->size;
-			mw = mwHead;
-			mwUnlink( mw, __FILE__, __LINE__ );
-            free( mw );
-            }
-        }
-
-	if( mwNmlNumAlloc ) mwWrite("internal: NoMansLand block counter %ld, not zero\n", mwNmlNumAlloc );
-	if( mwNmlCurAlloc ) mwWrite("internal: NoMansLand byte counter %ld, not zero\n", mwNmlCurAlloc );
-
-    /* report statistics */
-    mwStatReport();
-    FLUSH();
-
-    mwInited = 0;
-    mwHead = mwTail = NULL;
-    if( mwErrors )
-        fprintf(mwSTDERR,"MEMWATCH detected %ld anomalies\n",mwErrors);
-    mwLogFile( NULL );
-    mwErrors = 0;
-
-    MW_MUTEX_TERM();
-
-    }
-
-void mwTerm( void ) {
-    if( mwInited == 1 )
-    {
-        mwAbort();
-        return;
-    }
-    if( !mwInited )
-        mwWrite("internal: mwTerm(): MEMWATCH has not been started!\n");
-    else
-        mwInited --;
-    }
-
-void mwStatistics( int level )
-{
-    mwAutoInit();
-    if( level<0 ) level=0;
-    if( mwStatLevel != level )
-    {
-		mwWrite( "statistics: now collecting on a %s basis\n",
-			level<1?"global":(level<2?"module":"line") );
-	    mwStatLevel = level;
-	}
-}
-
-void mwAutoCheck( int onoff ) {
-    mwAutoInit();
-    mwTestAlways = onoff;
-    if( onoff ) mwTestFlags = MW_TEST_ALL;
-    }
-
-void mwSetOutFunc( void (*func)(int) ) {
-    mwAutoInit();
-    mwOutFunction = func;
-    }
-
-static void mwWriteOF( void *p )
-{
-	int i;
-	unsigned char *ptr;
-	ptr = (unsigned char*) p;
-	for( i=0; i<mwOverflowZoneSize; i++ )
-	{
-		*(ptr+i) = mwOverflowZoneTemplate[i%8];
-	}
-	return;
-}
-
-static int mwCheckOF( const void *p )
-{
-	int i;
-	const unsigned char *ptr;
-	ptr = (const unsigned char *) p;
-	for( i=0; i<mwOverflowZoneSize; i++ )
-	{
-		if( *(ptr+i) != mwOverflowZoneTemplate[i%8] )
-			return 1; /* errors found */
-	}
-	return 0; /* no errors */
-}
-
-int mwTest( const char *file, int line, int items ) {
-    mwAutoInit();
-    mwTestFlags = items;
-    return mwTestNow( file, line, 0 );
-    }
-
-/*
-** Returns zero if there are no errors.
-** Returns nonzero if there are errors.
-*/
-int mwTestBuffer( const char *file, int line, void *p ) {
-    mwData* mw;
-
-    mwAutoInit();
-
-    /* do the quick ownership test */
-    mw = (mwData*) mwBUFFER_TO_MW( p );
-
-    if( mwIsOwned( mw, file, line ) ) {
-        return mwTestBuf( mw, file, line );
-		}
-	return 1;
-	}
-
-void mwBreakOut( const char* cause ) {
-    fprintf(mwSTDERR, "breakout: %s\n", cause);
-    mwWrite("breakout: %s\n", cause );
-    return;
-    }
-
-/*
-** 981217 JLI: is it possible that ->next is not always set?
-*/
-void * mwMark( void *p, const char *desc, const char *file, unsigned line ) {
-    mwMarker *mrk;
-    unsigned n, isnew;
-    char *buf;
-    int tot, oflow = 0;
-    char wherebuf[128];
-
-    mwAutoInit();
-    TESTS(NULL,0);
-
-    if( desc == NULL ) desc = "unknown";
-    if( file == NULL ) file = "unknown";
-
-    tot = sprintf( wherebuf, "%.48s called from %s(%d)", desc, file, line );
-    if( tot >= (int)sizeof(wherebuf) ) { wherebuf[sizeof(wherebuf)-1] = 0; oflow = 1; }
-
-    if( p == NULL ) {
-        mwWrite("mark: %s(%d), no mark for NULL:'%s' may be set\n", file, line, desc );
-        return p;
-        }
-
-	if( mwFirstMark != NULL && !mwIsReadAddr( mwFirstMark, sizeof( mwMarker ) ) )
-	{
-		mwWrite("mark: %s(%d), mwFirstMark (%p) is trashed, can't mark for %s\n",
-			file, line, mwFirstMark, desc );
-		return p;
-	}
-
-    for( mrk=mwFirstMark; mrk; mrk=mrk->next )
-	{
-		if( mrk->next != NULL && !mwIsReadAddr( mrk->next, sizeof( mwMarker ) ) )
-		{
-			mwWrite("mark: %s(%d), mark(%p)->next(%p) is trashed, can't mark for %s\n",
-				file, line, mrk, mrk->next, desc );
-			return p;
-		}
-		if( mrk->host == p ) break;
-	}
-
-    if( mrk == NULL ) {
-        isnew = 1;
-        mrk = (mwMarker*) malloc( sizeof( mwMarker ) );
-        if( mrk == NULL ) {
-            mwWrite("mark: %s(%d), no mark for %p:'%s', out of memory\n", file, line, p, desc );
-            return p;
-            }
-		mrk->next = NULL;
-        n = 0;
-        }
-    else {
-        isnew = 0;
-        n = strlen( mrk->text );
-        }
-
-    n += strlen( wherebuf );
-    buf = (char*) malloc( n+3 );
-    if( buf == NULL ) {
-        if( isnew ) free( mrk );
-        mwWrite("mark: %s(%d), no mark for %p:'%s', out of memory\n", file, line, p, desc );
-        return p;
-        }
-
-    if( isnew ) {
-        memcpy( buf, wherebuf, n+1 );
-        mrk->next = mwFirstMark;
-        mrk->host = p;
-        mrk->text = buf;
-        mrk->level = 1;
-        mwFirstMark = mrk;
-        }
-    else {
-        strcpy( buf, mrk->text );
-        strcat( buf, ", " );
-        strcat( buf, wherebuf );
-        free( mrk->text );
-        mrk->text = buf;
-        mrk->level ++;
-        }
-
-    if( oflow ) {
-        mwIncErr();
-        mwTrace( " [WARNING: OUTPUT BUFFER OVERFLOW - SYSTEM UNSTABLE]\n" );
-        }
-    return p;
-    }
-
-void* mwUnmark( void *p, const char *file, unsigned line ) {
-    mwMarker *mrk, *prv;
-    mrk = mwFirstMark;
-    prv = NULL;
-    while( mrk ) {
-        if( mrk->host == p ) {
-            if( mrk->level < 2 ) {
-                if( prv ) prv->next = mrk->next;
-                else mwFirstMark = mrk->next;
-                free( mrk->text );
-                free( mrk );
-                return p;
-                }
-            mrk->level --;
-            return p;
-            }
-        prv = mrk;
-        mrk = mrk->next;
-        }
-    mwWrite("mark: %s(%d), no mark found for %p\n", file, line, p );
-    return p;
-    }
-
-
-/***********************************************************************
-** Abort/Retry/Ignore handlers
-***********************************************************************/
-
-static int mwARI( const char *estr ) {
-    char inbuf[81];
-    int c;
-    fprintf(mwSTDERR, "\n%s\nMEMWATCH: Abort, Retry or Ignore? ", estr);
-    (void) fgets(inbuf,sizeof(inbuf),stdin);
-	for( c=0; inbuf[c] && inbuf[c] <= ' '; c++ ) ;
-    c = inbuf[c];
-    if( c == 'R' || c == 'r' ) {
-        mwBreakOut( estr );
-        return MW_ARI_RETRY;
-        }
-    if( c == 'I' || c == 'i' ) return MW_ARI_IGNORE;
-    return MW_ARI_ABORT;
-    }
-
-/* standard ARI handler (exported) */
-int mwAriHandler( const char *estr ) {
-    mwAutoInit();
-    return mwARI( estr );
-    }
-
-/* used to set the ARI function */
-void mwSetAriFunc( int (*func)(const char *) ) {
-    mwAutoInit();
-    mwAriFunction = func;
-    }
-
-/***********************************************************************
-** Allocation handlers
-***********************************************************************/
-
-void* mwMalloc( size_t size, const char* file, int line) {
-    size_t needed;
-    mwData *mw;
-    char *ptr;
-    void *p;
-
-    mwAutoInit();
-
-	MW_MUTEX_LOCK();
-
-    TESTS(file,line);
-
-    mwCounter ++;
-    needed = mwDataSize + mwOverflowZoneSize*2 + size;
-    if( needed < size )
-    {
-    	/* theoretical case: req size + mw overhead exceeded size_t limits */
-    	return NULL;
-    }
-
-    /* if this allocation would violate the limit, fail it */
-    if( mwUseLimit && ((long)size + mwStatCurAlloc > mwAllocLimit) ) {
-        mwWrite( "limit fail: <%ld> %s(%d), %ld wanted %ld available\n",
-            mwCounter, file, line, (long)size, mwAllocLimit - mwStatCurAlloc );
-        mwIncErr();
-        FLUSH();
-		MW_MUTEX_UNLOCK();
-        return NULL;
-        }
-
-    mw = (mwData*) malloc( needed );
-    if( mw == NULL ) {
-        if( mwFreeUp(needed,0) >= needed ) {
-            mw = (mwData*) malloc(needed);
-            if( mw == NULL ) {
-                mwWrite( "internal: mwFreeUp(%u) reported success, but malloc() fails\n", needed );
-                mwIncErr();
-                FLUSH();
-                }
-            }
-        if( mw == NULL ) {
-            mwWrite( "fail: <%ld> %s(%d), %ld wanted %ld allocated\n",
-                mwCounter, file, line, (long)size, mwStatCurAlloc );
-            mwIncErr();
-            FLUSH();
-			MW_MUTEX_UNLOCK();
-            return NULL;
-            }
-        }
-
-    mw->count = mwCounter;
-    mw->prev = NULL;
-    mw->next = mwHead;
-    mw->file = file;
-    mw->size = size;
-    mw->line = line;
-    mw->flag = 0;
-    mw->check = CHKVAL(mw);
-
-    if( mwHead ) mwHead->prev = mw;
-    mwHead = mw;
-    if( mwTail == NULL ) mwTail = mw;
-
-    ptr = ((char*)mw) + mwDataSize;
-	mwWriteOF( ptr ); /* '*(long*)ptr = PRECHK;' */
-    ptr += mwOverflowZoneSize;
-    p = ptr;
-    memset( ptr, MW_VAL_NEW, size );
-    ptr += size;
-    mwWriteOF( ptr ); /* '*(long*)ptr = POSTCHK;' */
-
-    mwNumCurAlloc ++;
-    mwStatCurAlloc += (long) size;
-    mwStatTotAlloc += (long) size;
-    if( mwStatCurAlloc > mwStatMaxAlloc )
-        mwStatMaxAlloc = mwStatCurAlloc;
-    mwStatNumAlloc ++;
-
-    if( mwStatLevel ) mwStatAlloc( size, file, line );
-
-	MW_MUTEX_UNLOCK();
-    return p;
-    }
-
-void* mwRealloc( void *p, size_t size, const char* file, int line) {
-    int oldUseLimit, i;
-    mwData *mw;
-    char *ptr;
-
-    mwAutoInit();
-
-    if( p == NULL ) return mwMalloc( size, file, line );
-    if( size == 0 ) { mwFree( p, file, line ); return NULL; }
-
-	MW_MUTEX_LOCK();
-
-    /* do the quick ownership test */
-    mw = (mwData*) mwBUFFER_TO_MW( p );
-    if( mwIsOwned( mw, file, line ) ) {
-
-		/* if the buffer is an NML, treat this as a double-free */
-		if( mw->flag & MW_NML )
-		{
-            mwIncErr();
-			if( *((unsigned char*)(mw)+mwDataSize+mwOverflowZoneSize) != MW_VAL_NML )
-			{
-				mwWrite( "internal: <%ld> %s(%d), no-mans-land MW-%p is corrupted\n",
-					mwCounter, file, line, mw );
-			}
-			goto check_dbl_free;
-		}
-
-        /* if this allocation would violate the limit, fail it */
-        if( mwUseLimit && ((long)size + mwStatCurAlloc - (long)mw->size > mwAllocLimit) ) {
-            TESTS(file,line);
-            mwCounter ++;
-            mwWrite( "limit fail: <%ld> %s(%d), %ld wanted %ld available\n",
-                mwCounter, file, line, (unsigned long)size - mw->size, mwAllocLimit - mwStatCurAlloc );
-            mwIncErr();
-            FLUSH();
-			MW_MUTEX_UNLOCK();
-            return NULL;
-            }
-
-        /* fake realloc operation */
-        oldUseLimit = mwUseLimit;
-        mwUseLimit = 0;
-        ptr = (char*) mwMalloc( size, file, line );
-        if( ptr != NULL ) {
-            if( size < mw->size )
-                memcpy( ptr, p, size );
-            else
-                memcpy( ptr, p, mw->size );
-            mwFree( p, file, line );
-            }
-        mwUseLimit = oldUseLimit;
-		MW_MUTEX_UNLOCK();
-        return (void*) ptr;
-        }
-
-    /* Unknown pointer! */
-
-    /* using free'd pointer? */
-check_dbl_free:
-    for(i=0;i<MW_FREE_LIST;i++) {
-        if( mwLastFree[i] == p ) {
-            mwIncErr();
-            mwWrite( "realloc: <%ld> %s(%d), %p was"
-                " freed from %s(%d)\n",
-                mwCounter, file, line, p,
-                mwLFfile[i], mwLFline[i] );
-            FLUSH();
-			MW_MUTEX_UNLOCK();
-            return NULL;
-            }
-        }
-
-    /* some weird pointer */
-    mwIncErr();
-    mwWrite( "realloc: <%ld> %s(%d), unknown pointer %p\n",
-        mwCounter, file, line, p );
-    FLUSH();
-	MW_MUTEX_UNLOCK();
-    return NULL;
-    }
-
-#ifdef MWSTRDUP
-char *mwStrdup( const char* str, const char* file, int line ) {
-    size_t len;
-    char *newstring;
-
-	MW_MUTEX_LOCK();
-
-    if( str == NULL ) {
-        mwIncErr();
-        mwWrite( "strdup: <%ld> %s(%d), strdup(NULL) called\n",
-            mwCounter, file, line );
-        FLUSH();
-		MW_MUTEX_UNLOCK();
-        return NULL;
-        }
-
-    len = strlen( str ) + 1;
-    newstring = (char*) mwMalloc( len, file, line );
-    if( newstring != NULL ) memcpy( newstring, str, len );
-	MW_MUTEX_UNLOCK();
-    return newstring;
-    }
-#endif
-
-void mwFree( void* p, const char* file, int line ) {
-    int i;
-    mwData* mw;
-    char buffer[ sizeof(mwData) + (mwROUNDALLOC*3) + 64 ];
-
-    /* this code is in support of C++ delete */
-    if( file == NULL ) {
-        mwFree_( p );
-		MW_MUTEX_UNLOCK();
-        return;
-        }
-
-    mwAutoInit();
-
-	MW_MUTEX_LOCK();
-    TESTS(file,line);
-    mwCounter ++;
-
-    /* on NULL free, write a warning and return */
-    if( p == NULL ) {
-        mwWrite( "NULL free: <%ld> %s(%d), NULL pointer free'd\n",
-            mwCounter, file, line );
-        FLUSH();
-		MW_MUTEX_UNLOCK();
-        return;
-        }
-
-    /* do the quick ownership test */
-    mw = (mwData*) mwBUFFER_TO_MW( p );
-
-    if( mwIsOwned( mw, file, line ) ) {
-        (void) mwTestBuf( mw, file, line );
-
-		/* if the buffer is an NML, treat this as a double-free */
-		if( mw->flag & MW_NML )
-		{
-			if( *(((unsigned char*)mw)+mwDataSize+mwOverflowZoneSize) != MW_VAL_NML )
-			{
-				mwWrite( "internal: <%ld> %s(%d), no-mans-land MW-%p is corrupted\n",
-					mwCounter, file, line, mw );
-			}
-			goto check_dbl_free;
-		}
-
-        /* update the statistics */
-        mwNumCurAlloc --;
-        mwStatCurAlloc -= (long) mw->size;
-        if( mwStatLevel ) mwStatFree( mw->size, mw->file, mw->line );
-
-        /* we should either free the allocation or keep it as NML */
-        if( mwNML ) {
-            mw->flag |= MW_NML;
-			mwNmlNumAlloc ++;
-			mwNmlCurAlloc += (long) mw->size;
-            memset( ((char*)mw)+mwDataSize+mwOverflowZoneSize, MW_VAL_NML, mw->size );
-            }
-        else {
-            /* unlink the allocation, and enter the post-free data */
-            mwUnlink( mw, file, line );
-            memset( mw, MW_VAL_DEL,
-                mw->size + mwDataSize+mwOverflowZoneSize+mwOverflowZoneSize );
-            if( mwFBI ) {
-                memset( mw, '.', mwDataSize + mwOverflowZoneSize );
-                sprintf( buffer, "FBI<%ld>%s(%d)", mwCounter, file, line );
-                strncpy( (char*)(void*)mw, buffer, mwDataSize + mwOverflowZoneSize );
-                }
-            free( mw );
-            }
-
-        /* add the pointer to the last-free track */
-        mwLFfile[ mwLFcur ] = file;
-        mwLFline[ mwLFcur ] = line;
-        mwLastFree[ mwLFcur++ ] = p;
-        if( mwLFcur == MW_FREE_LIST ) mwLFcur = 0;
-
-		MW_MUTEX_UNLOCK();
-        return;
-        }
-
-    /* check for double-freeing */
-check_dbl_free:
-    for(i=0;i<MW_FREE_LIST;i++) {
-        if( mwLastFree[i] == p ) {
-            mwIncErr();
-            mwWrite( "double-free: <%ld> %s(%d), %p was"
-                " freed from %s(%d)\n",
-                mwCounter, file, line, p,
-                mwLFfile[i], mwLFline[i] );
-            FLUSH();
-			MW_MUTEX_UNLOCK();
-            return;
-            }
-        }
-
-    /* some weird pointer... block the free */
-    mwIncErr();
-    mwWrite( "WILD free: <%ld> %s(%d), unknown pointer %p\n",
-        mwCounter, file, line, p );
-    FLUSH();
-	MW_MUTEX_UNLOCK();
-    return;
-    }
-
-void* mwCalloc( size_t a, size_t b, const char *file, int line ) {
-    void *p;
-    size_t size = a * b;
-    p = mwMalloc( size, file, line );
-    if( p == NULL ) return NULL;
-    memset( p, 0, size );
-    return p;
-    }
-
-void mwFree_( void *p ) {
-	MW_MUTEX_LOCK();
-    TESTS(NULL,0);
-	MW_MUTEX_UNLOCK();
-    free(p);
-    }
-
-void* mwMalloc_( size_t size ) {
-	MW_MUTEX_LOCK();
-    TESTS(NULL,0);
-	MW_MUTEX_UNLOCK();
-    return malloc( size );
-    }
-
-void* mwRealloc_( void *p, size_t size ) {
-	MW_MUTEX_LOCK();
-    TESTS(NULL,0);
-	MW_MUTEX_UNLOCK();
-    return realloc( p, size );
-    }
-
-void* mwCalloc_( size_t a, size_t b ) {
-	MW_MUTEX_LOCK();
-    TESTS(NULL,0);
-	MW_MUTEX_UNLOCK();
-    return calloc( a, b );
-    }
-
-void mwFlushNow( void ) {
-    if( mwLogR() ) fflush( mwLogR() );
-    return;
-    }
-
-void mwDoFlush( int onoff ) {
-    mwFlushW( onoff<1?0:onoff );
-    if( onoff ) if( mwLogR() ) fflush( mwLogR() );
-    return;
-    }
-
-void mwLimit( long lim ) {
-    TESTS(NULL,0);
-    mwWrite("limit: old limit = ");
-    if( !mwAllocLimit ) mwWrite( "none" );
-    else mwWrite( "%ld bytes", mwAllocLimit );
-    mwWrite( ", new limit = ");
-    if( !lim ) {
-        mwWrite( "none\n" );
-        mwUseLimit = 0;
-        }
-    else {
-        mwWrite( "%ld bytes\n", lim );
-        mwUseLimit = 1;
-        }
-    mwAllocLimit = lim;
-    FLUSH();
-    }
-
-void mwSetAriAction( int action ) {
-	MW_MUTEX_LOCK();
-    TESTS(NULL,0);
-    mwAriAction = action;
-	MW_MUTEX_UNLOCK();
-    return;
-    }
-
-int mwAssert( int exp, const char *exps, const char *fn, int ln ) {
-    int i;
-    char buffer[MW_TRACE_BUFFER+8];
-    if( exp ) {
-    	return 0;
-    	}
-    mwAutoInit();
-	MW_MUTEX_LOCK();
-    TESTS(fn,ln);
-    mwIncErr();
-    mwCounter++;
-    mwWrite( "assert trap: <%ld> %s(%d), %s\n", mwCounter, fn, ln, exps );
-    if( mwAriFunction != NULL ) {
-        sprintf( buffer, "MEMWATCH: assert trap: %s(%d), %s", fn, ln, exps );
-        i = (*mwAriFunction)(buffer);
-		switch( i ) {
-			case MW_ARI_IGNORE:
-	           	mwWrite( "assert trap: <%ld> IGNORED - execution continues\n", mwCounter );
-				MW_MUTEX_UNLOCK();
-    	        return 0;
-			case MW_ARI_RETRY:
-            	mwWrite( "assert trap: <%ld> RETRY - executing again\n", mwCounter );
-				MW_MUTEX_UNLOCK();
-            	return 1;
-			}
-        }
-    else {
-        if( mwAriAction & MW_ARI_IGNORE ) {
-            mwWrite( "assert trap: <%ld> AUTO IGNORED - execution continues\n", mwCounter );
-			MW_MUTEX_UNLOCK();
-            return 0;
-            }
-        fprintf(mwSTDERR,"\nMEMWATCH: assert trap: %s(%d), %s\n", fn, ln, exps );
-        }
-
-    FLUSH();
-    (void) mwTestNow( fn, ln, 1 );
-    FLUSH();
-
-	if( mwAriAction & MW_ARI_NULLREAD ) {
-		/* This is made in an attempt to kick in */
-		/* any debuggers or OS stack traces */
-	    FLUSH();
-		/*lint -save -e413 */
-		i = *((int*)NULL);
-		mwDummy( (char)i );
-		/*lint -restore */
-		}
-
-	MW_MUTEX_UNLOCK();
-    exit(255);
-    /* NOT REACHED - the return statement is in to keep */
-    /* stupid compilers from squeaking about differing return modes. */
-    /* Smart compilers instead say 'code unreachable...' */
-    /*lint -save -e527 */
-    return 0;
-    /*lint -restore */
-    }
-
-int mwVerify( int exp, const char *exps, const char *fn, int ln ) {
-    int i;
-    char buffer[MW_TRACE_BUFFER+8];
-    if( exp ) {
-    	return 0;
-    	}
-    mwAutoInit();
-	MW_MUTEX_LOCK();
-    TESTS(fn,ln);
-    mwIncErr();
-    mwCounter++;
-    mwWrite( "verify trap: <%ld> %s(%d), %s\n", mwCounter, fn, ln, exps );
-    if( mwAriFunction != NULL ) {
-        sprintf( buffer, "MEMWATCH: verify trap: %s(%d), %s", fn, ln, exps );
-        i = (*mwAriFunction)(buffer);
-        if( i == 0 ) {
-            mwWrite( "verify trap: <%ld> IGNORED - execution continues\n", mwCounter );
-			MW_MUTEX_UNLOCK();
-            return 0;
-            }
-        if( i == 1 ) {
-            mwWrite( "verify trap: <%ld> RETRY - executing again\n", mwCounter );
-			MW_MUTEX_UNLOCK();
-            return 1;
-            }
-        }
-    else {
-        if( mwAriAction & MW_ARI_NULLREAD ) {
-            /* This is made in an attempt to kick in */
-            /* any debuggers or OS stack traces */
-		    FLUSH();
-            /*lint -save -e413 */
-            i = *((int*)NULL);
-			mwDummy( (char)i );
-            /*lint -restore */
-            }
-        if( mwAriAction & MW_ARI_IGNORE ) {
-            mwWrite( "verify trap: <%ld> AUTO IGNORED - execution continues\n", mwCounter );
-			MW_MUTEX_UNLOCK();
-            return 0;
-            }
-        fprintf(mwSTDERR,"\nMEMWATCH: verify trap: %s(%d), %s\n", fn, ln, exps );
-        }
-    FLUSH();
-    (void) mwTestNow( fn, ln, 1 );
-    FLUSH();
-	MW_MUTEX_UNLOCK();
-	exit(255);
-    /* NOT REACHED - the return statement is in to keep */
-    /* stupid compilers from squeaking about differing return modes. */
-    /* Smart compilers instead say 'code unreachable...' */
-    /*lint -save -e527 */
-    return 0;
-    /*lint -restore */
-    }
-
-void mwTrace( const char *format, ... ) {
-    int tot, oflow = 0;
-    va_list mark;
-
-    mwAutoInit();
-	MW_MUTEX_LOCK();
-    TESTS(NULL,0);
-    if( mwOutFunction == NULL ) mwOutFunction = mwDefaultOutFunc;
-
-    va_start( mark, format );
-    tot = vsprintf( mwPrintBuf, format, mark );
-    va_end( mark );
-    if( tot >= MW_TRACE_BUFFER ) { mwPrintBuf[MW_TRACE_BUFFER] = 0; oflow = 1; }
-    for(tot=0;mwPrintBuf[tot];tot++)
-        (*mwOutFunction)( mwPrintBuf[tot] );
-    if( oflow ) {
-        mwIncErr();
-        mwTrace( " [WARNING: OUTPUT BUFFER OVERFLOW - SYSTEM UNSTABLE]\n" );
-        }
-
-    FLUSH();
-	MW_MUTEX_UNLOCK();
-    }
-
-
-/***********************************************************************
-** Grab & Drop
-***********************************************************************/
-
-unsigned mwGrab( unsigned kb ) {
-    TESTS(NULL,0);
-    return mwGrab_( kb, MW_VAL_GRB, 0 );
-    }
-
-unsigned mwDrop( unsigned kb ) {
-    TESTS(NULL,0);
-    return mwDrop_( kb, MW_VAL_GRB, 0 );
-    }
-
-static void mwDropAll() {
-    TESTS(NULL,0);
-    (void) mwDrop_( 0, MW_VAL_GRB, 0 );
-    (void) mwDrop_( 0, MW_VAL_NML, 0 );
-    if( mwGrabList != NULL )
-        mwWrite( "internal: the grab list is not empty after mwDropAll()\n");
-    }
-
-static const char *mwGrabType( int type ) {
-    switch( type ) {
-        case MW_VAL_GRB:
-            return "grabbed";
-        case MW_VAL_NML:
-            return "no-mans-land";
-        default:
-            /* do nothing */
-            ;
-        }
-    return "<unknown type>";
-    }
-
-static unsigned mwGrab_( unsigned kb, int type, int silent ) {
-    unsigned i = kb;
-    mwGrabData *gd;
-    if( !kb ) i = kb = 65000U;
-
-    for(;kb;kb--) {
-        if( mwUseLimit &&
-            (mwStatCurAlloc + mwGrabSize + (long)sizeof(mwGrabData) > mwAllocLimit) ) {
-            if( !silent ) {
-                mwWrite("grabbed: all allowed memory to %s (%u kb)\n",
-                    mwGrabType(type), i-kb);
-                FLUSH();
-                }
-            return i-kb;
-            }
-        gd = (mwGrabData*) malloc( sizeof(mwGrabData) );
-        if( gd == NULL ) {
-            if( !silent ) {
-                mwWrite("grabbed: all available memory to %s (%u kb)\n",
-                    mwGrabType(type), i-kb);
-                FLUSH();
-                }
-            return i-kb;
-            }
-        mwGrabSize += (long) sizeof(mwGrabData);
-        gd->next = mwGrabList;
-        memset( gd->blob, type, sizeof(gd->blob) );
-        gd->type = type;
-        mwGrabList = gd;
-        }
-    if( !silent ) {
-        mwWrite("grabbed: %u kilobytes of %s memory\n", i, mwGrabType(type) );
-        FLUSH();
-        }
-    return i;
-    }
-
-static unsigned mwDrop_( unsigned kb, int type, int silent ) {
-    unsigned i = kb;
-    mwGrabData *gd,*tmp,*pr;
-    const void *p;
-
-    if( mwGrabList == NULL && kb == 0 ) return 0;
-    if( !kb ) i = kb = 60000U;
-
-    pr = NULL;
-    gd = mwGrabList;
-    for(;kb;) {
-        if( gd == NULL ) {
-            if( i-kb > 0 && !silent ) {
-                mwWrite("dropped: all %s memory (%u kb)\n", mwGrabType(type), i-kb);
-                FLUSH();
-                }
-            return i-kb;
-            }
-        if( gd->type == type ) {
-            if( pr ) pr->next = gd->next;
-            kb --;
-            tmp = gd;
-            if( mwGrabList == gd ) mwGrabList = gd->next;
-            gd = gd->next;
-            p = mwTestMem( tmp->blob, sizeof( tmp->blob ), type );
-            if( p != NULL ) {
-                mwWrite( "wild pointer: <%ld> %s memory hit at %p\n",
-                    mwCounter, mwGrabType(type), p );
-                FLUSH();
-                }
-            mwGrabSize -= (long) sizeof(mwGrabData);
-            free( tmp );
-            }
-        else {
-            pr = gd;
-            gd = gd->next;
-            }
-        }
-    if( !silent ) {
-        mwWrite("dropped: %u kilobytes of %s memory\n", i, mwGrabType(type) );
-        FLUSH();
-        }
-    return i;
-    }
-
-/***********************************************************************
-** No-Mans-Land
-***********************************************************************/
-
-void mwNoMansLand( int level ) {
-    mwAutoInit();
-    TESTS(NULL,0);
-    switch( level ) {
-        case MW_NML_NONE:
-            (void) mwDrop_( 0, MW_VAL_NML, 0 );
-            break;
-        case MW_NML_FREE:
-            break;
-        case MW_NML_ALL:
-            (void) mwGrab_( 0, MW_VAL_NML, 0 );
-            break;
-        default:
-            return;
-        }
-    mwNML = level;
-    }
-
-/***********************************************************************
-** Static functions
-***********************************************************************/
-
-static void mwAutoInit( void )
-{
-    if( mwInited ) return;
-    mwUseAtexit = 1;
-    mwInit();
-    return;
-}
-
-static FILE *mwLogR() {
-    if( (mwLog == mwLogB1) && (mwLog == mwLogB2) ) return mwLog;
-    if( mwLog == mwLogB1 ) mwLogB2 = mwLog;
-    if( mwLog == mwLogB2 ) mwLogB1 = mwLog;
-    if( mwLogB1 == mwLogB2 ) mwLog = mwLogB1;
-    if( (mwLog == mwLogB1) && (mwLog == mwLogB2) ) {
-        mwWrite("internal: log file handle damaged and recovered\n");
-        FLUSH();
-        return mwLog;
-        }
-    fprintf(mwSTDERR,"\nMEMWATCH: log file handle destroyed, using mwSTDERR\n" );
-    mwLog = mwLogB1 = mwLogB2 = mwSTDERR;
-    return mwSTDERR;
-    }
-
-static void mwLogW( FILE *p ) {
-    mwLog = mwLogB1 = mwLogB2 = p;
-    }
-
-static int mwFlushR() {
-    if( (mwFlushing == mwFlushingB1) && (mwFlushing == mwFlushingB2) ) return mwFlushing;
-    if( mwFlushing == mwFlushingB1 ) mwFlushingB2 = mwFlushing;
-    if( mwFlushing == mwFlushingB2 ) mwFlushingB1 = mwFlushing;
-    if( mwFlushingB1 == mwFlushingB2 ) mwFlushing = mwFlushingB1;
-    if( (mwFlushing == mwFlushingB1) && (mwFlushing == mwFlushingB2) ) {
-        mwWrite("internal: flushing flag damaged and recovered\n");
-        FLUSH();
-        return mwFlushing;
-        }
-    mwWrite("internal: flushing flag destroyed, so set to true\n");
-    mwFlushing = mwFlushingB1 = mwFlushingB2 = 1;
-    return 1;
-    }
-
-static void mwFlushW( int n ) {
-    mwFlushing = mwFlushingB1 = mwFlushingB2 = n;
-    }
-
-static void mwIncErr() {
-    mwErrors++;
-    mwFlushW( mwFlushR()+1 );
-    FLUSH();
-    }
-
-static void mwFlush() {
-    if( mwLogR() == NULL ) return;
-#ifdef MW_FLUSH
-    fflush( mwLogR() );
-#else
-    if( mwFlushR() ) fflush( mwLogR() );
-#endif
-    return;
-    }
-
-static void mwUnlink( mwData* mw, const char* file, int line ) {
-    if( mw->prev == NULL ) {
-        if( mwHead != mw )
-            mwWrite( "internal: <%ld> %s(%d), MW-%p: link1 NULL, but not head\n",
-                mwCounter, file, line, mw );
-        mwHead = mw->next;
-        }
-    else {
-        if( mw->prev->next != mw )
-            mwWrite( "internal: <%ld> %s(%d), MW-%p: link1 failure\n",
-                mwCounter, file, line, mw );
-        else mw->prev->next = mw->next;
-        }
-    if( mw->next == NULL ) {
-        if( mwTail != mw )
-            mwWrite( "internal: <%ld> %s(%d), MW-%p: link2 NULL, but not tail\n",
-                mwCounter, file, line, mw );
-        mwTail = mw->prev;
-        }
-    else {
-        if( mw->next->prev != mw )
-            mwWrite( "internal: <%ld> %s(%d), MW-%p: link2 failure\n",
-                mwCounter, file, line, mw );
-        else mw->next->prev = mw->prev;
-        }
-    }
-
-/*
-** Relinking tries to repair a damaged mw block.
-** Returns nonzero if it thinks it successfully
-** repaired the heap chain.
-*/
-static int mwRelink( mwData* mw, const char* file, int line ) {
-    int fails;
-    mwData *mw1, *mw2;
-    long count, size;
-    mwStat *ms;
-
-	if( file == NULL ) file = "unknown";
-
-    if( mw == NULL ) {
-        mwWrite("relink: cannot repair MW at NULL\n");
-        FLUSH();
-        goto emergency;
-        }
-
-    if( !mwIsSafeAddr(mw, mwDataSize) ) {
-        mwWrite("relink: MW-%p is a garbage pointer\n", mw);
-        FLUSH();
-        goto emergency;
-        }
-
-    mwWrite("relink: <%ld> %s(%d) attempting to repair MW-%p...\n", mwCounter, file, line, mw );
-    FLUSH();
-    fails = 0;
-
-    /* Repair from head */
-    if( mwHead != mw ) {
-        if( !mwIsSafeAddr( mwHead, mwDataSize ) ) {
-            mwWrite("relink: failed for MW-%p; head pointer destroyed\n", mw );
-            FLUSH();
-            goto emergency;
-            }
-        for( mw1=mwHead; mw1; mw1=mw1->next ) {
-            if( mw1->next == mw ) {
-                mw->prev = mw1;
-                break;
-                }
-            if( mw1->next &&
-                ( !mwIsSafeAddr(mw1->next, mwDataSize ) || mw1->next->prev != mw1) ) {
-                mwWrite("relink: failed for MW-%p; forward chain fragmented at MW-%p: 'next' is %p\n", mw, mw1, mw1->next );
-                FLUSH();
-                goto emergency;
-                }
-            }
-        if( mw1 == NULL ) {
-            mwWrite("relink: MW-%p not found in forward chain search\n", mw );
-            FLUSH();
-            fails ++;
-            }
-        }
-	else
-	{
-		mwWrite( "relink: MW-%p is the head (first) allocation\n", mw );
-		if( mw->prev != NULL )
-		{
-			mwWrite( "relink: MW-%p prev pointer is non-NULL, you have a wild pointer\n", mw );
-			mw->prev = NULL;
-		}
-	}
-
-    /* Repair from tail */
-    if( mwTail != mw ) {
-        if( !mwIsSafeAddr( mwTail, mwDataSize ) ) {
-            mwWrite("relink: failed for MW-%p; tail pointer destroyed\n", mw );
-            FLUSH();
-            goto emergency;
-            }
-        for( mw1=mwTail; mw1; mw1=mw1->prev ) {
-            if( mw1->prev == mw ) {
-                mw->next = mw1;
-                break;
-                }
-            if( mw1->prev && (!mwIsSafeAddr(mw1->prev, mwDataSize ) || mw1->prev->next != mw1) ) {
-                mwWrite("relink: failed for MW-%p; reverse chain fragmented at MW-%p, 'prev' is %p\n", mw, mw1, mw1->prev );
-                FLUSH();
-                goto emergency;
-                }
-            }
-        if( mw1 == NULL ) {
-            mwWrite("relink: MW-%p not found in reverse chain search\n", mw );
-            FLUSH();
-            fails ++;
-            }
-        }
-	else
-	{
-		mwWrite( "relink: MW-%p is the tail (last) allocation\n", mw );
-		if( mw->next != NULL )
-		{
-			mwWrite( "relink: MW-%p next pointer is non-NULL, you have a wild pointer\n", mw );
-			mw->next = NULL;
-		}
-	}
-
-    if( fails > 1 ) {
-        mwWrite("relink: heap appears intact, MW-%p probably garbage pointer\n", mw );
-        FLUSH();
-        goto verifyok;
-        }
-
-    /* restore MW info where possible */
-    if( mwIsReadAddr( mw->file, 1 ) ) {
-        ms = mwStatGet( mw->file, -1, 0 );
-        if( ms == NULL ) mw->file = "<relinked>";
-        }
-    mw->check = CHKVAL(mw);
-    goto verifyok;
-
-    /* Emergency repair */
-    emergency:
-
-    if( mwHead == NULL && mwTail == NULL )
-    {
-        if( mwStatCurAlloc == 0 )
-            mwWrite("relink: <%ld> %s(%d) heap is empty, nothing to repair\n", mwCounter, file, line );
-        else
-            mwWrite("relink: <%ld> %s(%d) heap damaged beyond repair\n", mwCounter, file, line );
-        FLUSH();
-        return 0;
-    }
-
-    mwWrite("relink: <%ld> %s(%d) attempting emergency repairs...\n", mwCounter, file, line );
-    FLUSH();
-
-	if( mwHead == NULL || mwTail == NULL )
-	{
-		if( mwHead == NULL ) mwWrite("relink: mwHead is NULL, but mwTail is %p\n", mwTail );
-		else mwWrite("relink: mwTail is NULL, but mwHead is %p\n", mwHead );
-	}
-
-    mw1=NULL;
-    if( mwHead != NULL )
-	{
-		if( !mwIsReadAddr( mwHead, mwDataSize ) || mwHead->check != CHKVAL(mwHead) )
-		{
-			mwWrite("relink: mwHead (MW-%p) is damaged, skipping forward scan\n", mwHead );
-			mwHead = NULL;
-			goto scan_reverse;
-		}
-		if( mwHead->prev != NULL )
-		{
-			mwWrite("relink: the mwHead pointer's 'prev' member is %p, not NULL\n", mwHead->prev );
-		}
-        for( mw1=mwHead; mw1; mw1=mw1->next )
-		{
-			if( mw1->next )
-			{
-				if( !mwIsReadAddr(mw1->next,mwDataSize) ||
-					!mw1->next->check != CHKVAL(mw1) ||
-					mw1->next->prev != mw1 )
-				{
-					mwWrite("relink: forward chain's last intact MW is MW-%p, %ld %sbytes at %s(%d)\n",
-						mw1, mw1->size, (mw->flag & MW_NML)?"NoMansLand ":"", mw1->file, mw1->line );
-					if( mwIsReadAddr(mw1->next,mwDataSize ) )
-					{
-						mwWrite("relink: forward chain's first damaged MW is MW-%p, %ld %sbytes at %s(%d)\n",
-							mw1->next, mw1->size, (mw->flag & MW_NML)?"NoMansLand ":"",
-							mwIsReadAddr(mw1->file,16)?mw1->file:"<garbage-pointer>", mw1->line );
-					}
-					else
-					{
-						mwWrite("relink: the 'next' pointer of this MW points to %p, which is out-of-legal-access\n",
-							mw1->next );
-					}
-					break;
-				}
-			}
-        }
-	}
-
-
-scan_reverse:
-    mw2=NULL;
-    if( mwTail != NULL )
-	{
-		if( !mwIsReadAddr(mwTail,mwDataSize) || mwTail->check != CHKVAL(mwTail) )
-		{
-			mwWrite("relink: mwTail (%p) is damaged, skipping reverse scan\n", mwTail );
-			mwTail = NULL;
-			goto analyze;
-		}
-		if( mwTail->next != NULL )
-		{
-			mwWrite("relink: the mwTail pointer's 'next' member is %p, not NULL\n", mwTail->next );
-		}
-        for( mw2=mwTail; mw2; mw2=mw2->prev )
-		{
-            if( mw2->prev )
-			{
-				if( !mwIsReadAddr(mw2->prev,mwDataSize) ||
-					!mw2->prev->check != CHKVAL(mw2) ||
-					mw2->prev->next != mw2 )
-				{
-					mwWrite("relink: reverse chain's last intact MW is MW-%p, %ld %sbytes at %s(%d)\n",
-						mw2, mw2->size, (mw->flag & MW_NML)?"NoMansLand ":"", mw2->file, mw2->line );
-					if( mwIsReadAddr(mw2->prev,mwDataSize ) )
-					{
-						mwWrite("relink: reverse chain's first damaged MW is MW-%p, %ld %sbytes at %s(%d)\n",
-							mw2->prev, mw2->size, (mw->flag & MW_NML)?"NoMansLand ":"",
-							mwIsReadAddr(mw2->file,16)?mw2->file:"<garbage-pointer>", mw2->line );
-					}
-					else
-					{
-						mwWrite("relink: the 'prev' pointer of this MW points to %p, which is out-of-legal-access\n",
-							mw2->prev );
-					}
-					break;
-				}
-			}
-        }
-	}
-
-analyze:
-	if( mwHead == NULL && mwTail == NULL )
-	{
-        mwWrite("relink: both head and tail pointers damaged, aborting program\n");
-        mwFlushW(1);
-        FLUSH();
-        abort();
-	}
-	if( mwHead == NULL )
-	{
-		mwHead = mw2;
-		mwWrite("relink: heap truncated, MW-%p designated as new mwHead\n", mw2 );
-		mw2->prev = NULL;
-		mw1 = mw2 = NULL;
-	}
-	if( mwTail == NULL )
-	{
-		mwTail = mw1;
-		mwWrite("relink: heap truncated, MW-%p designated as new mwTail\n", mw1 );
-		mw1->next = NULL;
-		mw1 = mw2 = NULL;
-	}
-    if( mw1 == NULL && mw2 == NULL &&
-        mwHead->prev == NULL && mwTail->next == NULL ) {
-        mwWrite("relink: verifying heap integrity...\n" );
-        FLUSH();
-        goto verifyok;
-        }
-    if( mw1 && mw2 && mw1 != mw2 ) {
-        mw1->next = mw2;
-        mw2->prev = mw1;
-        mwWrite("relink: emergency repairs successful, assessing damage...\n");
-        FLUSH();
-        }
-    else {
-        mwWrite("relink: heap totally destroyed, aborting program\n");
-        mwFlushW(1);
-        FLUSH();
-        abort();
-        }
-
-    /* Verify by checking that the number of active allocations */
-    /* match the number of entries in the chain */
-verifyok:
-    if( !mwIsHeapOK( NULL ) ) {
-        mwWrite("relink: heap verification FAILS - aborting program\n");
-        mwFlushW(1);
-        FLUSH();
-        abort();
-        }
-    for( size=count=0, mw1=mwHead; mw1; mw1=mw1->next ) {
-        count ++;
-        size += (long) mw1->size;
-        }
-    if( count == mwNumCurAlloc ) {
-        mwWrite("relink: successful, ");
-        if( size == mwStatCurAlloc ) {
-            mwWrite("no allocations lost\n");
-            }
-        else {
-            if( mw != NULL ) {
-                mwWrite("size information lost for MW-%p\n", mw);
-                mw->size = 0;
-                }
-            }
-        }
-    else {
-        mwWrite("relink: partial, %ld MW-blocks of %ld bytes lost\n",
-			mwNmlNumAlloc+mwNumCurAlloc-count, mwNmlCurAlloc+mwStatCurAlloc-size );
-        return 0;
-        }
-
-    return 1;
-    }
-
-/*
-**  If mwData* is NULL:
-**      Returns 0 if heap chain is broken.
-**      Returns 1 if heap chain is intact.
-**  If mwData* is not NULL:
-**      Returns 0 if mwData* is missing or if chain is broken.
-**      Returns 1 if chain is intact and mwData* is found.
-*/
-static int mwIsHeapOK( mwData *includes_mw ) {
-    int found = 0;
-    mwData *mw;
-
-    for( mw = mwHead; mw; mw=mw->next ) {
-        if( includes_mw == mw ) found++;
-        if( !mwIsSafeAddr( mw, mwDataSize ) ) return 0;
-        if( mw->prev ) {
-            if( !mwIsSafeAddr( mw->prev, mwDataSize ) ) return 0;
-            if( mw==mwHead || mw->prev->next != mw ) return 0;
-            }
-        if( mw->next ) {
-            if( !mwIsSafeAddr( mw->next, mwDataSize ) ) return 0;
-            if( mw==mwTail || mw->next->prev != mw ) return 0;
-            }
-        else if( mw!=mwTail ) return 0;
-        }
-
-    if( includes_mw != NULL && !found ) return 0;
-
-    return 1;
-    }
-
-static int mwIsOwned( mwData* mw, const char *file, int line ) {
-    int retv;
-    mwStat *ms;
-
-    /* see if the address is legal according to OS */
-    if( !mwIsSafeAddr( mw, mwDataSize ) ) return 0;
-
-    /* make sure we have _anything_ allocated */
-    if( mwHead == NULL && mwTail == NULL && mwStatCurAlloc == 0 )
-        return 0;
-
-    /* calculate checksum */
-    if( mw->check != CHKVAL(mw) ) {
-        /* may be damaged checksum, see if block is in heap */
-        if( mwIsHeapOK( mw ) ) {
-            /* damaged checksum, repair it */
-            mwWrite( "internal: <%ld> %s(%d), checksum for MW-%p is incorrect\n",
-                mwCounter, file, line, mw );
-            mwIncErr();
-            if( mwIsReadAddr( mw->file, 1 ) ) {
-                ms = mwStatGet( mw->file, -1, 0 );
-                if( ms == NULL ) mw->file = "<relinked>";
-                }
-            else mw->file = "<unknown>";
-            mw->size = 0;
-            mw->check = CHKVAL(mw);
-            return 1;
-            }
-        /* no, it's just some garbage data */
-        return 0;
-        }
-
-	/* check that the non-NULL pointers are safe */
-	if( mw->prev && !mwIsSafeAddr( mw->prev, mwDataSize ) ) mwRelink( mw, file, line );
-	if( mw->next && !mwIsSafeAddr( mw->next, mwDataSize ) ) mwRelink( mw, file, line );
-
-    /* safe address, checksum OK, proceed with heap checks */
-
-    /* see if the block is in the heap */
-    retv = 0;
-    if( mw->prev ) { if( mw->prev->next == mw ) retv ++; }
-    else { if( mwHead == mw ) retv++; }
-    if( mw->next ) { if( mw->next->prev == mw ) retv ++; }
-    else { if( mwTail == mw ) retv++; }
-    if( mw->check == CHKVAL(mw) ) retv ++;
-    if( retv > 2 ) return 1;
-
-    /* block not in heap, check heap for corruption */
-
-    if( !mwIsHeapOK( mw ) ) {
-        if( mwRelink( mw, file, line ) )
-            return 1;
-        }
-
-    /* unable to repair */
-    mwWrite( "internal: <%ld> %s(%d), mwIsOwned fails for MW-%p\n",
-       mwCounter, file, line, mw );
-    mwIncErr();
-
-    return 0;
-    }
-
-/*
-** mwTestBuf:
-**  Checks a buffers links and pre/postfixes.
-**  Writes errors found to the log.
-**  Returns zero if no errors found.
-*/
-static int mwTestBuf( mwData* mw, const char* file, int line ) {
-    int retv = 0;
-    char *p;
-
-    if( file == NULL ) file = "unknown";
-
-    if( !mwIsSafeAddr( mw, mwDataSize + mwOverflowZoneSize ) ) {
-        mwWrite( "internal: <%ld> %s(%d): pointer MW-%p is invalid\n",
-            mwCounter, file, line, mw );
-        mwIncErr();
-        return 2;
-        }
-
-    if( mw->check != CHKVAL(mw) ) {
-        mwWrite( "internal: <%ld> %s(%d), info trashed; relinking\n",
-            mwCounter, file, line );
-        mwIncErr();
-        if( !mwRelink( mw, file, line ) ) return 2;
-        }
-
-    if( mw->prev && mw->prev->next != mw ) {
-        mwWrite( "internal: <%ld> %s(%d), buffer <%ld> %s(%d) link1 broken\n",
-            mwCounter,file,line, (long)mw->size, mw->count, mw->file, mw->line );
-        mwIncErr();
-        if( !mwRelink( mw, file, line ) ) retv = 2;
-        }
-    if( mw->next && mw->next->prev != mw ) {
-        mwWrite( "internal: <%ld> %s(%d), buffer <%ld> %s(%d) link2 broken\n",
-            mwCounter,file,line, (long)mw->size, mw->count, mw->file, mw->line );
-        mwIncErr();
-        if( !mwRelink( mw, file, line ) ) retv = 2;
-        }
-
-    p = ((char*)mw) + mwDataSize;
-    if( mwCheckOF( p ) ) {
-        mwWrite( "underflow: <%ld> %s(%d), %ld bytes alloc'd at <%ld> %s(%d)\n",
-            mwCounter,file,line, (long)mw->size, mw->count, mw->file, mw->line );
-        mwIncErr();
-        retv = 1;
-        }
-    p += mwOverflowZoneSize + mw->size;
-    if( mwIsReadAddr( p, mwOverflowZoneSize ) && mwCheckOF( p ) ) {
-        mwWrite( "overflow: <%ld> %s(%d), %ld bytes alloc'd at <%ld> %s(%d)\n",
-            mwCounter,file,line, (long)mw->size, mw->count, mw->file, mw->line );
-        mwIncErr();
-        retv = 1;
-        }
-
-    return retv;
-    }
-
-static void mwDefaultOutFunc( int c ) {
-    if( mwLogR() ) fputc( c, mwLogR() );
-    }
-
-static void mwWrite( const char *format, ... ) {
-    int tot, oflow = 0;
-    va_list mark;
-    mwAutoInit();
-    if( mwOutFunction == NULL ) mwOutFunction = mwDefaultOutFunc;
-    va_start( mark, format );
-    tot = vsprintf( mwPrintBuf, format, mark );
-    va_end( mark );
-    if( tot >= MW_TRACE_BUFFER ) { mwPrintBuf[MW_TRACE_BUFFER] = 0; oflow = 1; }
-    for(tot=0;mwPrintBuf[tot];tot++)
-        (*mwOutFunction)( mwPrintBuf[tot] );
-    if( oflow ) {
-        mwWrite( "\ninternal: mwWrite(): WARNING! OUTPUT EXCEEDED %u CHARS: SYSTEM UNSTABLE\n", MW_TRACE_BUFFER-1 );
-        FLUSH();
-        }
-    return;
-    }
-
-static void mwLogFile( const char *name ) {
-    time_t tid;
-    (void) time( &tid );
-    if( mwLogR() != NULL ) {
-        fclose( mwLogR() );
-        mwLogW( NULL );
-        }
-    if( name == NULL ) return;
-    mwLogW( fopen( name, "a" COMMIT ) );
-    if( mwLogR() == NULL )
-        mwWrite( "logfile: failed to open/create file '%s'\n", name );
-    }
-
-/*
-** Try to free NML memory until a contiguous allocation of
-** 'needed' bytes can be satisfied. If this is not enough
-** and the 'urgent' parameter is nonzero, grabbed memory is
-** also freed.
-*/
-static size_t mwFreeUp( size_t needed, int urgent ) {
-    void *p;
-    mwData *mw, *mw2;
-    char *data;
-
-    /* free grabbed NML memory */
-    for(;;) {
-        if( mwDrop_( 1, MW_VAL_NML, 1 ) == 0 ) break;
-        p = malloc( needed );
-        if( p == NULL ) continue;
-        free( p );
-        return needed;
-        }
-
-    /* free normal NML memory */
-    mw = mwHead;
-    while( mw != NULL ) {
-        if( !(mw->flag & MW_NML) ) mw = mw->next;
-        else {
-            data = ((char*)mw)+mwDataSize+mwOverflowZoneSize;
-            if( mwTestMem( data, mw->size, MW_VAL_NML ) ) {
-                mwIncErr();
-                mwWrite( "wild pointer: <%ld> NoMansLand %p alloc'd at %s(%d)\n",
-                    mw->count, data + mwOverflowZoneSize, mw->file, mw->line );
-                }
-            mw2 = mw->next;
-            mwUnlink( mw, "mwFreeUp", 0 );
-            free( mw );
-            mw = mw2;
-            p = malloc( needed );
-            if( p == NULL ) continue;
-            free( p );
-            return needed;
-            }
-        }
-
-    /* if not urgent (for internal purposes), fail */
-    if( !urgent ) return 0;
-
-    /* free grabbed memory */
-    for(;;) {
-        if( mwDrop_( 1, MW_VAL_GRB, 1 ) == 0 ) break;
-        p = malloc( needed );
-        if( p == NULL ) continue;
-        free( p );
-        return needed;
-        }
-
-    return 0;
-    }
-
-static const void * mwTestMem( const void *p, unsigned len, int c ) {
-    const unsigned char *ptr;
-    ptr = (const unsigned char *) p;
-    while( len-- ) {
-        if( *ptr != (unsigned char)c ) return (const void*)ptr;
-        ptr ++;
-        }
-    return NULL;
-    }
-
-static int mwStrCmpI( const char *s1, const char *s2 ) {
-    if( s1 == NULL || s2 == NULL ) return 0;
-    while( *s1 ) {
-        if( toupper(*s2) == toupper(*s1) ) { s1++; s2++; continue; }
-        return 1;
-        }
-    return 0;
-    }
-
-#define AIPH() if( always_invoked ) { mwWrite("autocheck: <%ld> %s(%d) ", mwCounter, file, line ); always_invoked = 0; }
-
-static int mwTestNow( const char *file, int line, int always_invoked ) {
-    int retv = 0;
-    mwData *mw;
-    char *data;
-
-    if( file && !always_invoked )
-        mwWrite("check: <%ld> %s(%d), checking %s%s%s\n",
-            mwCounter, file, line,
-			(mwTestFlags & MW_TEST_CHAIN) ? "chain ": "",
-		    (mwTestFlags & MW_TEST_ALLOC) ? "alloc ": "",
-		    (mwTestFlags & MW_TEST_NML) ? "nomansland ": ""
-			);
-
-    if( mwTestFlags & MW_TEST_CHAIN ) {
-        for( mw = mwHead; mw; mw=mw->next ) {
-			if( !mwIsSafeAddr(mw, mwDataSize) ) {
-				AIPH();
-				mwWrite("check: heap corruption detected\n");
-				mwIncErr();
-				return retv + 1;
-				}
-			if( mw->prev ) {
-				if( !mwIsSafeAddr(mw->prev, mwDataSize) ) {
-					AIPH();
-					mwWrite("check: heap corruption detected\n");
-					mwIncErr();
-					return retv + 1;
-					}
-				if( mw==mwHead || mw->prev->next != mw ) {
-					AIPH();
-					mwWrite("check: heap chain broken, prev link incorrect\n");
-					mwIncErr();
-					retv ++;
-					}
-				}
-			if( mw->next ) {
-				if( !mwIsSafeAddr(mw->next, mwDataSize) ) {
-					AIPH();
-					mwWrite("check: heap corruption detected\n");
-					mwIncErr();
-					return retv + 1;
-					}
-				if( mw==mwTail || mw->next->prev != mw ) {
-					AIPH();
-					mwWrite("check: heap chain broken, next link incorrect\n");
-					mwIncErr();
-					retv ++;
-					}
-				}
-			else if( mw!=mwTail ) {
-				AIPH();
-				mwWrite("check: heap chain broken, tail incorrect\n");
-				mwIncErr();
-				retv ++;
-				}
-            }
-        }
-    if( mwTestFlags & MW_TEST_ALLOC ) {
-        for( mw = mwHead; mw; mw=mw->next ) {
-            if( mwTestBuf( mw, file, line ) ) retv ++;
-            }
-        }
-    if( mwTestFlags & MW_TEST_NML ) {
-        for( mw = mwHead; mw; mw=mw->next ) {
-            if( (mw->flag & MW_NML) ) {
-                data = ((char*)mw)+mwDataSize+mwOverflowZoneSize;
-                if( mwTestMem( data, mw->size, MW_VAL_NML ) ) {
-                    mwIncErr();
-                    mwWrite( "wild pointer: <%ld> NoMansLand %p alloc'd at %s(%d)\n",
-                        mw->count, data + mwOverflowZoneSize, mw->file, mw->line );
-                    }
-                }
-            }
-        }
-
-
-	if( file && !always_invoked && !retv )
-        mwWrite("check: <%ld> %s(%d), complete; no errors\n",
-            mwCounter, file, line );
-    return retv;
-    }
-
-/**********************************************************************
-** Statistics
-**********************************************************************/
-
-static void mwStatReport()
-{
-    mwStat* ms, *ms2;
-    const char *modname;
-    int modnamelen;
-
-    /* global statistics report */
-    mwWrite( "\nMemory usage statistics (global):\n" );
-    mwWrite( " N)umber of allocations made: %ld\n", mwStatNumAlloc );
-    mwWrite( " L)argest memory usage      : %ld\n", mwStatMaxAlloc );
-    mwWrite( " T)otal of all alloc() calls: %ld\n", mwStatTotAlloc );
-    mwWrite( " U)nfreed bytes totals      : %ld\n", mwStatCurAlloc );
-    FLUSH();
-
-    if( mwStatLevel < 1 ) return;
-
-    /* on a per-module basis */
-    mwWrite( "\nMemory usage statistics (detailed):\n");
-    mwWrite( " Module/Line                                Number   Largest  Total    Unfreed \n");
-    for( ms=mwStatList; ms; ms=ms->next )
-    {
-        if( ms->line == -1 )
-        {
-			if( ms->file == NULL || !mwIsReadAddr(ms->file,22) ) modname = "<unknown>";
-			else modname = ms->file;
-			modnamelen = strlen(modname);
-			if( modnamelen > 42 )
-			{
-				modname = modname + modnamelen - 42;
-			}
-
-            mwWrite(" %-42s %-8ld %-8ld %-8ld %-8ld\n",
-            	modname, ms->num, ms->max, ms->total, ms->curr );
-            if( ms->file && mwStatLevel > 1 )
-            {
-                for( ms2=mwStatList; ms2; ms2=ms2->next )
-                {
-                    if( ms2->line!=-1 && ms2->file!=NULL && !mwStrCmpI( ms2->file, ms->file ) )
-					{
-					mwWrite( "  %-8d                                  %-8ld %-8ld %-8ld %-8ld\n",
-						ms2->line, ms2->num, ms2->max, ms2->total, ms2->curr );
-					}
-				}
-			}
-		}
-	}
-}
-
-static mwStat* mwStatGet( const char *file, int line, int makenew ) {
-    mwStat* ms;
-
-    if( mwStatLevel < 2 ) line = -1;
-
-    for( ms=mwStatList; ms!=NULL; ms=ms->next ) {
-        if( line != ms->line ) continue;
-        if( file==NULL ) {
-            if( ms->file == NULL ) break;
-            continue;
-            }
-        if( ms->file == NULL ) continue;
-        if( !strcmp( ms->file, file ) ) break;
-        }
-
-    if( ms != NULL ) return ms;
-
-    if( !makenew ) return NULL;
-
-    ms = (mwStat*) malloc( sizeof(mwStat) );
-    if( ms == NULL ) {
-        if( mwFreeUp( sizeof(mwStat), 0 ) < sizeof(mwStat) ||
-            (ms=(mwStat*)malloc(sizeof(mwStat))) == NULL ) {
-            mwWrite("internal: memory low, statistics incomplete for '%s'\n", file );
-            return NULL;
-            }
-        }
-    ms->file = file;
-    ms->line = line;
-    ms->total = 0L;
-    ms->max = 0L;
-    ms->num = 0L;
-    ms->curr = 0L;
-    ms->next = mwStatList;
-    mwStatList = ms;
-    return ms;
-    }
-
-static void mwStatAlloc( size_t size, const char* file, int line ) {
-    mwStat* ms;
-
-    /* update the module statistics */
-    ms = mwStatGet( file, -1, 1 );
-    if( ms != NULL ) {
-        ms->total += (long) size;
-        ms->curr += (long) size;
-        ms->num ++;
-        if( ms->curr > ms->max ) ms->max = ms->curr;
-        }
-
-    /* update the line statistics */
-    if( mwStatLevel > 1 && line != -1 && file ) {
-        ms = mwStatGet( file, line, 1 );
-        if( ms != NULL ) {
-            ms->total += (long) size;
-            ms->curr += (long) size;
-            ms->num ++;
-            if( ms->curr > ms->max ) ms->max = ms->curr;
-            }
-        }
-
-    }
-
-static void mwStatFree( size_t size, const char* file, int line ) {
-    mwStat* ms;
-
-    /* update the module statistics */
-    ms = mwStatGet( file, -1, 1 );
-    if( ms != NULL ) ms->curr -= (long) size;
-
-    /* update the line statistics */
-    if( mwStatLevel > 1 && line != -1 && file ) {
-        ms = mwStatGet( file, line, 1 );
-        if( ms != NULL ) ms->curr -= (long) size;
-        }
-    }
-
-/***********************************************************************
-** Safe memory checkers
-**
-** Using ifdefs, implement the operating-system specific mechanism
-** of identifying a piece of memory as legal to access with read
-** and write priviliges. Default: return nonzero for non-NULL pointers.
-***********************************************************************/
-
-static char mwDummy( char c )
-{
-	return c;
-}
-
-#ifndef MW_SAFEADDR
-#ifdef WIN32
-#define MW_SAFEADDR
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-int mwIsReadAddr( const void *p, unsigned len )
-{
-    if( p == NULL ) return 0;
-    if( IsBadReadPtr(p,len) ) return 0;
-    return 1;
-}
-int mwIsSafeAddr( void *p, unsigned len )
-{
-    /* NOTE: For some reason, under Win95 the IsBad... */
-    /* can return false for invalid pointers. */
-    if( p == NULL ) return 0;
-    if( IsBadReadPtr(p,len) || IsBadWritePtr(p,len) ) return 0;
-    return 1;
-}
-#endif /* WIN32 */
-#endif /* MW_SAFEADDR */
-
-#ifndef MW_SAFEADDR
-#ifdef SIGSEGV
-#define MW_SAFEADDR
-
-typedef void (*mwSignalHandlerPtr)( int );
-mwSignalHandlerPtr mwOldSIGSEGV = (mwSignalHandlerPtr) 0;
-jmp_buf mwSIGSEGVjump;
-static void mwSIGSEGV( int n );
-
-static void mwSIGSEGV( int n )
-{
-	n = n;
-	longjmp( mwSIGSEGVjump, 1 );
-}
-
-int mwIsReadAddr( const void *p, unsigned len )
-{
-	const char *ptr;
-
-    if( p == NULL ) return 0;
-	if( !len ) return 1;
-
-	/* set up to catch the SIGSEGV signal */
-	mwOldSIGSEGV = signal( SIGSEGV, mwSIGSEGV );
-
-	if( setjmp( mwSIGSEGVjump ) )
-	{
-		signal( SIGSEGV, mwOldSIGSEGV );
-		return 0;
-	}
-
-	/* read all the bytes in the range */
-	ptr = (const char *)p;
-	ptr += len;
-
-	/* the reason for this rather strange construct is that */
-	/* we want to keep the number of used parameters and locals */
-	/* to a minimum. if we use len for a counter gcc will complain */
-	/* it may get clobbered by longjmp() at high warning levels. */
-	/* it's a harmless warning, but this way we don't have to see it. */
-	do
-	{
-		ptr --;
-		if( *ptr == 0x7C ) (void) mwDummy( (char)0 );
-	} while( (const void*) ptr != p );
-
-	/* remove the handler */
-	signal( SIGSEGV, mwOldSIGSEGV );
-
-    return 1;
-}
-int mwIsSafeAddr( void *p, unsigned len )
-{
-	char *ptr;
-
-	if( p == NULL ) return 0;
-	if( !len ) return 1;
-
-	/* set up to catch the SIGSEGV signal */
-	mwOldSIGSEGV = signal( SIGSEGV, mwSIGSEGV );
-
-	if( setjmp( mwSIGSEGVjump ) )
-	{
-		signal( SIGSEGV, mwOldSIGSEGV );
-		return 0;
-	}
-
-	/* read and write-back all the bytes in the range */
-	ptr = (char *)p;
-	ptr += len;
-
-	/* the reason for this rather strange construct is that */
-	/* we want to keep the number of used parameters and locals */
-	/* to a minimum. if we use len for a counter gcc will complain */
-	/* it may get clobbered by longjmp() at high warning levels. */
-	/* it's a harmless warning, but this way we don't have to see it. */
-	do
-	{
-		ptr --;
-		*ptr = mwDummy( *ptr );
-	} while( (void*) ptr != p );
-
-	/* remove the handler */
-	signal( SIGSEGV, mwOldSIGSEGV );
-
-    return 1;
-}
-#endif /* SIGSEGV */
-#endif /* MW_SAFEADDR */
-
-#ifndef MW_SAFEADDR
-int mwIsReadAddr( const void *p, unsigned len )
-{
-    if( p == NULL ) return 0;
-    if( len == 0 ) return 1;
-    return 1;
-}
-int mwIsSafeAddr( void *p, unsigned len )
-{
-    if( p == NULL ) return 0;
-    if( len == 0 ) return 1;
-    return 1;
-}
-#endif
-
-/**********************************************************************
-** Mutex handling
-**********************************************************************/
-
-#if defined(WIN32) || defined(__WIN32__)
-
-static void	mwMutexInit( void )
-{
-	mwGlobalMutex = CreateMutex( NULL, FALSE, NULL);
-	return;
-}
-
-static void	mwMutexTerm( void )
-{
-	CloseHandle( mwGlobalMutex );
-	return;
-}
-
-static void	mwMutexLock( void )
-{
-	if( WaitForSingleObject(mwGlobalMutex, 1000 ) == WAIT_TIMEOUT )
-	{
-		mwWrite( "mwMutexLock: timed out, possible deadlock\n" );
-	}
-	return;
-}
-
-static void	mwMutexUnlock( void )
-{
-	ReleaseMutex( mwGlobalMutex );
-	return;
-}
-
-#endif
-
-#if defined(MW_PTHREADS) || defined(HAVE_PTHREAD_H)
-
-static void	mwMutexInit( void )
-{
-	pthread_mutex_init( &mwGlobalMutex, NULL );
-	return;
-}
-
-static void	mwMutexTerm( void )
-{
-	pthread_mutex_destroy( &mwGlobalMutex );
-	return;
-}
-
-static void	mwMutexLock( void )
-{
-	pthread_mutex_lock(&mwGlobalMutex);
-	return;
-}
-
-static void	mwMutexUnlock( void )
-{
-	pthread_mutex_unlock(&mwGlobalMutex);
-	return;
-}
-
-#endif
-
-/**********************************************************************
-** C++ new & delete
-**********************************************************************/
-
-#if 0 /* 980317: disabled C++ */
-
-#ifdef __cplusplus
-#ifndef MEMWATCH_NOCPP
-
-int mwNCur = 0;
-const char *mwNFile = NULL;
-int mwNLine = 0;
-
-class MemWatch {
-public:
-    MemWatch();
-    ~MemWatch();
-    };
-
-MemWatch::MemWatch() {
-    if( mwInited ) return;
-    mwUseAtexit = 0;
-    mwInit();
-    }
-
-MemWatch::~MemWatch() {
-    if( mwUseAtexit ) return;
-    mwTerm();
-    }
-
-/*
-** This global new will catch all 'new' calls where MEMWATCH is
-** not active.
-*/
-void* operator new( unsigned size ) {
-    mwNCur = 0;
-    return mwMalloc( size, "<unknown>", 0 );
-    }
-
-/*
-** This is the new operator that's called when a module uses mwNew.
-*/
-void* operator new( unsigned size, const char *file, int line ) {
-    mwNCur = 0;
-    return mwMalloc( size, file, line );
-    }
-
-/*
-** This is the new operator that's called when a module uses mwNew[].
-** -- hjc 07/16/02
-*/
-void* operator new[] ( unsigned size, const char *file, int line ) {
-    mwNCur = 0;
-    return mwMalloc( size, file, line );
-    }
-
-/*
-** Since this delete operator will recieve ALL delete's
-** even those from within libraries, we must accept
-** delete's before we've been initialized. Nor can we
-** reliably check for wild free's if the mwNCur variable
-** is not set.
-*/
-void operator delete( void *p ) {
-    if( p == NULL ) return;
-    if( !mwInited ) {
-        free( p );
-        return;
-        }
-    if( mwNCur ) {
-        mwFree( p, mwNFile, mwNLine );
-        mwNCur = 0;
-        return;
-        }
-    mwFree_( p );
-    }
-
-void operator delete[]( void *p ) {
-    if( p == NULL ) return;
-    if( !mwInited ) {
-        free( p );
-        return;
-        }
-    if( mwNCur ) {
-        mwFree( p, mwNFile, mwNLine );
-        mwNCur = 0;
-        return;
-        }
-    mwFree_( p );
-    }
-
-#endif /* MEMWATCH_NOCPP */
-#endif /* __cplusplus */
-
-#endif /* 980317: disabled C++ */
-
-/* MEMWATCH.C */
diff --git a/common/memwatch.h b/common/memwatch.h
deleted file mode 100644
index 4f34901..0000000
--- a/common/memwatch.h
+++ /dev/null
@@ -1,713 +0,0 @@
-/*
-** MEMWATCH.H
-** Nonintrusive ANSI C memory leak / overwrite detection
-** Copyright (C) 1992-2002 Johan Lindh
-** All rights reserved.
-** Version 2.71
-**
-************************************************************************
-**
-** PURPOSE:
-**
-**  MEMWATCH has been written to allow guys and gals that like to
-**  program in C a public-domain memory error control product.
-**  I hope you'll find it's as advanced as most commercial packages.
-**  The idea is that you use it during the development phase and
-**  then remove the MEMWATCH define to produce your final product.
-**  MEMWATCH is distributed in source code form in order to allow
-**  you to compile it for your platform with your own compiler.
-**  It's aim is to be 100% ANSI C, but some compilers are more stingy
-**  than others. If it doesn't compile without warnings, please mail
-**  me the configuration of operating system and compiler you are using
-**  along with a description of how to modify the source, and the version
-**  number of MEMWATCH that you are using.
-**
-************************************************************************
-
-	This file is part of MEMWATCH.
-
-    MEMWATCH is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    MEMWATCH is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with MEMWATCH; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-************************************************************************
-**
-** REVISION HISTORY:
-**
-** 920810 JLI   [1.00]
-** 920830 JLI   [1.10 double-free detection]
-** 920912 JLI   [1.15 mwPuts, mwGrab/Drop, mwLimit]
-** 921022 JLI   [1.20 ASSERT and VERIFY]
-** 921105 JLI   [1.30 C++ support and TRACE]
-** 921116 JLI   [1.40 mwSetOutFunc]
-** 930215 JLI   [1.50 modified ASSERT/VERIFY]
-** 930327 JLI   [1.51 better auto-init & PC-lint support]
-** 930506 JLI   [1.55 MemWatch class, improved C++ support]
-** 930507 JLI   [1.60 mwTest & CHECK()]
-** 930809 JLI   [1.65 Abort/Retry/Ignore]
-** 930820 JLI   [1.70 data dump when unfreed]
-** 931016 JLI   [1.72 modified C++ new/delete handling]
-** 931108 JLI   [1.77 mwSetAssertAction() & some small changes]
-** 940110 JLI   [1.80 no-mans-land alloc/checking]
-** 940328 JLI   [2.00 version 2.0 rewrite]
-**              Improved NML (no-mans-land) support.
-**              Improved performance (especially for free()ing!).
-**              Support for 'read-only' buffers (checksums)
-**              ^^ NOTE: I never did this... maybe I should?
-**              FBI (free'd block info) tagged before freed blocks
-**              Exporting of the mwCounter variable
-**              mwBreakOut() localizes debugger support
-**              Allocation statistics (global, per-module, per-line)
-**              Self-repair ability with relinking
-** 950913 JLI   [2.10 improved garbage handling]
-** 951201 JLI   [2.11 improved auto-free in emergencies]
-** 960125 JLI   [X.01 implemented auto-checking using mwAutoCheck()]
-** 960514 JLI   [2.12 undefining of existing macros]
-** 960515 JLI   [2.13 possibility to use default new() & delete()]
-** 960516 JLI   [2.20 suppression of file flushing on unfreed msgs]
-** 960516 JLI   [2.21 better support for using MEMWATCH with DLL's]
-** 960710 JLI   [X.02 multiple logs and mwFlushNow()]
-** 960801 JLI   [2.22 merged X.01 version with current]
-** 960805 JLI   [2.30 mwIsXXXXAddr() to avoid unneeded GP's]
-** 960805 JLI   [2.31 merged X.02 version with current]
-** 961002 JLI   [2.32 support for realloc() + fixed STDERR bug]
-** 961222 JLI   [2.40 added mwMark() & mwUnmark()]
-** 970101 JLI   [2.41 added over/underflow checking after failed ASSERT/VERIFY]
-** 970113 JLI   [2.42 added support for PC-Lint 7.00g]
-** 970207 JLI   [2.43 added support for strdup()]
-** 970209 JLI   [2.44 changed default filename to lowercase]
-** 970405 JLI   [2.45 fixed bug related with atexit() and some C++ compilers]
-** 970723 JLI   [2.46 added MW_ARI_NULLREAD flag]
-** 970813 JLI   [2.47 stabilized marker handling]
-** 980317 JLI   [2.48 ripped out C++ support; wasn't working good anyway]
-** 980318 JLI   [2.50 improved self-repair facilities & SIGSEGV support]
-** 980417 JLI	[2.51 more checks for invalid addresses]
-** 980512 JLI	[2.52 moved MW_ARI_NULLREAD to occur before aborting]
-** 990112 JLI	[2.53 added check for empty heap to mwIsOwned]
-** 990217 JLI	[2.55 improved the emergency repairs diagnostics and NML]
-** 990224 JLI	[2.56 changed ordering of members in structures]
-** 990303 JLI	[2.57 first maybe-fixit-for-hpux test]
-** 990516 JLI	[2.58 added 'static' to the definition of mwAutoInit]
-** 990517 JLI	[2.59 fixed some high-sensitivity warnings]
-** 990610 JLI	[2.60 fixed some more high-sensitivity warnings]
-** 990715 JLI	[2.61 changed TRACE/ASSERT/VERIFY macro names]
-** 991001 JLI	[2.62 added CHECK_BUFFER() and mwTestBuffer()]
-** 991007 JLI	[2.63 first shot at a 64-bit compatible version]
-** 991009 JLI	[2.64 undef's strdup() if defined, mwStrdup made const]
-** 000704 JLI	[2.65 added some more detection for 64-bits]
-** 010502 JLI   [2.66 incorporated some user fixes]
-**              [mwRelink() could print out garbage pointer (thanks mac at phobos.ca)]
-**				[added array destructor for C++ (thanks rdasilva at connecttel.com)]
-**				[added mutex support (thanks rdasilva at connecttel.com)]
-** 010531 JLI	[2.67 fix: mwMutexXXX() was declared even if MW_HAVE_MUTEX was not defined]
-** 010619 JLI	[2.68 fix: mwRealloc() could leave the mutex locked]
-** 020918 JLI	[2.69 changed to GPL, added C++ array allocation by Howard Cohen]
-** 030212 JLI	[2.70 mwMalloc() bug for very large allocations (4GB on 32bits)]
-** 030520 JLI	[2.71 added ULONG_LONG_MAX as a 64-bit detector (thanks Sami Salonen)]
-**
-** To use, simply include 'MEMWATCH.H' as a header file,
-** and add MEMWATCH.C to your list of files, and define the macro
-** 'MEMWATCH'. If this is not defined, MEMWATCH will disable itself.
-**
-** To call the standard C malloc / realloc / calloc / free; use mwMalloc_(),
-** mwCalloc_() and mwFree_(). Note that mwFree_() will correctly
-** free both malloc()'d memory as well as mwMalloc()'d.
-**
-** 980317: C++ support has been disabled.
-**         The code remains, but is not compiled.
-**
-**         For use with C++, which allows use of inlining in header files
-**         and class specific new/delete, you must also define 'new' as
-**         'mwNew' and 'delete' as 'mwDelete'. Do this *after* you include
-**         C++ header files from libraries, otherwise you can mess up their
-**         class definitions. If you don't define these, the C++ allocations
-**         will not have source file and line number information. Also note,
-**         most C++ class libraries implement their own C++ memory management,
-**         and don't allow anyone to override them. MFC belongs to this crew.
-**         In these cases, the only thing to do is to use MEMWATCH_NOCPP.
-**
-** You can capture output from MEMWATCH using mwSetOutFunc().
-** Just give it the adress of a "void myOutFunc(int c)" function,
-** and all characters to be output will be redirected there.
-**
-** A failing ASSERT() or VERIFY() will normally always abort your
-** program. This can be changed using mwSetAriFunc(). Give it a
-** pointer to a "int myAriFunc(const char *)" function. Your function
-** must ask the user whether to Abort, Retry or Ignore the trap.
-** Return 2 to Abort, 1 to Retry or 0 to Ignore. Beware retry; it
-** causes the expression to be evaluated again! MEMWATCH has a
-** default ARI handler. It's disabled by default, but you can enable
-** it by calling 'mwDefaultAri()'. Note that this will STILL abort
-** your program unless you define MEMWATCH_STDIO to allow MEMWATCH
-** to use the standard C I/O streams. Also, setting the ARI function
-** will cause MEMWATCH *NOT* to write the ARI error to stderr. The
-** error string is passed to the ARI function instead, as the
-** 'const char *' parameter.
-**
-** You can disable MEMWATCH's ASSERT/VERIFY and/or TRACE implementations.
-** This can be useful if you're using a debug terminal or smart debugger.
-** Disable them by defining MW_NOASSERT, MW_NOVERIFY or MW_NOTRACE.
-**
-** MEMWATCH fills all allocated memory with the byte 0xFE, so if
-** you're looking at erroneous data which are all 0xFE:s, the
-** data probably was not initialized by you. The exception is
-** calloc(), which will fill with zero's. All freed buffers are
-** zapped with 0xFD. If this is what you look at, you're using
-** data that has been freed. If this is the case, be aware that
-** MEMWATCH places a 'free'd block info' structure immediately
-** before the freed data. This block contains info about where
-** the block was freed. The information is in readable text,
-** in the format "FBI<counter>filename(line)", for example:
-** "FBI<267>test.c(12)". Using FBI's slows down free(), so it's
-** disabled by default. Use mwFreeBufferInfo(1) to enable it.
-**
-** To aid in tracking down wild pointer writes, MEMWATCH can perform
-** no-mans-land allocations. No-mans-land will contain the byte 0xFC.
-** MEMWATCH will, when this is enabled, convert recently free'd memory
-** into NML allocations.
-**
-** MEMWATCH protects it's own data buffers with checksums. If you
-** get an internal error, it means you're overwriting wildly,
-** or using an uninitialized pointer.
-**
-************************************************************************
-**
-** Note when compiling with Microsoft C:
-**  -   MSC ignores fflush() by default. This is overridden, so that
-**      the disk log will always be current.
-**
-** This utility has been tested with:
-**  PC-lint 7.0k, passed as 100% ANSI C compatible
-**  Microsoft Visual C++ on Win16 and Win32
-**  Microsoft C on DOS
-**  SAS C on an Amiga 500
-**  Gnu C on a PC running Red Hat Linux
-**  ...and using an (to me) unknown compiler on an Atari machine.
-**
-************************************************************************
-**
-** Format of error messages in MEMWATCH.LOG:
-**  message: <sequence-number> filename(linenumber), information
-**
-** Errors caught by MemWatch, when they are detected, and any
-** actions taken besides writing to the log file MEMWATCH.LOG:
-**
-**  Double-freeing:
-**      A pointer that was recently freed and has not since been
-**      reused was freed again. The place where the previous free()
-**      was executed is displayed.
-**      Detect: delete or free() using the offending pointer.
-**      Action: The delete or free() is cancelled, execution continues.
-**  Underflow:
-**      You have written just ahead of the allocated memory.
-**      The size and place of the allocation is displayed.
-**      Detect: delete or free() of the damaged buffer.
-**      Action: The buffer is freed, but there may be secondary damage.
-**  Overflow:
-**      Like underflow, but you've written after the end of the buffer.
-**      Detect: see Underflow.
-**      Action: see Underflow.
-**  WILD free:
-**      An unrecognized pointer was passed to delete or free().
-**      The pointer may have been returned from a library function;
-**      in that case, use mwFree_() to force free() of it.
-**      Also, this may be a double-free, but the previous free was
-**      too long ago, causing MEMWATCH to 'forget' it.
-**      Detect: delete or free() of the offending pointer.
-**      Action: The delete or free() is cancelled, execution continues.
-**  NULL free:
-**      It's unclear to me whether or not freeing of NULL pointers
-**      is legal in ANSI C, therefore a warning is written to the log file,
-**      but the error counter remains the same. This is legal using C++,
-**      so the warning does not appear with delete.
-**      Detect: When you free(NULL).
-**      Action: The free() is cancelled.
-**  Failed:
-**      A request to allocate memory failed. If the allocation is
-**      small, this may be due to memory depletion, but is more likely
-**      to be memory fragmentation problems. The amount of memory
-**      allocated so far is displayed also.
-**      Detect: When you new, malloc(), realloc() or calloc() memory.
-**      Action: NULL is returned.
-**  Realloc:
-**      A request to re-allocate a memory buffer failed for reasons
-**      other than out-of-memory. The specific reason is shown.
-**      Detect: When you realloc()
-**      Action: realloc() is cancelled, NULL is returned
-**  Limit fail:
-**      A request to allocate memory failed since it would violate
-**      the limit set using mwLimit(). mwLimit() is used to stress-test
-**      your code under simulated low memory conditions.
-**      Detect: At new, malloc(), realloc() or calloc().
-**      Action: NULL is returned.
-**  Assert trap:
-**      An ASSERT() failed. The ASSERT() macro works like C's assert()
-**      macro/function, except that it's interactive. See your C manual.
-**      Detect: On the ASSERT().
-**      Action: Program ends with an advisory message to stderr, OR
-**              Program writes the ASSERT to the log and continues, OR
-**              Program asks Abort/Retry/Ignore? and takes that action.
-**  Verify trap:
-**      A VERIFY() failed. The VERIFY() macro works like ASSERT(),
-**      but if MEMWATCH is not defined, it still evaluates the
-**      expression, but it does not act upon the result.
-**      Detect: On the VERIFY().
-**      Action: Program ends with an advisory message to stderr, OR
-**              Program writes the VERIFY to the log and continues, OR
-**              Program asks Abort/Retry/Ignore? and takes that action.
-**  Wild pointer:
-**      A no-mans-land buffer has been written into. MEMWATCH can
-**      allocate and distribute chunks of memory solely for the
-**      purpose of trying to catch random writes into memory.
-**      Detect: Always on CHECK(), but can be detected in several places.
-**      Action: The error is logged, and if an ARI handler is installed,
-**              it is executed, otherwise, execution continues.
-**  Unfreed:
-**      A memory buffer you allocated has not been freed.
-**      You are informed where it was allocated, and whether any
-**      over or underflow has occured. MemWatch also displays up to
-**      16 bytes of the data, as much as it can, in hex and text.
-**      Detect: When MemWatch terminates.
-**      Action: The buffer is freed.
-**  Check:
-**      An error was detected during a CHECK() operation.
-**      The associated pointer is displayed along with
-**      the file and line where the CHECK() was executed.
-**      Followed immediately by a normal error message.
-**      Detect: When you CHECK()
-**      Action: Depends on the error
-**  Relink:
-**      After a MEMWATCH internal control block has been trashed,
-**      MEMWATCH tries to repair the damage. If successful, program
-**      execution will continue instead of aborting. Some information
-**      about the block may be gone permanently, though.
-**      Detect: N/A
-**      Action: Relink successful: program continues.
-**              Relink fails: program aborts.
-**  Internal:
-**      An internal error is flagged by MEMWATCH when it's control
-**      structures have been damaged. You are likely using an uninitialized
-**      pointer somewhere in your program, or are zapping memory all over.
-**      The message may give you additional diagnostic information.
-**      If possible, MEMWATCH will recover and continue execution.
-**      Detect: Various actions.
-**      Action: Whatever is needed
-**  Mark:
-**      The program terminated without umarking all marked pointers. Marking
-**      can be used to track resources other than memory. mwMark(pointer,text,...)
-**      when the resource is allocated, and mwUnmark(pointer) when it's freed.
-**      The 'text' is displayed for still marked pointers when the program
-**      ends.
-**      Detect: When MemWatch terminates.
-**      Action: The error is logged.
-**
-**
-************************************************************************
-**
-**  The author may be reached by e-mail at the address below. If you
-**  mail me about source code changes in MEMWATCH, remember to include
-**  MW's version number.
-**
-**      Johan Lindh
-**      johan at linkdata.se
-**
-** The latest version of MEMWATCH may be downloaded from
-** http://www.linkdata.se/
-*/
-
-#ifndef __MEMWATCH_H
-#define __MEMWATCH_H
-
-/* Make sure that malloc(), realloc(), calloc() and free() are declared. */
-/*lint -save -e537 */
-#include <stdlib.h>
-/*lint -restore */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*
-** Constants used
-**  All MEMWATCH constants start with the prefix MW_, followed by
-**  a short mnemonic which indicates where the constant is used,
-**  followed by a descriptive text about it.
-*/
-
-#define MW_ARI_NULLREAD 0x10    /* Null read (to start debugger) */
-#define MW_ARI_ABORT    0x04    /* ARI handler says: abort program! */
-#define MW_ARI_RETRY    0x02    /* ARI handler says: retry action! */
-#define MW_ARI_IGNORE   0x01    /* ARI handler says: ignore error! */
-
-#define MW_VAL_NEW      0xFE    /* value in newly allocated memory */
-#define MW_VAL_DEL      0xFD    /* value in newly deleted memory */
-#define MW_VAL_NML      0xFC    /* value in no-mans-land */
-#define MW_VAL_GRB      0xFB    /* value in grabbed memory */
-
-#define MW_TEST_ALL     0xFFFF  /* perform all tests */
-#define MW_TEST_CHAIN   0x0001  /* walk the heap chain */
-#define MW_TEST_ALLOC   0x0002  /* test allocations & NML guards */
-#define MW_TEST_NML     0x0004  /* test all-NML areas for modifications */
-
-#define MW_NML_NONE     0       /* no NML */
-#define MW_NML_FREE     1       /* turn FREE'd memory into NML */
-#define MW_NML_ALL      2       /* all unused memory is NML */
-#define MW_NML_DEFAULT  0       /* the default NML setting */
-
-#define MW_STAT_GLOBAL  0       /* only global statistics collected */
-#define MW_STAT_MODULE  1       /* collect statistics on a module basis */
-#define MW_STAT_LINE    2       /* collect statistics on a line basis */
-#define MW_STAT_DEFAULT 0       /* the default statistics setting */
-
-/*
-** MemWatch internal constants
-**  You may change these and recompile MemWatch to change the limits
-**  of some parameters. Respect the recommended minimums!
-*/
-#define MW_TRACE_BUFFER 2048    /* (min 160) size of TRACE()'s output buffer */
-#define MW_FREE_LIST    64      /* (min 4) number of free()'s to track */
-
-/*
-** Exported variables
-**  In case you have to remove the 'const' keyword because your compiler
-**  doesn't support it, be aware that changing the values may cause
-**  unpredictable behaviour.
-**  - mwCounter contains the current action count. You can use this to
-**      place breakpoints using a debugger, if you want.
-*/
-#ifndef __MEMWATCH_C
-extern const unsigned long mwCounter;
-#endif
-
-/*
-** System functions
-**  Normally, it is not nessecary to call any of these. MEMWATCH will
-**  automatically initialize itself on the first MEMWATCH function call,
-**  and set up a call to mwAbort() using atexit(). Some C++ implementations
-**  run the atexit() chain before the program has terminated, so you
-**  may have to use mwInit() or the MemWatch C++ class to get good
-**  behaviour.
-**  - mwInit() can be called to disable the atexit() usage. If mwInit()
-**      is called directly, you must call mwTerm() to end MemWatch, or
-**      mwAbort().
-**  - mwTerm() is usually not nessecary to call; but if called, it will
-**      call mwAbort() if it finds that it is cancelling the 'topmost'
-**      mwInit() call.
-**  - mwAbort() cleans up after MEMWATCH, reports unfreed buffers, etc.
-*/
-void  mwInit( void );
-void  mwTerm( void );
-void  mwAbort( void );
-
-/*
-** Setup functions
-**  These functions control the operation of MEMWATCH's protective features.
-**  - mwFlushNow() causes MEMWATCH to flush it's buffers.
-**  - mwDoFlush() controls whether MEMWATCH flushes the disk buffers after
-**      writes. The default is smart flushing: MEMWATCH will not flush buffers
-**      explicitly until memory errors are detected. Then, all writes are
-**      flushed until program end or mwDoFlush(0) is called.
-**  - mwLimit() sets the allocation limit, an arbitrary limit on how much
-**      memory your program may allocate in bytes. Used to stress-test app.
-**      Also, in virtual-memory or multitasking environs, puts a limit on
-**      how much MW_NML_ALL can eat up.
-**  - mwGrab() grabs up X kilobytes of memory. Allocates actual memory,
-**      can be used to stress test app & OS both.
-**  - mwDrop() drops X kilobytes of grabbed memory.
-**  - mwNoMansLand() sets the behaviour of the NML logic. See the
-**      MW_NML_xxx for more information. The default is MW_NML_DEFAULT.
-**  - mwStatistics() sets the behaviour of the statistics collector. See
-**      the MW_STAT_xxx defines for more information. Default MW_STAT_DEFAULT.
-**  - mwFreeBufferInfo() enables or disables the tagging of free'd buffers
-**      with freeing information. This information is written in text form,
-**      using sprintf(), so it's pretty slow. Disabled by default.
-**  - mwAutoCheck() performs a CHECK() operation whenever a MemWatch function
-**      is used. Slows down performance, of course.
-**  - mwCalcCheck() calculates checksums for all data buffers. Slow!
-**  - mwDumpCheck() logs buffers where stored & calc'd checksums differ. Slow!!
-**  - mwMark() sets a generic marker. Returns the pointer given.
-**  - mwUnmark() removes a generic marker. If, at the end of execution, some
-**      markers are still in existence, these will be reported as leakage.
-**      returns the pointer given.
-*/
-void        mwFlushNow( void );
-void        mwDoFlush( int onoff );
-void        mwLimit( long bytes );
-unsigned    mwGrab( unsigned kilobytes );
-unsigned    mwDrop( unsigned kilobytes );
-void        mwNoMansLand( int mw_nml_level );
-void        mwStatistics( int level );
-void        mwFreeBufferInfo( int onoff );
-void        mwAutoCheck( int onoff );
-void        mwCalcCheck( void );
-void        mwDumpCheck( void );
-void *      mwMark( void *p, const char *description, const char *file, unsigned line );
-void *      mwUnmark( void *p, const char *file, unsigned line );
-
-/*
-** Testing/verification/tracing
-**  All of these macros except VERIFY() evaluates to a null statement
-**  if MEMWATCH is not defined during compilation.
-**  - mwIsReadAddr() checks a memory area for read privilige.
-**  - mwIsSafeAddr() checks a memory area for both read & write privilige.
-**      This function and mwIsReadAddr() is highly system-specific and
-**      may not be implemented. If this is the case, they will default
-**      to returning nonzero for any non-NULL pointer.
-**  - CHECK() does a complete memory integrity test. Slow!
-**  - CHECK_THIS() checks only selected components.
-**  - CHECK_BUFFER() checks the indicated buffer for errors.
-**  - mwASSERT() or ASSERT() If the expression evaluates to nonzero, execution continues.
-**      Otherwise, the ARI handler is called, if present. If not present,
-**      the default ARI action is taken (set with mwSetAriAction()).
-**      ASSERT() can be disabled by defining MW_NOASSERT.
-**  - mwVERIFY() or VERIFY() works just like ASSERT(), but when compiling without
-**      MEMWATCH the macro evaluates to the expression.
-**      VERIFY() can be disabled by defining MW_NOVERIFY.
-**  - mwTRACE() or TRACE() writes some text and data to the log. Use like printf().
-**      TRACE() can be disabled by defining MW_NOTRACE.
-*/
-int   mwIsReadAddr( const void *p, unsigned len );
-int   mwIsSafeAddr( void *p, unsigned len );
-int   mwTest( const char *file, int line, int mw_test_flags );
-int   mwTestBuffer( const char *file, int line, void *p );
-int   mwAssert( int, const char*, const char*, int );
-int   mwVerify( int, const char*, const char*, int );
-
-/*
-** User I/O functions
-**  - mwTrace() works like printf(), but dumps output either to the
-**      function specified with mwSetOutFunc(), or the log file.
-**  - mwPuts() works like puts(), dumps output like mwTrace().
-**  - mwSetOutFunc() allows you to give the adress of a function
-**      where all user output will go. (exeption: see mwSetAriFunc)
-**      Specifying NULL will direct output to the log file.
-**  - mwSetAriFunc() gives MEMWATCH the adress of a function to call
-**      when an 'Abort, Retry, Ignore' question is called for. The
-**      actual error message is NOT printed when you've set this adress,
-**      but instead it is passed as an argument. If you call with NULL
-**      for an argument, the ARI handler is disabled again. When the
-**      handler is disabled, MEMWATCH will automatically take the
-**      action specified by mwSetAriAction().
-**  - mwSetAriAction() sets the default ARI return value MEMWATCH should
-**      use if no ARI handler is specified. Defaults to MW_ARI_ABORT.
-**  - mwAriHandler() is an ANSI ARI handler you can use if you like. It
-**      dumps output to stderr, and expects input from stdin.
-**  - mwBreakOut() is called in certain cases when MEMWATCH feels it would
-**      be nice to break into a debugger. If you feel like MEMWATCH, place
-**      an execution breakpoint on this function.
-*/
-void  mwTrace( const char* format_string, ... );
-void  mwPuts( const char* text );
-void  mwSetOutFunc( void (*func)(int) );
-void  mwSetAriFunc( int (*func)(const char*) );
-void  mwSetAriAction( int mw_ari_value );
-int   mwAriHandler( const char* cause );
-void  mwBreakOut( const char* cause );
-
-/*
-** Allocation/deallocation functions
-**  These functions are the ones actually to perform allocations
-**  when running MEMWATCH, for both C and C++ calls.
-**  - mwMalloc() debugging allocator
-**  - mwMalloc_() always resolves to a clean call of malloc()
-**  - mwRealloc() debugging re-allocator
-**  - mwRealloc_() always resolves to a clean call of realloc()
-**  - mwCalloc() debugging allocator, fills with zeros
-**  - mwCalloc_() always resolves to a clean call of calloc()
-**  - mwFree() debugging free. Can only free memory which has
-**      been allocated by MEMWATCH.
-**  - mwFree_() resolves to a) normal free() or b) debugging free.
-**      Can free memory allocated by MEMWATCH and malloc() both.
-**      Does not generate any runtime errors.
-*/
-void* mwMalloc( size_t, const char*, int );
-void* mwMalloc_( size_t );
-void* mwRealloc( void *, size_t, const char*, int );
-void* mwRealloc_( void *, size_t );
-void* mwCalloc( size_t, size_t, const char*, int );
-void* mwCalloc_( size_t, size_t );
-void  mwFree( void*, const char*, int );
-void  mwFree_( void* );
-#ifdef MWSTRDUP
-char* mwStrdup( const char *, const char*, int );
-#endif
-
-/*
-** Enable/disable precompiler block
-**  This block of defines and if(n)defs make sure that references
-**  to MEMWATCH is completely removed from the code if the MEMWATCH
-**  manifest constant is not defined.
-*/
-#ifndef __MEMWATCH_C
-#ifdef MEMWATCH
-
-#define mwASSERT(exp)   while(mwAssert((int)(exp),#exp,__FILE__,__LINE__))
-#ifndef MW_NOASSERT
-#ifndef ASSERT
-#define ASSERT          mwASSERT
-#endif /* !ASSERT */
-#endif /* !MW_NOASSERT */
-#define mwVERIFY(exp)   while(mwVerify((int)(exp),#exp,__FILE__,__LINE__))
-#ifndef MW_NOVERIFY
-#ifndef VERIFY
-#define VERIFY          mwVERIFY
-#endif /* !VERIFY */
-#endif /* !MW_NOVERIFY */
-#define mwTRACE         mwTrace
-#ifndef MW_NOTRACE
-#ifndef TRACE
-#define TRACE           mwTRACE
-#endif /* !TRACE */
-#endif /* !MW_NOTRACE */
-
-/* some compilers use a define and not a function */
-/* for strdup(). */
-#ifdef strdup
-#undef strdup
-#endif
-
-#define malloc(n)       mwMalloc(n,__FILE__,__LINE__)
-#ifdef MWSTRDUP
-#define strdup(p)       mwStrdup(p,__FILE__,__LINE__)
-#endif
-#define realloc(p,n)    mwRealloc(p,n,__FILE__,__LINE__)
-#define calloc(n,m)     mwCalloc(n,m,__FILE__,__LINE__)
-#define free(p)         mwFree(p,__FILE__,__LINE__)
-#define CHECK()         mwTest(__FILE__,__LINE__,MW_TEST_ALL)
-#define CHECK_THIS(n)   mwTest(__FILE__,__LINE__,n)
-#define CHECK_BUFFER(b) mwTestBuffer(__FILE__,__LINE__,b)
-#define MARK(p)         mwMark(p,#p,__FILE__,__LINE__)
-#define UNMARK(p)       mwUnmark(p,__FILE__,__LINE__)
-
-#else /* MEMWATCH */
-
-#define mwASSERT(exp)
-#ifndef MW_NOASSERT
-#ifndef ASSERT
-#define ASSERT          mwASSERT
-#endif /* !ASSERT */
-#endif /* !MW_NOASSERT */
-
-#define mwVERIFY(exp)    exp
-#ifndef MW_NOVERIFY
-#ifndef VERIFY
-#define VERIFY          mwVERIFY
-#endif /* !VERIFY */
-#endif /* !MW_NOVERIFY */
-
-/*lint -esym(773,mwTRACE) */
-#define mwTRACE         /*lint -save -e506 */ 1?(void)0:mwDummyTraceFunction /*lint -restore */
-#ifndef MW_NOTRACE
-#ifndef TRACE
-/*lint -esym(773,TRACE) */
-#define TRACE           mwTRACE
-#endif /* !TRACE */
-#endif /* !MW_NOTRACE */
-
-extern void mwDummyTraceFunction(const char *,...);
-/*lint -save -e652 */
-#define mwDoFlush(n)
-#define mwPuts(s)
-#define mwInit()
-#define mwGrab(n)
-#define mwDrop(n)
-#define mwLimit(n)
-#define mwTest(f,l)
-#define mwSetOutFunc(f)
-#define mwSetAriFunc(f)
-#define mwDefaultAri()
-#define mwNomansland()
-#define mwStatistics(f)
-#define mwMark(p,t,f,n)     (p)
-#define mwUnmark(p,f,n)     (p)
-#define mwMalloc(n,f,l)     malloc(n)
-#ifdef MWSTRDUP
-#define mwStrdup(p,f,l)     strdup(p)
-#endif
-#define mwRealloc(p,n,f,l)  realloc(p,n)
-#define mwCalloc(n,m,f,l)   calloc(n,m)
-#define mwFree(p)           free(p)
-#define mwMalloc_(n)        malloc(n)
-#define mwRealloc_(p,n)     realloc(p,n)
-#define mwCalloc_(n,m)      calloc(n,m)
-#define mwFree_(p)          free(p)
-#define mwAssert(e,es,f,l)
-#define mwVerify(e,es,f,l)  (e)
-#define mwTrace             mwDummyTrace
-#define mwTestBuffer(f,l,b) (0)
-#define CHECK()
-#define CHECK_THIS(n)
-#define CHECK_BUFFER(b)
-#define MARK(p)             (p)
-#define UNMARK(p)           (p)
-/*lint -restore */
-
-#endif /* MEMWATCH */
-#endif /* !__MEMWATCH_C */
-
-#ifdef __cplusplus
-    }
-#endif
-
-#if 0 /* 980317: disabled C++ */
-
-/*
-** C++ support section
-**  Implements the C++ support. Please note that in order to avoid
-**  messing up library classes, C++ support is disabled by default.
-**  You must NOT enable it until AFTER the inclusion of all header
-**  files belonging to code that are not compiled with MEMWATCH, and
-**  possibly for some that are! The reason for this is that a C++
-**  class may implement it's own new() function, and the preprocessor
-**  would substitute this crucial declaration for MEMWATCH new().
-**  You can forcibly deny C++ support by defining MEMWATCH_NOCPP.
-**  To enble C++ support, you must be compiling C++, MEMWATCH must
-**  be defined, MEMWATCH_NOCPP must not be defined, and finally,
-**  you must define 'new' to be 'mwNew', and 'delete' to be 'mwDelete'.
-**  Unlike C, C++ code can begin executing *way* before main(), for
-**  example if a global variable is created. For this reason, you can
-**  declare a global variable of the class 'MemWatch'. If this is
-**  is the first variable created, it will then check ALL C++ allocations
-**  and deallocations. Unfortunately, this evaluation order is not
-**  guaranteed by C++, though the compilers I've tried evaluates them
-**  in the order encountered.
-*/
-#ifdef __cplusplus
-#ifndef __MEMWATCH_C
-#ifdef MEMWATCH
-#ifndef MEMWATCH_NOCPP
-extern int mwNCur;
-extern const char *mwNFile;
-extern int mwNLine;
-class MemWatch {
-public:
-    MemWatch();
-    ~MemWatch();
-    };
-void * operator new(size_t);
-void * operator new(size_t,const char *,int);
-void * operator new[] (size_t,const char *,int);	// hjc 07/16/02
-void operator delete(void *);
-#define mwNew new(__FILE__,__LINE__)
-#define mwDelete (mwNCur=1,mwNFile=__FILE__,mwNLine=__LINE__),delete
-#endif /* MEMWATCH_NOCPP */
-#endif /* MEMWATCH */
-#endif /* !__MEMWATCH_C */
-#endif /* __cplusplus */
-
-#endif /* 980317: disabled C++ */
-
-#endif /* __MEMWATCH_H */
-
-/* EOF MEMWATCH.H */
diff --git a/common/narrow_string.h b/common/narrow_string.h
index d4bcb01..b008bee 100644
--- a/common/narrow_string.h
+++ b/common/narrow_string.h
@@ -2,7 +2,7 @@
  * Narrow character string functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/common/types.h b/common/types.h
index 72bfa07..8117878 100644
--- a/common/types.h
+++ b/common/types.h
@@ -2,7 +2,7 @@
  * Type and type-support defintions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/common/types.h.in b/common/types.h.in
index 0a6d0c7..2d9e5fb 100644
--- a/common/types.h.in
+++ b/common/types.h.in
@@ -2,7 +2,7 @@
  * Type and type-support defintions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/common/wide_string.h b/common/wide_string.h
index 7028e7e..d0fcc07 100644
--- a/common/wide_string.h
+++ b/common/wide_string.h
@@ -2,7 +2,7 @@
  * Wide character string functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/configure b/configure
index 1539985..9b1247b 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for libewf 20091003.
+# Generated by GNU Autoconf 2.63 for libewf 20091114.
 #
 # Report bugs to <forensics at hoffmannbv.nl>.
 #
@@ -745,8 +745,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='libewf'
 PACKAGE_TARNAME='libewf'
-PACKAGE_VERSION='20091003'
-PACKAGE_STRING='libewf 20091003'
+PACKAGE_VERSION='20091114'
+PACKAGE_STRING='libewf 20091114'
 PACKAGE_BUGREPORT='forensics at hoffmannbv.nl'
 
 ac_unique_file="include/libewf.h.in"
@@ -968,7 +968,6 @@ enable_low_memory_usage
 enable_verbose_output
 enable_debug_output
 enable_python
-enable_v1_api
 enable_v2_api
 enable_shared
 enable_static
@@ -1538,7 +1537,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures libewf 20091003 to adapt to many kinds of systems.
+\`configure' configures libewf 20091114 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1608,7 +1607,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libewf 20091003:";;
+     short | recursive ) echo "Configuration of libewf 20091114:";;
    esac
   cat <<\_ACEOF
 
@@ -1632,7 +1631,6 @@ Optional Features:
   --enable-verbose-output enable verbose output (default is no)
   --enable-debug-output   enable debug output (default is no)
   --enable-python         build python bindings (pyewf) (default is no)
-  --enable-v1-api         enable version 1 API (default is yes)
   --enable-v2-api         enable experimental version 2 API (default is no)
   --enable-shared[=PKGS]  build shared libraries [default=yes]
   --enable-static[=PKGS]  build static libraries [default=yes]
@@ -1723,7 +1721,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-libewf configure 20091003
+libewf configure 20091114
 generated by GNU Autoconf 2.63
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1737,7 +1735,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by libewf $as_me 20091003, which was
+It was created by libewf $as_me 20091114, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   $ $0 $@
@@ -2589,7 +2587,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE=libewf
- VERSION=20091003
+ VERSION=20091114
 
 
 cat >>confdefs.h <<_ACEOF
@@ -4301,21 +4299,6 @@ else
 fi
 { $as_echo "$as_me:$LINENO: result: $ac_cv_libewf_enable_python" >&5
 $as_echo "$ac_cv_libewf_enable_python" >&6; }
-# Check whether --enable-v1-api was given.
-if test "${enable_v1_api+set}" = set; then
-  enableval=$enable_v1_api; ac_cv_libewf_enable_v1_api=$enableval
-else
-  ac_cv_libewf_enable_v1_api=yes
-fi
-	 { $as_echo "$as_me:$LINENO: checking whether to enable enable version 1 API" >&5
-$as_echo_n "checking whether to enable enable version 1 API... " >&6; }
-if test "${ac_cv_libewf_enable_v1_api+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_libewf_enable_v1_api=yes
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_libewf_enable_v1_api" >&5
-$as_echo "$ac_cv_libewf_enable_v1_api" >&6; }
 # Check whether --enable-v2-api was given.
 if test "${enable_v2_api+set}" = set; then
   enableval=$enable_v2_api; ac_cv_libewf_enable_v2_api=$enableval
@@ -6476,13 +6459,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:6479: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:6462: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:6482: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:6465: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:6485: output\"" >&5)
+  (eval echo "\"\$as_me:6468: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -7684,7 +7667,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 7687 "configure"' > conftest.$ac_ext
+  echo '#line 7670 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -9302,11 +9285,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:9305: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:9288: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:9309: \$? = $ac_status" >&5
+   echo "$as_me:9292: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -9641,11 +9624,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:9644: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:9627: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:9648: \$? = $ac_status" >&5
+   echo "$as_me:9631: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -9746,11 +9729,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:9749: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:9732: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:9753: \$? = $ac_status" >&5
+   echo "$as_me:9736: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -9801,11 +9784,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:9804: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:9787: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:9808: \$? = $ac_status" >&5
+   echo "$as_me:9791: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -12604,7 +12587,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12607 "configure"
+#line 12590 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12700,7 +12683,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12703 "configure"
+#line 12686 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -22134,218 +22117,6 @@ done
 
 
 
-for ac_func in strncasecmp
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-else
-
-for ac_func in strcasecmp
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-else
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: Missing functions: strncasecmp and strcasecmp
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: Missing functions: strncasecmp and strcasecmp
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
-fi
-done
-
-fi
-done
-
-
-
 for ac_func in strncmp
 do
 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -26405,6 +26176,107 @@ done
 
 
 
+for ac_func in posix_fadvise
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then
+  eval "$as_ac_var=yes"
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+		 $as_echo "$as_val"'`
+	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+		 $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
 for ac_func in uname
 do
 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -36101,218 +35973,6 @@ done
 
 
 
-for ac_func in wcsncasecmp
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-else
-
-for ac_func in wcscasecmp
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-else
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: Missing functions: wcsncasecmp and wcscasecmp
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: Missing functions: wcsncasecmp and wcscasecmp
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
-fi
-done
-
-fi
-done
-
-
-
 for ac_func in wcsncmp
 do
 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -37812,20 +37472,14 @@ else
 fi
 
 
-if test "x$ac_cv_libewf_enable_v1_api" != xno; then
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_V1_API 1
 _ACEOF
 
-	HAVE_V1_API=1
-
-	ac_cv_libewf_enable_v1_api=yes
-else
-  HAVE_V1_API=0
-
-fi
+HAVE_V1_API=1
 
+ac_cv_libewf_enable_v1_api=yes
 
  if test "x$ac_cv_libewf_enable_v1_api" != xno; then
   HAVE_V1_API_TRUE=
@@ -37961,10 +37615,6 @@ ac_config_files="$ac_config_files libewf/libewf_definitions.h"
 
 ac_config_files="$ac_config_files common/types.h"
 
-ac_config_files="$ac_config_files dpkg/changelog"
-
-ac_config_files="$ac_config_files dpkg/shlibs.local.ex"
-
 ac_config_files="$ac_config_files macosx/Introduction.rtf"
 
 ac_config_files="$ac_config_files libewf.pc"
@@ -38464,7 +38114,7 @@ exec 6>&1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by libewf $as_me 20091003, which was
+This file was extended by libewf $as_me 20091114, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -38527,7 +38177,7 @@ Report bugs to <bug-autoconf at gnu.org>."
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_version="\\
-libewf config.status 20091003
+libewf config.status 20091114
 configured by $0, generated by GNU Autoconf 2.63,
   with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
@@ -38930,8 +38580,6 @@ do
     "include/libewf/types.h") CONFIG_FILES="$CONFIG_FILES include/libewf/types.h" ;;
     "libewf/libewf_definitions.h") CONFIG_FILES="$CONFIG_FILES libewf/libewf_definitions.h" ;;
     "common/types.h") CONFIG_FILES="$CONFIG_FILES common/types.h" ;;
-    "dpkg/changelog") CONFIG_FILES="$CONFIG_FILES dpkg/changelog" ;;
-    "dpkg/shlibs.local.ex") CONFIG_FILES="$CONFIG_FILES dpkg/shlibs.local.ex" ;;
     "macosx/Introduction.rtf") CONFIG_FILES="$CONFIG_FILES macosx/Introduction.rtf" ;;
     "libewf.pc") CONFIG_FILES="$CONFIG_FILES libewf.pc" ;;
     "libewf.spec") CONFIG_FILES="$CONFIG_FILES libewf.spec" ;;
@@ -40424,7 +40072,6 @@ Features:
    Python (pyewf) support:                          $ac_cv_libewf_enable_python
    Verbose output:                                  $ac_cv_libewf_enable_verbose_output
    Debug output:                                    $ac_cv_libewf_enable_debug_output
-   Version 1 API:                                   $ac_cv_libewf_enable_v1_api
    Experimental version 2 API:                      $ac_cv_libewf_enable_v2_api
 " >&5
 $as_echo "$as_me:
@@ -40443,7 +40090,6 @@ Features:
    Python (pyewf) support:                          $ac_cv_libewf_enable_python
    Verbose output:                                  $ac_cv_libewf_enable_verbose_output
    Debug output:                                    $ac_cv_libewf_enable_debug_output
-   Version 1 API:                                   $ac_cv_libewf_enable_v1_api
    Experimental version 2 API:                      $ac_cv_libewf_enable_v2_api
 " >&6;};
 
diff --git a/configure.ac b/configure.ac
index a038eca..555e9ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@ AC_PREREQ( 2.59 )
 
 AC_INIT(
  [libewf],
- [20091003],
+ [20091114],
  [forensics at hoffmannbv.nl])
 
 AC_CONFIG_SRCDIR(
@@ -10,7 +10,7 @@ AC_CONFIG_SRCDIR(
 
 AM_INIT_AUTOMAKE(
  [libewf],
- [20091003])
+ [20091114])
 
 AC_CONFIG_MACRO_DIR([m4])
 
@@ -57,11 +57,6 @@ LIBEWF_TEST_ENABLE(
  [build python bindings (pyewf)],
  [no])
 LIBEWF_TEST_ENABLE(
- [v1-api],
- [v1_api],
- [enable version 1 API],
- [yes])
-LIBEWF_TEST_ENABLE(
  [v2-api],
  [v2_api],
  [enable experimental version 2 API],
@@ -381,16 +376,6 @@ AC_CHECK_FUNCS(
    [1]) ]) ])
 
 AC_CHECK_FUNCS(
- [strncasecmp],
- [],
- [AC_CHECK_FUNCS(
-  [strcasecmp],
-  [],
-  [AC_MSG_FAILURE(
-   [Missing functions: strncasecmp and strcasecmp],
-   [1]) ]) ])
-
-AC_CHECK_FUNCS(
  [strncmp],
  [],
  [AC_CHECK_FUNCS(
@@ -579,6 +564,7 @@ AC_CHECK_FUNCS(
   [Missing function: fstat],
   [1]) ])
 
+AC_CHECK_FUNCS([posix_fadvise])
 AC_CHECK_FUNCS([uname])
 
 dnl Check for printf conversion specifier support
@@ -1429,16 +1415,6 @@ AS_IF(
 	   [1]) ]) ])
 
 	AC_CHECK_FUNCS(
-	 [wcsncasecmp],
-	 [],
-	 [AC_CHECK_FUNCS(
-	  [wcscasecmp],
-	  [],
-	  [AC_MSG_FAILURE(
-	   [Missing functions: wcsncasecmp and wcscasecmp],
-	   [1]) ]) ])
-
-	AC_CHECK_FUNCS(
 	 [wcsncmp],
 	 [],
 	 [AC_CHECK_FUNCS(
@@ -1562,20 +1538,15 @@ AM_CONDITIONAL(
  HAVE_PYTHON,
  [test "x$ac_cv_libewf_enable_python" != xno])
 
-dnl Check if libewf should be build with version 1 API
-AS_IF(
-	[test "x$ac_cv_libewf_enable_v1_api" != xno],
-	[AC_DEFINE(
-	 [HAVE_V1_API],
-	 [1],
-	 [Define to 1 if experimental version 1 API should be used.])
-	AC_SUBST(
-	 [HAVE_V1_API],
-	 [1])
-	ac_cv_libewf_enable_v1_api=yes],
-	[AC_SUBST(
-	 [HAVE_V1_API],
-	 [0]) ])
+dnl Build libewf with version 1 API
+AC_DEFINE(
+ [HAVE_V1_API],
+ [1],
+ [Define to 1 if experimental version 1 API should be used.])
+AC_SUBST(
+ [HAVE_V1_API],
+ [1])
+ac_cv_libewf_enable_v1_api=yes
 
 AM_CONDITIONAL(
  HAVE_V1_API,
@@ -1659,8 +1630,6 @@ AC_CONFIG_FILES([include/libewf/types.h])
 AC_CONFIG_FILES([libewf/libewf_definitions.h])
 dnl Have configure make distribution specific files
 AC_CONFIG_FILES([common/types.h])
-AC_CONFIG_FILES([dpkg/changelog])
-AC_CONFIG_FILES([dpkg/shlibs.local.ex])
 AC_CONFIG_FILES([macosx/Introduction.rtf])
 AC_CONFIG_FILES([libewf.pc])
 AC_CONFIG_FILES([libewf.spec])
@@ -1686,7 +1655,6 @@ Features:
    Python (pyewf) support:                          $ac_cv_libewf_enable_python
    Verbose output:                                  $ac_cv_libewf_enable_verbose_output
    Debug output:                                    $ac_cv_libewf_enable_debug_output
-   Version 1 API:                                   $ac_cv_libewf_enable_v1_api
    Experimental version 2 API:                      $ac_cv_libewf_enable_v2_api
 ]);
 
diff --git a/dpkg/changelog b/dpkg/changelog
deleted file mode 100644
index 265719c..0000000
--- a/dpkg/changelog
+++ /dev/null
@@ -1,7 +0,0 @@
-libewf (20091003-1) unstable; urgency=low
-
-  * Initial release
-  * First version of libewf debian package based on work by Guy Voncken
-
- -- Joachim Metz <forensics at hoffmannbv.nl>  Sat, 15 Sep 2007 11:44:14 +0200
-
diff --git a/dpkg/changelog.in b/dpkg/changelog.in
deleted file mode 100644
index b851d21..0000000
--- a/dpkg/changelog.in
+++ /dev/null
@@ -1,7 +0,0 @@
-libewf (@VERSION at -1) unstable; urgency=low
-
-  * Initial release
-  * First version of libewf debian package based on work by Guy Voncken
-
- -- Joachim Metz <forensics at hoffmannbv.nl>  Sat, 15 Sep 2007 11:44:14 +0200
-
diff --git a/dpkg/compat b/dpkg/compat
deleted file mode 100644
index 7ed6ff8..0000000
--- a/dpkg/compat
+++ /dev/null
@@ -1 +0,0 @@
-5
diff --git a/dpkg/control b/dpkg/control
deleted file mode 100644
index d113d13..0000000
--- a/dpkg/control
+++ /dev/null
@@ -1,32 +0,0 @@
-Source: libewf
-Priority: extra
-Maintainer: Joachim Metz <forensics at hoffmannbv.nl>
-Build-Depends: debhelper (>= 5), autotools-dev, libc6, libc6-dev, linux-kernel-headers, zlib1g-dev, libssl-dev, uuid-dev
-Standards-Version: 3.7.2
-Section: libs
-
-Package: libewf
-Section: libs
-Architecture: any
-Depends: ${shlibs:Depends}
-Description: Library and tools to support the Expert Witness Compression Format
- libewf is library for support of the Expert Witness Compression Format (EWF).
- libewf allows you to read media information of EWF files in the SMART (EWF-S01)
- format and the EnCase (EWF-E01) format. libewf allows to read files created by
- EnCase 1 to 6, linen and FTK Imager.
-
-Package: libewf-dev
-Section: libdevel
-Architecture: any
-Depends: libewf (= ${Source-Version})
-Description: Header files and libraries for developing applications for libewf
- Header files and libraries for developing applications for libewf.
-
-Package: libewf-tools
-Section: utils
-Architecture: any
-Depends: libewf (= ${Source-Version}), ${shlibs:Depends}
-Description: Several tools for reading and writing EWF files
- Several tools for reading and writing EWF files.
- It contains tools to acquire, verify and export EWF files.
-
diff --git a/dpkg/copyright b/dpkg/copyright
deleted file mode 100644
index 0bb30dc..0000000
--- a/dpkg/copyright
+++ /dev/null
@@ -1,33 +0,0 @@
-This package was debianized by Joachim Metz <forensics at hoffmannbv.nl> on
-Sat, 15 Sep 2007 09:27:14 +0200.
-
-It was downloaded from http://libewf.sourceforge.net
-
-Upstream Author: Joachim Metz <forensics at hoffmannbv.nl>
-
-Copyright (c) 2006-2008, Joachim Metz <forensics at hoffmannbv.nl>,
-Hoffmann Investigations. All rights reserved.
-
-License:
-
-This software is free software: you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
- 
-This software is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with this software.  If not, see <http://www.gnu.org/licenses/>.
-
-
-On Debian systems, the complete text of the LPGL License can be 
-found in `/usr/share/common-licenses/LPGL'.
-
-
-The Debian packaging is (C) 2007-2008, Joachim Metz <forensics at hoffmannbv.nl> and
-is licensed under the GPL, see `/usr/share/common-licenses/GPL'.
-
diff --git a/dpkg/cron.d.ex b/dpkg/cron.d.ex
deleted file mode 100644
index c3a4d27..0000000
--- a/dpkg/cron.d.ex
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-# Regular cron jobs for the libewf package
-#
-0 4	* * *	root	libewf_maintenance
diff --git a/dpkg/emacsen-install.ex b/dpkg/emacsen-install.ex
deleted file mode 100644
index 43521e6..0000000
--- a/dpkg/emacsen-install.ex
+++ /dev/null
@@ -1,45 +0,0 @@
-#! /bin/sh -e
-# /usr/lib/emacsen-common/packages/install/libewf
-
-# Written by Jim Van Zandt <jrv at debian.org>, borrowing heavily
-# from the install scripts for gettext by Santiago Vila
-# <sanvila at ctv.es> and octave by Dirk Eddelbuettel <edd at debian.org>.
-
-FLAVOR=$1
-PACKAGE=libewf
-
-if [ ${FLAVOR} = emacs ]; then exit 0; fi
-
-echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR}
-
-#FLAVORTEST=`echo $FLAVOR | cut -c-6`
-#if [ ${FLAVORTEST} = xemacs ] ; then
-#    SITEFLAG="-no-site-file"
-#else
-#    SITEFLAG="--no-site-file"
-#fi
-FLAGS="${SITEFLAG} -q -batch -l path.el -f batch-byte-compile"
-
-ELDIR=/usr/share/emacs/site-lisp/${PACKAGE}
-ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE}
-
-# Install-info-altdir does not actually exist. 
-# Maybe somebody will write it.
-if test -x /usr/sbin/install-info-altdir; then
-    echo install/${PACKAGE}: install Info links for ${FLAVOR}
-    install-info-altdir --quiet --section "" "" --dirname=${FLAVOR} /usr/info/${PACKAGE}.info.gz
-fi
-
-install -m 755 -d ${ELCDIR}
-cd ${ELDIR}
-FILES=`echo *.el`
-cp ${FILES} ${ELCDIR}
-cd ${ELCDIR}
-
-cat << EOF > path.el
-(setq load-path (cons "." load-path) byte-compile-warnings nil)
-EOF
-${FLAVOR} ${FLAGS} ${FILES}
-rm -f *.el path.el
-
-exit 0
diff --git a/dpkg/emacsen-remove.ex b/dpkg/emacsen-remove.ex
deleted file mode 100644
index b6abe46..0000000
--- a/dpkg/emacsen-remove.ex
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh -e
-# /usr/lib/emacsen-common/packages/remove/libewf
-
-FLAVOR=$1
-PACKAGE=libewf
-
-if [ ${FLAVOR} != emacs ]; then
-    if test -x /usr/sbin/install-info-altdir; then
-        echo remove/${PACKAGE}: removing Info links for ${FLAVOR}
-        install-info-altdir --quiet --remove --dirname=${FLAVOR} /usr/info/libewf.info.gz
-    fi
-
-    echo remove/${PACKAGE}: purging byte-compiled files for ${FLAVOR}
-    rm -rf /usr/share/${FLAVOR}/site-lisp/${PACKAGE}
-fi
diff --git a/dpkg/emacsen-startup.ex b/dpkg/emacsen-startup.ex
deleted file mode 100644
index bc50ddd..0000000
--- a/dpkg/emacsen-startup.ex
+++ /dev/null
@@ -1,25 +0,0 @@
-;; -*-emacs-lisp-*-
-;;
-;; Emacs startup file, e.g.  /etc/emacs/site-start.d/50libewf.el
-;; for the Debian libewf package
-;;
-;; Originally contributed by Nils Naumann <naumann at unileoben.ac.at>
-;; Modified by Dirk Eddelbuettel <edd at debian.org>
-;; Adapted for dh-make by Jim Van Zandt <jrv at debian.org>
-
-;; The libewf package follows the Debian/GNU Linux 'emacsen' policy and
-;; byte-compiles its elisp files for each 'emacs flavor' (emacs19,
-;; xemacs19, emacs20, xemacs20...).  The compiled code is then
-;; installed in a subdirectory of the respective site-lisp directory.
-;; We have to add this to the load-path:
-(let ((package-dir (concat "/usr/share/"
-                           (symbol-name flavor)
-                           "/site-lisp/libewf")))
-;; If package-dir does not exist, the libewf package must have
-;; removed but not purged, and we should skip the setup.
-  (when (file-directory-p package-dir)
-        (setq load-path (cons package-dir load-path))
-       (autoload 'libewf-mode "libewf-mode"
-         "Major mode for editing libewf files." t)
-       (add-to-list 'auto-mode-alist '("\\.libewf$" . libewf-mode))))
-
diff --git a/dpkg/init.d.ex b/dpkg/init.d.ex
deleted file mode 100644
index 3a9aa6b..0000000
--- a/dpkg/init.d.ex
+++ /dev/null
@@ -1,81 +0,0 @@
-#! /bin/sh
-#
-# skeleton	example file to build /etc/init.d/ scripts.
-#		This file should be used to construct scripts for /etc/init.d.
-#
-#		Written by Miquel van Smoorenburg <miquels at cistron.nl>.
-#		Modified for Debian 
-#		by Ian Murdock <imurdock at gnu.ai.mit.edu>.
-#
-# Version:	@(#)skeleton  1.9  26-Feb-2001  miquels at cistron.nl
-#
-
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-DAEMON=/usr/sbin/libewf
-NAME=libewf
-DESC=libewf
-
-test -x $DAEMON || exit 0
-
-# Include libewf defaults if available
-if [ -f /etc/default/libewf ] ; then
-	. /etc/default/libewf
-fi
-
-set -e
-
-case "$1" in
-  start)
-	echo -n "Starting $DESC: "
-	start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
-		--exec $DAEMON -- $DAEMON_OPTS
-	echo "$NAME."
-	;;
-  stop)
-	echo -n "Stopping $DESC: "
-	start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
-		--exec $DAEMON
-	echo "$NAME."
-	;;
-  #reload)
-	#
-	#	If the daemon can reload its config files on the fly
-	#	for example by sending it SIGHUP, do it here.
-	#
-	#	If the daemon responds to changes in its config file
-	#	directly anyway, make this a do-nothing entry.
-	#
-	# echo "Reloading $DESC configuration files."
-	# start-stop-daemon --stop --signal 1 --quiet --pidfile \
-	#	/var/run/$NAME.pid --exec $DAEMON
-  #;;
-  force-reload)
-	#
-	#	If the "reload" option is implemented, move the "force-reload"
-	#	option to the "reload" entry above. If not, "force-reload" is
-	#	just the same as "restart" except that it does nothing if the
-	#   daemon isn't already running.
-	# check wether $DAEMON is running. If so, restart
-	start-stop-daemon --stop --test --quiet --pidfile \
-		/var/run/$NAME.pid --exec $DAEMON \
-	&& $0 restart \
-	|| exit 0
-	;;
-  restart)
-    echo -n "Restarting $DESC: "
-	start-stop-daemon --stop --quiet --pidfile \
-		/var/run/$NAME.pid --exec $DAEMON
-	sleep 1
-	start-stop-daemon --start --quiet --pidfile \
-		/var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
-	echo "$NAME."
-	;;
-  *)
-	N=/etc/init.d/$NAME
-	# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
-	echo "Usage: $N {start|stop|restart|force-reload}" >&2
-	exit 1
-	;;
-esac
-
-exit 0
diff --git a/dpkg/libewf-default.ex b/dpkg/libewf-default.ex
deleted file mode 100644
index f8006cd..0000000
--- a/dpkg/libewf-default.ex
+++ /dev/null
@@ -1,10 +0,0 @@
-# Defaults for libewf initscript
-# sourced by /etc/init.d/libewf
-# installed at /etc/default/libewf by the maintainer scripts
-
-#
-# This is a POSIX shell fragment
-#
-
-# Additional options that are passed to the Daemon.
-DAEMON_OPTS=""
diff --git a/dpkg/libewf-dev.dirs b/dpkg/libewf-dev.dirs
deleted file mode 100644
index cf3fe8c..0000000
--- a/dpkg/libewf-dev.dirs
+++ /dev/null
@@ -1,4 +0,0 @@
-usr/lib
-usr/include
-usr/include/libewf
-usr/share/man/man3
diff --git a/dpkg/libewf-dev.docs b/dpkg/libewf-dev.docs
deleted file mode 100644
index 10f1faa..0000000
--- a/dpkg/libewf-dev.docs
+++ /dev/null
@@ -1,5 +0,0 @@
-AUTHORS
-COPYING
-NEWS
-README
-ChangeLog
diff --git a/dpkg/libewf-dev.install b/dpkg/libewf-dev.install
deleted file mode 100644
index 423118e..0000000
--- a/dpkg/libewf-dev.install
+++ /dev/null
@@ -1,7 +0,0 @@
-usr/include/*.h
-usr/include/libewf/*.h
-usr/lib/*.la
-usr/lib/lib*.a
-usr/lib/lib*.so
-usr/lib/pkgconfig/*
-usr/share/man/man3/*
diff --git a/dpkg/libewf-tools.dirs b/dpkg/libewf-tools.dirs
deleted file mode 100644
index 98d1583..0000000
--- a/dpkg/libewf-tools.dirs
+++ /dev/null
@@ -1,2 +0,0 @@
-usr/bin
-usr/share/man/man1
diff --git a/dpkg/libewf-tools.docs b/dpkg/libewf-tools.docs
deleted file mode 100644
index 10f1faa..0000000
--- a/dpkg/libewf-tools.docs
+++ /dev/null
@@ -1,5 +0,0 @@
-AUTHORS
-COPYING
-NEWS
-README
-ChangeLog
diff --git a/dpkg/libewf-tools.install b/dpkg/libewf-tools.install
deleted file mode 100644
index 8004b82..0000000
--- a/dpkg/libewf-tools.install
+++ /dev/null
@@ -1,6 +0,0 @@
-usr/bin/ewfacquire
-usr/bin/ewfacquirestream
-usr/bin/ewfexport
-usr/bin/ewfinfo
-usr/bin/ewfverify
-usr/share/man/man1/*
diff --git a/dpkg/libewf.dirs b/dpkg/libewf.dirs
deleted file mode 100644
index 6845771..0000000
--- a/dpkg/libewf.dirs
+++ /dev/null
@@ -1 +0,0 @@
-usr/lib
diff --git a/dpkg/libewf.doc-base.EX b/dpkg/libewf.doc-base.EX
deleted file mode 100644
index d35e58e..0000000
--- a/dpkg/libewf.doc-base.EX
+++ /dev/null
@@ -1,22 +0,0 @@
-Document: libewf
-Title: Debian libewf Manual
-Author: <insert document author here>
-Abstract: This manual describes what libewf is
- and how it can be used to
- manage online manuals on Debian systems.
-Section: unknown
-
-Format: debiandoc-sgml
-Files: /usr/share/doc/libewf/libewf.sgml.gz
-
-Format: postscript
-Files: /usr/share/doc/libewf/libewf.ps.gz
-
-Format: text
-Files: /usr/share/doc/libewf/libewf.text.gz
-
-Format: HTML
-Index: /usr/share/doc/libewf/html/index.html
-Files: /usr/share/doc/libewf/html/*.html
-
-  
diff --git a/dpkg/libewf.docs b/dpkg/libewf.docs
deleted file mode 100644
index 10f1faa..0000000
--- a/dpkg/libewf.docs
+++ /dev/null
@@ -1,5 +0,0 @@
-AUTHORS
-COPYING
-NEWS
-README
-ChangeLog
diff --git a/dpkg/libewf.install b/dpkg/libewf.install
deleted file mode 100644
index d0dbfd1..0000000
--- a/dpkg/libewf.install
+++ /dev/null
@@ -1 +0,0 @@
-usr/lib/lib*.so.*
diff --git a/dpkg/libewf.postinst.debhelper b/dpkg/libewf.postinst.debhelper
deleted file mode 100644
index 8a25b9e..0000000
--- a/dpkg/libewf.postinst.debhelper
+++ /dev/null
@@ -1,3 +0,0 @@
-if [ "$1" = "configure" ]; then
-	ldconfig
-fi
diff --git a/dpkg/libewf.postrm.debhelper b/dpkg/libewf.postrm.debhelper
deleted file mode 100644
index 96bf24e..0000000
--- a/dpkg/libewf.postrm.debhelper
+++ /dev/null
@@ -1,3 +0,0 @@
-if [ "$1" = "remove" ]; then
-	ldconfig
-fi
diff --git a/dpkg/manpage.1.ex b/dpkg/manpage.1.ex
deleted file mode 100644
index 3d8c4c8..0000000
--- a/dpkg/manpage.1.ex
+++ /dev/null
@@ -1,59 +0,0 @@
-.\"                                      Hey, EMACS: -*- nroff -*-
-.\" First parameter, NAME, should be all caps
-.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
-.\" other parameters are allowed: see man(7), man(1)
-.TH LIBEWF SECTION "September 15, 2007"
-.\" Please adjust this date whenever revising the manpage.
-.\"
-.\" Some roff macros, for reference:
-.\" .nh        disable hyphenation
-.\" .hy        enable hyphenation
-.\" .ad l      left justify
-.\" .ad b      justify to both left and right margins
-.\" .nf        disable filling
-.\" .fi        enable filling
-.\" .br        insert line break
-.\" .sp <n>    insert n+1 empty lines
-.\" for manpage-specific macros, see man(7)
-.SH NAME
-libewf \- program to do something
-.SH SYNOPSIS
-.B libewf
-.RI [ options ] " files" ...
-.br
-.B bar
-.RI [ options ] " files" ...
-.SH DESCRIPTION
-This manual page documents briefly the
-.B libewf
-and
-.B bar
-commands.
-.PP
-.\" TeX users may be more comfortable with the \fB<whatever>\fP and
-.\" \fI<whatever>\fP escape sequences to invode bold face and italics, 
-.\" respectively.
-\fBlibewf\fP is a program that...
-.SH OPTIONS
-These programs follow the usual GNU command line syntax, with long
-options starting with two dashes (`-').
-A summary of options is included below.
-For a complete description, see the Info files.
-.TP
-.B \-h, \-\-help
-Show summary of options.
-.TP
-.B \-v, \-\-version
-Show version of program.
-.SH SEE ALSO
-.BR bar (1),
-.BR baz (1).
-.br
-The programs are documented fully by
-.IR "The Rise and Fall of a Fooish Bar" ,
-available via the Info system.
-.SH AUTHOR
-libewf was written by <upstream author>.
-.PP
-This manual page was written by Joachim Metz <joachim at vmprodigy.dominion>,
-for the Debian project (but may be used by others).
diff --git a/dpkg/manpage.sgml.ex b/dpkg/manpage.sgml.ex
deleted file mode 100644
index 2a6a8b9..0000000
--- a/dpkg/manpage.sgml.ex
+++ /dev/null
@@ -1,156 +0,0 @@
-<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
-
-<!-- Process this file with docbook-to-man to generate an nroff manual
-     page: `docbook-to-man manpage.sgml > manpage.1'.  You may view
-     the manual page with: `docbook-to-man manpage.sgml | nroff -man |
-     less'.  A typical entry in a Makefile or Makefile.am is:
-
-manpage.1: manpage.sgml
-	docbook-to-man $< > $@
-
-    
-	The docbook-to-man binary is found in the docbook-to-man package.
-	Please remember that if you create the nroff version in one of the
-	debian/rules file targets (such as build), you will need to include
-	docbook-to-man in your Build-Depends control field.
-
-  -->
-
-  <!-- Fill in your name for FIRSTNAME and SURNAME. -->
-  <!ENTITY dhfirstname "<firstname>FIRSTNAME</firstname>">
-  <!ENTITY dhsurname   "<surname>SURNAME</surname>">
-  <!-- Please adjust the date whenever revising the manpage. -->
-  <!ENTITY dhdate      "<date>September 15, 2007</date>">
-  <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
-       allowed: see man(7), man(1). -->
-  <!ENTITY dhsection   "<manvolnum>SECTION</manvolnum>">
-  <!ENTITY dhemail     "<email>joachim at vmprodigy.dominion</email>">
-  <!ENTITY dhusername  "Joachim Metz">
-  <!ENTITY dhucpackage "<refentrytitle>LIBEWF</refentrytitle>">
-  <!ENTITY dhpackage   "libewf">
-
-  <!ENTITY debian      "<productname>Debian</productname>">
-  <!ENTITY gnu         "<acronym>GNU</acronym>">
-  <!ENTITY gpl         "&gnu; <acronym>GPL</acronym>">
-]>
-
-<refentry>
-  <refentryinfo>
-    <address>
-      &dhemail;
-    </address>
-    <author>
-      &dhfirstname;
-      &dhsurname;
-    </author>
-    <copyright>
-      <year>2003</year>
-      <holder>&dhusername;</holder>
-    </copyright>
-    &dhdate;
-  </refentryinfo>
-  <refmeta>
-    &dhucpackage;
-
-    &dhsection;
-  </refmeta>
-  <refnamediv>
-    <refname>&dhpackage;</refname>
-
-    <refpurpose>program to do something</refpurpose>
-  </refnamediv>
-  <refsynopsisdiv>
-    <cmdsynopsis>
-      <command>&dhpackage;</command>
-
-      <arg><option>-e <replaceable>this</replaceable></option></arg>
-
-      <arg><option>--example <replaceable>that</replaceable></option></arg>
-    </cmdsynopsis>
-  </refsynopsisdiv>
-  <refsect1>
-    <title>DESCRIPTION</title>
-
-    <para>This manual page documents briefly the
-      <command>&dhpackage;</command> and <command>bar</command>
-      commands.</para>
-
-    <para>This manual page was written for the &debian; distribution
-      because the original program does not have a manual page.
-      Instead, it has documentation in the &gnu;
-      <application>Info</application> format; see below.</para>
-
-    <para><command>&dhpackage;</command> is a program that...</para>
-
-  </refsect1>
-  <refsect1>
-    <title>OPTIONS</title>
-
-    <para>These programs follow the usual &gnu; command line syntax,
-      with long options starting with two dashes (`-').  A summary of
-      options is included below.  For a complete description, see the
-      <application>Info</application> files.</para>
-
-    <variablelist>
-      <varlistentry>
-        <term><option>-h</option>
-          <option>--help</option>
-        </term>
-        <listitem>
-          <para>Show summary of options.</para>
-        </listitem>
-      </varlistentry>
-      <varlistentry>
-        <term><option>-v</option>
-          <option>--version</option>
-        </term>
-        <listitem>
-          <para>Show version of program.</para>
-        </listitem>
-      </varlistentry>
-    </variablelist>
-  </refsect1>
-  <refsect1>
-    <title>SEE ALSO</title>
-
-    <para>bar (1), baz (1).</para>
-
-    <para>The programs are documented fully by <citetitle>The Rise and
-      Fall of a Fooish Bar</citetitle> available via the
-      <application>Info</application> system.</para>
-  </refsect1>
-  <refsect1>
-    <title>AUTHOR</title>
-
-    <para>This manual page was written by &dhusername; &dhemail; for
-      the &debian; system (but may be used by others).  Permission is
-      granted to copy, distribute and/or modify this document under
-      the terms of the &gnu; General Public License, Version 2 any 
-	  later version published by the Free Software Foundation.
-    </para>
-	<para>
-	  On Debian systems, the complete text of the GNU General Public
-	  License can be found in /usr/share/common-licenses/GPL.
-	</para>
-
-  </refsect1>
-</refentry>
-
-<!-- Keep this comment at the end of the file
-Local variables:
-mode: sgml
-sgml-omittag:t
-sgml-shorttag:t
-sgml-minimize-attributes:nil
-sgml-always-quote-attributes:t
-sgml-indent-step:2
-sgml-indent-data:t
-sgml-parent-document:nil
-sgml-default-dtd-file:nil
-sgml-exposed-tags:nil
-sgml-local-catalogs:nil
-sgml-local-ecat-files:nil
-End:
--->
-
-
diff --git a/dpkg/manpage.xml.ex b/dpkg/manpage.xml.ex
deleted file mode 100644
index cc289b8..0000000
--- a/dpkg/manpage.xml.ex
+++ /dev/null
@@ -1,148 +0,0 @@
-<?xml version='1.0' encoding='ISO-8859-1'?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
-"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
-
-<!--
-
-Process this file with an XSLT processor: `xsltproc \
--''-nonet /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/\
-manpages/docbook.xsl manpage.dbk'.  A manual page
-<package>.<section> will be generated.  You may view the
-manual page with: nroff -man <package>.<section> | less'.  A
-typical entry in a Makefile or Makefile.am is:
-
-DB2MAN=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/\
-manpages/docbook.xsl
-XP=xsltproc -''-nonet
-
-manpage.1: manpage.dbk
-        $(XP) $(DB2MAN) $<
-    
-The xsltproc binary is found in the xsltproc package.  The
-XSL files are in docbook-xsl.  Please remember that if you
-create the nroff version in one of the debian/rules file
-targets (such as build), you will need to include xsltproc
-and docbook-xsl in your Build-Depends control field.
-
--->
-
-  <!-- Fill in your name for FIRSTNAME and SURNAME. -->
-  <!ENTITY dhfirstname "<firstname>FIRSTNAME</firstname>">
-  <!ENTITY dhsurname   "<surname>SURNAME</surname>">
-  <!-- Please adjust the date whenever revising the manpage. -->
-  <!ENTITY dhdate      "<date>September 15, 2007</date>">
-  <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
-       allowed: see man(7), man(1). -->
-  <!ENTITY dhsection   "<manvolnum>SECTION</manvolnum>">
-  <!ENTITY dhemail     "<email>joachim at vmprodigy.dominion</email>">
-  <!ENTITY dhusername  "Joachim Metz">
-  <!ENTITY dhucpackage "<refentrytitle>LIBEWF</refentrytitle>">
-  <!ENTITY dhpackage   "libewf">
-
-  <!ENTITY debian      "<productname>Debian</productname>">
-  <!ENTITY gnu         "<acronym>GNU</acronym>">
-  <!ENTITY gpl         "&gnu; <acronym>GPL</acronym>">
-]>
-
-<refentry>
-  <refentryinfo>
-    <address>
-      &dhemail;
-    </address>
-    <author>
-      &dhfirstname;
-      &dhsurname;
-    </author>
-    <copyright>
-      <year>2003</year>
-      <holder>&dhusername;</holder>
-    </copyright>
-    &dhdate;
-  </refentryinfo>
-  <refmeta>
-    &dhucpackage;
-
-    &dhsection;
-  </refmeta>
-  <refnamediv>
-    <refname>&dhpackage;</refname>
-
-    <refpurpose>program to do something</refpurpose>
-  </refnamediv>
-  <refsynopsisdiv>
-    <cmdsynopsis>
-      <command>&dhpackage;</command>
-
-      <arg><option>-e <replaceable>this</replaceable></option></arg>
-
-      <arg><option>--example <replaceable>that</replaceable></option></arg>
-    </cmdsynopsis>
-  </refsynopsisdiv>
-  <refsect1>
-    <title>DESCRIPTION</title>
-
-    <para>This manual page documents briefly the
-      <command>&dhpackage;</command> and <command>bar</command>
-      commands.</para>
-
-    <para>This manual page was written for the &debian; distribution
-      because the original program does not have a manual page.
-      Instead, it has documentation in the &gnu;
-      <application>Info</application> format; see below.</para>
-
-    <para><command>&dhpackage;</command> is a program that...</para>
-
-  </refsect1>
-  <refsect1>
-    <title>OPTIONS</title>
-
-    <para>These programs follow the usual &gnu; command line syntax,
-      with long options starting with two dashes (`-').  A summary of
-      options is included below.  For a complete description, see the
-      <application>Info</application> files.</para>
-
-    <variablelist>
-      <varlistentry>
-        <term><option>-h</option>
-          <option>--help</option>
-        </term>
-        <listitem>
-          <para>Show summary of options.</para>
-        </listitem>
-      </varlistentry>
-      <varlistentry>
-        <term><option>-v</option>
-          <option>--version</option>
-        </term>
-        <listitem>
-          <para>Show version of program.</para>
-        </listitem>
-      </varlistentry>
-    </variablelist>
-  </refsect1>
-  <refsect1>
-    <title>SEE ALSO</title>
-
-    <para>bar (1), baz (1).</para>
-
-    <para>The programs are documented fully by <citetitle>The Rise and
-      Fall of a Fooish Bar</citetitle> available via the
-      <application>Info</application> system.</para>
-  </refsect1>
-  <refsect1>
-    <title>AUTHOR</title>
-
-    <para>This manual page was written by &dhusername; &dhemail; for
-      the &debian; system (but may be used by others).  Permission is
-      granted to copy, distribute and/or modify this document under
-      the terms of the &gnu; General Public License, Version 2 any 
-	  later version published by the Free Software Foundation.
-    </para>
-	<para>
-	  On Debian systems, the complete text of the GNU General Public
-	  License can be found in /usr/share/common-licenses/GPL.
-	</para>
-
-  </refsect1>
-</refentry>
-
diff --git a/dpkg/menu.ex b/dpkg/menu.ex
deleted file mode 100644
index 53f0190..0000000
--- a/dpkg/menu.ex
+++ /dev/null
@@ -1,2 +0,0 @@
-?package(libewf):needs="X11|text|vc|wm" section="Apps/see-menu-manual"\
-  title="libewf" command="/usr/bin/libewf"
diff --git a/dpkg/postinst.ex b/dpkg/postinst.ex
deleted file mode 100644
index a6c1c04..0000000
--- a/dpkg/postinst.ex
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/sh
-# postinst script for libewf
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <postinst> `configure' <most-recently-configured-version>
-#        * <old-postinst> `abort-upgrade' <new version>
-#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
-#          <new-version>
-#        * <postinst> `abort-remove'
-#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
-#          <failed-install-package> <version> `removing'
-#          <conflicting-package> <version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-
-case "$1" in
-    configure)
-    ;;
-
-    abort-upgrade|abort-remove|abort-deconfigure)
-    ;;
-
-    *)
-        echo "postinst called with unknown argument \`$1'" >&2
-        exit 1
-    ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
-
-
diff --git a/dpkg/postrm.ex b/dpkg/postrm.ex
deleted file mode 100644
index e8b32bf..0000000
--- a/dpkg/postrm.ex
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-# postrm script for libewf
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <postrm> `remove'
-#        * <postrm> `purge'
-#        * <old-postrm> `upgrade' <new-version>
-#        * <new-postrm> `failed-upgrade' <old-version>
-#        * <new-postrm> `abort-install'
-#        * <new-postrm> `abort-install' <old-version>
-#        * <new-postrm> `abort-upgrade' <old-version>
-#        * <disappearer's-postrm> `disappear' <overwriter>
-#          <overwriter-version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-
-case "$1" in
-    purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
-    ;;
-
-    *)
-        echo "postrm called with unknown argument \`$1'" >&2
-        exit 1
-    ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
-
-
diff --git a/dpkg/preinst.ex b/dpkg/preinst.ex
deleted file mode 100644
index 21c0b3c..0000000
--- a/dpkg/preinst.ex
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-# preinst script for libewf
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <new-preinst> `install'
-#        * <new-preinst> `install' <old-version>
-#        * <new-preinst> `upgrade' <old-version>
-#        * <old-preinst> `abort-upgrade' <new-version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-
-case "$1" in
-    install|upgrade)
-    ;;
-
-    abort-upgrade)
-    ;;
-
-    *)
-        echo "preinst called with unknown argument \`$1'" >&2
-        exit 1
-    ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
-
-
diff --git a/dpkg/prerm.ex b/dpkg/prerm.ex
deleted file mode 100644
index f80a586..0000000
--- a/dpkg/prerm.ex
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-# prerm script for libewf
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <prerm> `remove'
-#        * <old-prerm> `upgrade' <new-version>
-#        * <new-prerm> `failed-upgrade' <old-version>
-#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
-#        * <deconfigured's-prerm> `deconfigure' `in-favour'
-#          <package-being-installed> <version> `removing'
-#          <conflicting-package> <version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-
-case "$1" in
-    remove|upgrade|deconfigure)
-    ;;
-
-    failed-upgrade)
-    ;;
-
-    *)
-        echo "prerm called with unknown argument \`$1'" >&2
-        exit 1
-    ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
-
-
diff --git a/dpkg/rules b/dpkg/rules
deleted file mode 100755
index 3b80174..0000000
--- a/dpkg/rules
+++ /dev/null
@@ -1,114 +0,0 @@
-#!/usr/bin/make -f
-# -*- makefile -*-
-# Sample debian/rules that uses debhelper.
-# This file was originally written by Joey Hess and Craig Small.
-# As a special exception, when this file is copied by dh-make into a
-# dh-make output file, you may use that output file without restriction.
-# This special exception was added by Craig Small in version 0.37 of dh-make.
-
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-
-# These are used for cross-compiling and for saving the configure script
-# from having to guess our platform (since we know it already)
-DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
-DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
-
-
-CFLAGS = -Wall -g
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-	CFLAGS += -O0
-else
-	CFLAGS += -O2
-endif
-
-# shared library versions, option 1
-version=2.0.5
-major=2
-# option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so
-#version=`ls src/.libs/lib*.so.* | \
-# awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'`
-#major=`ls src/.libs/lib*.so.* | \
-# awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'`
-
-config.status: configure
-	dh_testdir
-	# Add here commands to configure the package.
-	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs" --enable-v2-api=yes
-
-
-build: build-stamp
-build-stamp:  config.status
-	dh_testdir
-
-	# Add here commands to compile the package.
-	$(MAKE)
-
-	touch $@
-
-clean:
-	dh_testdir
-	dh_testroot
-	rm -f build-stamp 
-
-	# Add here commands to clean up after the build process.
-	-$(MAKE) distclean
-ifneq "$(wildcard /usr/share/misc/config.sub)" ""
-	cp -f /usr/share/misc/config.sub config.sub
-endif
-ifneq "$(wildcard /usr/share/misc/config.guess)" ""
-	cp -f /usr/share/misc/config.guess config.guess
-endif
-
-
-	dh_clean 
-
-install: build
-	dh_testdir
-	dh_testroot
-	dh_clean -k 
-	dh_installdirs
-
-	# Add here commands to install the package into debian/tmp
-	$(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
-
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
-	dh_testdir
-	dh_testroot
-	dh_installchangelogs ChangeLog
-	dh_installdocs
-	dh_installexamples
-	dh_install --list-missing --sourcedir=$(CURDIR)/debian/tmp
-#	dh_installmenu
-#	dh_installdebconf	
-#	dh_installlogrotate
-#	dh_installemacsen
-#	dh_installpam
-#	dh_installmime
-#	dh_installinit
-#	dh_installcron
-#	dh_installinfo
-	dh_installman
-	dh_link
-	dh_strip
-	dh_compress
-	dh_fixperms
-#	dh_perl
-#	dh_python
-	dh_makeshlibs -V
-	dh_installdeb
-	dh_shlibdeps -L libewf -l debian/libewf/usr/lib
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install 
diff --git a/dpkg/shlibs.local.ex b/dpkg/shlibs.local.ex
deleted file mode 100644
index 1260ae2..0000000
--- a/dpkg/shlibs.local.ex
+++ /dev/null
@@ -1 +0,0 @@
-liblibewf 20091003 libewf (>> 20091003-0), libewf (<< 20091003-99)
diff --git a/dpkg/shlibs.local.ex.in b/dpkg/shlibs.local.ex.in
deleted file mode 100644
index 28e9aa9..0000000
--- a/dpkg/shlibs.local.ex.in
+++ /dev/null
@@ -1 +0,0 @@
-liblibewf @VERSION@ libewf (>> @VERSION at -0), libewf (<< @VERSION at -99)
diff --git a/dpkg/watch.ex b/dpkg/watch.ex
deleted file mode 100644
index b88dbd4..0000000
--- a/dpkg/watch.ex
+++ /dev/null
@@ -1,22 +0,0 @@
-# Example watch control file for uscan
-# Rename this file to "watch" and then you can run the "uscan" command
-# to check for upstream updates and more.
-# See uscan(1) for format
-
-# Compulsory line, this is a version 3 file
-version=3
-
-# Uncomment to examine a Webpage 
-# <Webpage URL> <string match>
-#http://www.example.com/downloads.php libewf-(.*)\.tar\.gz
-
-# Uncomment to examine a Webserver directory
-#http://www.example.com/pub/libewf-(.*)\.tar\.gz
-
-# Uncommment to examine a FTP server
-#ftp://ftp.example.com/pub/libewf-(.*)\.tar\.gz debian uupdate
-
-# Uncomment to find new files on sourceforge, for debscripts >= 2.9
-# http://sf.net/libewf/libewf-(.*)\.tar\.gz
-
-
diff --git a/ewftools/Makefile.am b/ewftools/Makefile.am
index c6422cc..c5a3ce4 100644
--- a/ewftools/Makefile.am
+++ b/ewftools/Makefile.am
@@ -10,7 +10,7 @@ AM_CPPFLAGS = \
 
 AM_LDFLAGS = @STATIC_LDFLAGS@
 
-bin_PROGRAMS = ewfacquire ewfacquirestream ewfalter ewfdebug ewfexport ewfinfo ewfverify
+bin_PROGRAMS = ewfacquire ewfacquirestream ewfexport ewfinfo ewfverify
 
 ewfacquire_SOURCES = \
 	byte_size_string.c byte_size_string.h \
@@ -66,33 +66,6 @@ ewfacquirestream_LDADD = \
 	@LIBUUID_LIBADD@ \
 	@MEMWATCH_LIBADD@
 
-ewfalter_SOURCES = \
-	alteration_handle.c alteration_handle.h \
-	byte_size_string.c byte_size_string.h \
-	ewfalter.c \
-	ewfcommon.h \
-	ewfinput.c ewfinput.h \
-	ewfoutput.c ewfoutput.h \
-	storage_media_buffer.c storage_media_buffer.h
-
-ewfalter_LDADD = \
-	../liberror/liberror.la \
-	../libewf/libewf.la \
-	../libsystem/libsystem.la \
-	@MEMWATCH_LIBADD@
-
-ewfdebug_SOURCES = \
-	byte_size_string.c byte_size_string.h \
-	ewfdebug.c \
-	ewfinput.c ewfinput.h \
-	ewfoutput.c ewfoutput.h
-
-ewfdebug_LDADD = \
-	../liberror/liberror.la \
-	../libewf/libewf.la \
-	../libsystem/libsystem.la \
-	@MEMWATCH_LIBADD@
-
 ewfexport_SOURCES = \
 	byte_size_string.c byte_size_string.h \
 	digest_context.c digest_context.h \
@@ -162,10 +135,6 @@ splint:
 	-splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(ewfacquire_SOURCES) 
 	@echo "Running splint on ewfacquirestream ..." 
 	-splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(ewfacquirestream_SOURCES) 
-	@echo "Running splint on ewfalter ..." 
-	-splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(ewfalter_SOURCES) 
-	@echo "Running splint on ewfdebug ..." 
-	-splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(ewfdebug_SOURCES) 
 	@echo "Running splint on ewfexport ..." 
 	-splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(ewfexport_SOURCES) 
 	@echo "Running splint on ewfinfo ..." 
diff --git a/ewftools/Makefile.in b/ewftools/Makefile.in
index 061c44a..0e1ba61 100644
--- a/ewftools/Makefile.in
+++ b/ewftools/Makefile.in
@@ -35,8 +35,7 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 bin_PROGRAMS = ewfacquire$(EXEEXT) ewfacquirestream$(EXEEXT) \
-	ewfalter$(EXEEXT) ewfdebug$(EXEEXT) ewfexport$(EXEEXT) \
-	ewfinfo$(EXEEXT) ewfverify$(EXEEXT)
+	ewfexport$(EXEEXT) ewfinfo$(EXEEXT) ewfverify$(EXEEXT)
 subdir = ewftools
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -71,18 +70,6 @@ am_ewfacquirestream_OBJECTS = byte_size_string.$(OBJEXT) \
 ewfacquirestream_OBJECTS = $(am_ewfacquirestream_OBJECTS)
 ewfacquirestream_DEPENDENCIES = ../liberror/liberror.la \
 	../libewf/libewf.la ../libsystem/libsystem.la
-am_ewfalter_OBJECTS = alteration_handle.$(OBJEXT) \
-	byte_size_string.$(OBJEXT) ewfalter.$(OBJEXT) \
-	ewfinput.$(OBJEXT) ewfoutput.$(OBJEXT) \
-	storage_media_buffer.$(OBJEXT)
-ewfalter_OBJECTS = $(am_ewfalter_OBJECTS)
-ewfalter_DEPENDENCIES = ../liberror/liberror.la ../libewf/libewf.la \
-	../libsystem/libsystem.la
-am_ewfdebug_OBJECTS = byte_size_string.$(OBJEXT) ewfdebug.$(OBJEXT) \
-	ewfinput.$(OBJEXT) ewfoutput.$(OBJEXT)
-ewfdebug_OBJECTS = $(am_ewfdebug_OBJECTS)
-ewfdebug_DEPENDENCIES = ../liberror/liberror.la ../libewf/libewf.la \
-	../libsystem/libsystem.la
 am_ewfexport_OBJECTS = byte_size_string.$(OBJEXT) \
 	digest_context.$(OBJEXT) digest_hash.$(OBJEXT) \
 	ewfexport.$(OBJEXT) ewfinput.$(OBJEXT) ewfoutput.$(OBJEXT) \
@@ -119,11 +106,9 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(ewfacquire_SOURCES) $(ewfacquirestream_SOURCES) \
-	$(ewfalter_SOURCES) $(ewfdebug_SOURCES) $(ewfexport_SOURCES) \
-	$(ewfinfo_SOURCES) $(ewfverify_SOURCES)
+	$(ewfexport_SOURCES) $(ewfinfo_SOURCES) $(ewfverify_SOURCES)
 DIST_SOURCES = $(ewfacquire_SOURCES) $(ewfacquirestream_SOURCES) \
-	$(ewfalter_SOURCES) $(ewfdebug_SOURCES) $(ewfexport_SOURCES) \
-	$(ewfinfo_SOURCES) $(ewfverify_SOURCES)
+	$(ewfexport_SOURCES) $(ewfinfo_SOURCES) $(ewfverify_SOURCES)
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -352,33 +337,6 @@ ewfacquirestream_LDADD = \
 	@LIBUUID_LIBADD@ \
 	@MEMWATCH_LIBADD@
 
-ewfalter_SOURCES = \
-	alteration_handle.c alteration_handle.h \
-	byte_size_string.c byte_size_string.h \
-	ewfalter.c \
-	ewfcommon.h \
-	ewfinput.c ewfinput.h \
-	ewfoutput.c ewfoutput.h \
-	storage_media_buffer.c storage_media_buffer.h
-
-ewfalter_LDADD = \
-	../liberror/liberror.la \
-	../libewf/libewf.la \
-	../libsystem/libsystem.la \
-	@MEMWATCH_LIBADD@
-
-ewfdebug_SOURCES = \
-	byte_size_string.c byte_size_string.h \
-	ewfdebug.c \
-	ewfinput.c ewfinput.h \
-	ewfoutput.c ewfoutput.h
-
-ewfdebug_LDADD = \
-	../liberror/liberror.la \
-	../libewf/libewf.la \
-	../libsystem/libsystem.la \
-	@MEMWATCH_LIBADD@
-
 ewfexport_SOURCES = \
 	byte_size_string.c byte_size_string.h \
 	digest_context.c digest_context.h \
@@ -523,12 +481,6 @@ ewfacquire$(EXEEXT): $(ewfacquire_OBJECTS) $(ewfacquire_DEPENDENCIES)
 ewfacquirestream$(EXEEXT): $(ewfacquirestream_OBJECTS) $(ewfacquirestream_DEPENDENCIES) 
 	@rm -f ewfacquirestream$(EXEEXT)
 	$(LINK) $(ewfacquirestream_OBJECTS) $(ewfacquirestream_LDADD) $(LIBS)
-ewfalter$(EXEEXT): $(ewfalter_OBJECTS) $(ewfalter_DEPENDENCIES) 
-	@rm -f ewfalter$(EXEEXT)
-	$(LINK) $(ewfalter_OBJECTS) $(ewfalter_LDADD) $(LIBS)
-ewfdebug$(EXEEXT): $(ewfdebug_OBJECTS) $(ewfdebug_DEPENDENCIES) 
-	@rm -f ewfdebug$(EXEEXT)
-	$(LINK) $(ewfdebug_OBJECTS) $(ewfdebug_LDADD) $(LIBS)
 ewfexport$(EXEEXT): $(ewfexport_OBJECTS) $(ewfexport_DEPENDENCIES) 
 	@rm -f ewfexport$(EXEEXT)
 	$(LINK) $(ewfexport_OBJECTS) $(ewfexport_LDADD) $(LIBS)
@@ -545,15 +497,12 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alteration_handle.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/byte_size_string.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/device_handle.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/digest_context.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/digest_hash.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ewfacquire.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ewfacquirestream.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ewfalter.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ewfdebug.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ewfexport.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ewfinfo.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ewfinput.Po at am__quote@
@@ -805,10 +754,6 @@ splint:
 	-splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(ewfacquire_SOURCES) 
 	@echo "Running splint on ewfacquirestream ..." 
 	-splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(ewfacquirestream_SOURCES) 
-	@echo "Running splint on ewfalter ..." 
-	-splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(ewfalter_SOURCES) 
-	@echo "Running splint on ewfdebug ..." 
-	-splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(ewfdebug_SOURCES) 
 	@echo "Running splint on ewfexport ..." 
 	-splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(ewfexport_SOURCES) 
 	@echo "Running splint on ewfinfo ..." 
diff --git a/ewftools/alteration_handle.c b/ewftools/alteration_handle.c
deleted file mode 100644
index 6dd2102..0000000
--- a/ewftools/alteration_handle.c
+++ /dev/null
@@ -1,1155 +0,0 @@
-/* 
- * Alteration handle
- *
- * Copyright (C) 2007-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
- *
- * Refer to AUTHORS for acknowledgements.
- *
- * This software is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this software.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <common.h>
-#include <memory.h>
-#include <types.h>
-
-#include <liberror.h>
-
-/* If libtool DLL support is enabled set LIBEWF_DLL_IMPORT
- * before including libewf.h
- */
-#if defined( _WIN32 ) && defined( DLL_EXPORT )
-#define LIBEWF_DLL_IMPORT
-#endif
-
-#include <libewf.h>
-
-#include <libsystem.h>
-
-#include "alteration_handle.h"
-#include "storage_media_buffer.h"
-
-/* Initializes the alteration handle
- * Returns 1 if successful or -1 on error
- */
-int alteration_handle_initialize(
-     alteration_handle_t **alteration_handle,
-     liberror_error_t **error )
-{
-	static char *function = "alteration_handle_initialize";
-
-	if( alteration_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid alteration handle.",
-		 function );
-
-		return( -1 );
-	}
-	if( *alteration_handle == NULL )
-	{
-		*alteration_handle = (alteration_handle_t *) memory_allocate(
-		                                              sizeof( alteration_handle_t ) );
-
-		if( *alteration_handle == NULL )
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_MEMORY,
-			 LIBERROR_MEMORY_ERROR_INSUFFICIENT,
-			 "%s: unable to create alteration handle.",
-			 function );
-
-			return( -1 );
-		}
-		if( memory_set(
-		     *alteration_handle,
-		     0,
-		     sizeof( alteration_handle_t ) ) == NULL )
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_MEMORY,
-			 LIBERROR_MEMORY_ERROR_SET_FAILED,
-			 "%s: unable to clear alteration handle.",
-			 function );
-
-			memory_free(
-			 *alteration_handle );
-
-			*alteration_handle = NULL;
-
-			return( -1 );
-		}
-#if defined( HAVE_V2_API )
-		if( libewf_handle_initialize(
-		     &( ( *alteration_handle )->input_handle ),
-		     error ) != 1 )
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_RUNTIME,
-			 LIBERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
-			 "%s: unable to initialize input handle.",
-			 function );
-
-			memory_free(
-			 *alteration_handle );
-
-			*alteration_handle = NULL;
-
-			return( -1 );
-		}
-#endif
-	}
-	return( 1 );
-}
-
-/* Frees the alteration handle and its elements
- * Returns 1 if successful or -1 on error
- */
-int alteration_handle_free(
-     alteration_handle_t **alteration_handle,
-     liberror_error_t **error )
-{
-	static char *function = "alteration_handle_free";
-	int result            = 1;
-
-	if( alteration_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid alteration handle.",
-		 function );
-
-		return( -1 );
-	}
-	if( *alteration_handle != NULL )
-	{
-#if defined( HAVE_V2_API )
-		if( ( ( *alteration_handle )->input_handle != NULL )
-		 && ( libewf_handle_free(
-		       &( ( *alteration_handle )->input_handle ),
-		       error ) != 1 ) )
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_RUNTIME,
-			 LIBERROR_RUNTIME_ERROR_FINALIZE_FAILED,
-			 "%s: unable to free input handle.",
-			 function );
-
-			result = -1;
-		}
-#endif
-		memory_free(
-		 *alteration_handle );
-
-		*alteration_handle = NULL;
-	}
-	return( result );
-}
-
-/* Signals the alteration handle to abort
- * Returns 1 if successful or -1 on error
- */
-int alteration_handle_signal_abort(
-     alteration_handle_t *alteration_handle,
-     liberror_error_t **error )
-{
-	static char *function = "alteration_handle_signal_abort";
-
-	if( alteration_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid alteration handle.",
-		 function );
-
-		return( -1 );
-	}
-	if( alteration_handle->input_handle != NULL )
-	{
-#if defined( HAVE_V2_API )
-		if( libewf_handle_signal_abort(
-		     alteration_handle->input_handle,
-		     error ) != 1 )
-#else
-		if( libewf_signal_abort(
-		     alteration_handle->input_handle ) != 1 )
-#endif
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_RUNTIME,
-			 LIBERROR_RUNTIME_ERROR_SET_FAILED,
-			 "%s: unable to signal input handle to abort.",
-			 function );
-
-			return( -1 );
-		}
-	}
-	return( 1 );
-}
-
-/* Opens the input of the alteration handle
- * Returns 1 if successful or -1 on error
- */
-int alteration_handle_open_input(
-     alteration_handle_t *alteration_handle,
-     libsystem_character_t * const * filenames,
-     int amount_of_filenames,
-     liberror_error_t **error )
-{
-	libsystem_character_t **libewf_filenames = NULL;
-	static char *function                    = "alteration_handle_open_input";
-	size_t first_filename_length             = 0;
-	int result                               = 1;
-
-	if( alteration_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid alteration handle.",
-		 function );
-
-		return( -1 );
-	}
-#if defined( HAVE_V2_API )
-	if( alteration_handle->input_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
-		 "%s: invalid alteration handle - missing input handle.",
-		 function );
-
-		return( -1 );
-	}
-#else
-	if( alteration_handle->input_handle != NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
-		 "%s: invalid alteration handle - input handle already set.",
-		 function );
-
-		return( -1 );
-	}
-#endif
-	if( filenames == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid filenames.",
-		 function );
-
-		return( -1 );
-	}
-	if( amount_of_filenames <= 0 )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS,
-		 "%s: invalid amount of filenames.",
-		 function );
-
-		return( -1 );
-	}
-	if( amount_of_filenames == 1 )
-	{
-		first_filename_length = libsystem_string_length(
-		                         filenames[ 0 ]);
-
-#if defined( LIBSYSTEM_HAVE_WIDE_CHARACTER )
-#if defined( HAVE_V2_API )
-		if( libewf_glob_wide(
-		     filenames[ 0 ],
-		     first_filename_length,
-		     LIBEWF_FORMAT_UNKNOWN,
-		     &libewf_filenames,
-		     &amount_of_filenames,
-		     error ) != 1 )
-#else
-		amount_of_filenames = libewf_glob_wide(
-		                       filenames[ 0 ],
-		                       first_filename_length,
-		                       LIBEWF_FORMAT_UNKNOWN,
-		                       &libewf_filenames );
-
-		if( amount_of_filenames <= 0 )
-#endif
-#else
-#if defined( HAVE_V2_API )
-		if( libewf_glob(
-		     filenames[ 0 ],
-		     first_filename_length,
-		     LIBEWF_FORMAT_UNKNOWN,
-		     &libewf_filenames,
-		     &amount_of_filenames,
-		     error ) != 1 )
-#else
-		amount_of_filenames = libewf_glob(
-		                       filenames[ 0 ],
-		                       first_filename_length,
-		                       LIBEWF_FORMAT_UNKNOWN,
-		                       &libewf_filenames );
-
-		if( amount_of_filenames <= 0 )
-#endif
-#endif
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_RUNTIME,
-			 LIBERROR_RUNTIME_ERROR_GET_FAILED,
-			 "%s: unable to resolve filename(s).",
-			 function );
-
-			return( -1 );
-		}
-		filenames = (libsystem_character_t * const *) libewf_filenames;
-	}
-#if defined( LIBSYSTEM_HAVE_WIDE_CHARACTER )
-#if defined( HAVE_V2_API )
-	if( libewf_handle_open_wide(
-	     alteration_handle->input_handle,
-	     filenames,
-	     amount_of_filenames,
-	     LIBEWF_OPEN_READ_WRITE,
-	     error ) != 1 )
-#else
-	alteration_handle->input_handle = libewf_open_wide(
-	                                   filenames,
-	                                   amount_of_filenames,
-	                                   LIBEWF_OPEN_READ_WRITE );
-
-	if( alteration_handle->input_handle == NULL )
-#endif
-#else
-#if defined( HAVE_V2_API )
-	if( libewf_handle_open(
-	     alteration_handle->input_handle,
-	     filenames,
-	     amount_of_filenames,
-	     LIBEWF_OPEN_READ_WRITE,
-	     error ) != 1 )
-#else
-	alteration_handle->input_handle = libewf_open(
-	                                   filenames,
-	                                   amount_of_filenames,
-	                                   LIBEWF_OPEN_READ_WRITE );
-
-	if( alteration_handle->input_handle == NULL )
-#endif
-#endif
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_IO,
-		 LIBERROR_IO_ERROR_OPEN_FAILED,
-		 "%s: unable to open files.",
-		 function );
-
-		result = -1;
-	}
-	if( libewf_filenames != NULL )
-	{
-		for( ; amount_of_filenames > 0; amount_of_filenames-- )
-		{
-			memory_free(
-			 libewf_filenames[ amount_of_filenames - 1 ] );
-		}
-		memory_free(
-		 libewf_filenames );
-	}
-	return( result );
-}
-
-/* Closes the alteration handle
- * Returns the 0 if succesful or -1 on error
- */
-int alteration_handle_close(
-     alteration_handle_t *alteration_handle,
-     liberror_error_t **error )
-{
-	static char *function = "alteration_handle_close";
-
-	if( alteration_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid alteration handle.",
-		 function );
-
-		return( -1 );
-	}
-	if( alteration_handle->input_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
-		 "%s: invalid alteration handle - missing input handle.",
-		 function );
-
-		return( -1 );
-	}
-#if defined( HAVE_V2_API )
-	if( libewf_handle_close(
-	     alteration_handle->input_handle,
-	     error ) != 0 )
-#else
-	if( libewf_close(
-	     alteration_handle->input_handle ) != 0 )
-#endif
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_IO,
-		 LIBERROR_IO_ERROR_CLOSE_FAILED,
-		 "%s: unable to close input handle.",
-		 function );
-
-		return( -1 );
-	}
-#if !defined( HAVE_V2_API )
-	alteration_handle->input_handle = NULL;
-#endif
-	return( 0 );
-}
-
-#if defined( HAVE_LOW_LEVEL_FUNCTIONS )
-
-/* Prepares a buffer after reading the input of the alteration handle
- * Returns the resulting buffer size or -1 on error
- */
-ssize_t alteration_handle_prepare_read_buffer(
-         alteration_handle_t *alteration_handle,
-         storage_media_buffer_t *storage_media_buffer,
-         liberror_error_t **error )
-{
-	static char *function = "alteration_handle_prepare_read_buffer";
-	ssize_t process_count = 0;
-
-	if( alteration_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid alteration handle.",
-		 function );
-
-		return( -1 );
-	}
-	if( alteration_handle->input_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
-		 "%s: invalid alteration handle - missing input handle.",
-		 function );
-
-		return( -1 );
-	}
-	if( storage_media_buffer == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid storage media buffer.",
-		 function );
-
-		return( -1 );
-	}
-	storage_media_buffer->raw_buffer_amount = storage_media_buffer->raw_buffer_size;
-
-#if defined( HAVE_V2_API )
-	process_count = libewf_handle_prepare_read_chunk(
-	                 alteration_handle->input_handle,
-	                 storage_media_buffer->compression_buffer,
-	                 storage_media_buffer->compression_buffer_amount,
-	                 storage_media_buffer->raw_buffer,
-	                 (size_t *) &( storage_media_buffer->raw_buffer_amount ),
-	                 storage_media_buffer->is_compressed,
-	                 storage_media_buffer->crc,
-	                 storage_media_buffer->process_crc,
-	                 error );
-#else
-	process_count = libewf_raw_read_prepare_buffer(
-	                 alteration_handle->input_handle,
-	                 storage_media_buffer->compression_buffer,
-	                 storage_media_buffer->compression_buffer_amount,
-	                 storage_media_buffer->raw_buffer,
-	                 (size_t *) &( storage_media_buffer->raw_buffer_amount ),
-	                 storage_media_buffer->is_compressed,
-	                 storage_media_buffer->crc,
-	                 storage_media_buffer->process_crc );
-#endif
-
-	if( process_count == -1 )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_IO,
-		 LIBERROR_IO_ERROR_READ_FAILED,
-		 "%s: unable to prepare storage media buffer after reading.",
-		 function );
-
-		return( -1 );
-	}
-	if( storage_media_buffer->is_compressed == 0 )
-	{
-		storage_media_buffer->data_in_compression_buffer = 1;
-	}
-	else
-	{
-		storage_media_buffer->data_in_compression_buffer = 0;
-	}
-	return( process_count );
-}
-
-/* Reads a buffer from the input of the alteration handle
- * Returns the amount of bytes written or -1 on error
- */
-ssize_t alteration_handle_read_buffer(
-         alteration_handle_t *alteration_handle,
-         storage_media_buffer_t *storage_media_buffer,
-         size_t read_size,
-         liberror_error_t **error )
-{
-	static char *function = "alteration_handle_read_buffer";
-	ssize_t read_count    = 0;
-
-	if( alteration_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid alteration handle.",
-		 function );
-
-		return( -1 );
-	}
-	if( alteration_handle->input_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
-		 "%s: invalid alteration handle - missing input handle.",
-		 function );
-
-		return( -1 );
-	}
-	if( storage_media_buffer == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid storage media buffer.",
-		 function );
-
-		return( -1 );
-	}
-#if defined( HAVE_V2_API )
-	read_count = libewf_handle_read_chunk(
-                      alteration_handle->input_handle,
-                      storage_media_buffer->compression_buffer,
-                      storage_media_buffer->compression_buffer_size,
-	              &( storage_media_buffer->is_compressed ),
-	              &( storage_media_buffer->compression_buffer[ storage_media_buffer->raw_buffer_size ] ),
-	              &( storage_media_buffer->crc ),
-	              &( storage_media_buffer->process_crc ),
-	              error );
-#else
-	read_count = libewf_raw_read_buffer(
-	              alteration_handle->input_handle,
-	              storage_media_buffer->compression_buffer,
-	              storage_media_buffer->compression_buffer_size,
-	              &( storage_media_buffer->is_compressed ),
-	              &( storage_media_buffer->crc ),
-	              &( storage_media_buffer->process_crc ) );
-#endif
-	if( read_count == -1 )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_IO,
-		 LIBERROR_IO_ERROR_READ_FAILED,
-		 "%s: unable to read storage media buffer.",
-		 function );
-
-		return( -1 );
-	}
-	storage_media_buffer->compression_buffer_amount = read_count;
-
-	return( read_count );
-}
-
-#endif
-
-/* Prepares a buffer before writing the output of the alteration handle
- * Returns the resulting buffer size or -1 on error
- */
-ssize_t alteration_handle_prepare_write_buffer(
-         alteration_handle_t *alteration_handle,
-         storage_media_buffer_t *storage_media_buffer,
-         liberror_error_t **error )
-{
-	static char *function = "alteration_handle_prepare_write_buffer";
-	ssize_t process_count = 0;
-
-	if( alteration_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid alteration handle.",
-		 function );
-
-		return( -1 );
-	}
-	if( alteration_handle->input_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
-		 "%s: invalid alteration handle - missing input handle.",
-		 function );
-
-		return( -1 );
-	}
-	if( storage_media_buffer == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid storage media buffer.",
-		 function );
-
-		return( -1 );
-	}
-#if defined( HAVE_LOW_LEVEL_FUNCTIONS )
-	storage_media_buffer->compression_buffer_amount = storage_media_buffer->compression_buffer_size;
-
-#if defined( HAVE_V2_API )
-	process_count = libewf_handle_prepare_write_chunk(
-	                 alteration_handle->input_handle,
-	                 storage_media_buffer->raw_buffer,
-	                 storage_media_buffer->raw_buffer_amount,
-	                 storage_media_buffer->compression_buffer,
-	                 (size_t *) &( storage_media_buffer->compression_buffer_amount ),
-	                 &( storage_media_buffer->is_compressed ),
-	                 &( storage_media_buffer->crc ),
-	                 &( storage_media_buffer->process_crc ),
-	                 error );
-#else
-	process_count = libewf_raw_write_prepare_buffer(
-	                 alteration_handle->input_handle,
-	                 storage_media_buffer->raw_buffer,
-	                 storage_media_buffer->raw_buffer_amount,
-	                 storage_media_buffer->compression_buffer,
-	                 (size_t *) &( storage_media_buffer->compression_buffer_amount ),
-	                 &( storage_media_buffer->is_compressed ),
-	                 &( storage_media_buffer->crc ),
-	                 &( storage_media_buffer->process_crc ) );
-#endif
-
-	if( process_count == -1 )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_SET_FAILED,
-		 "%s: unable to prepare storage media buffer before writing.",
-		 function );
-
-		return( -1 );
-	}
-#else
-	process_count = storage_media_buffer->raw_buffer_amount;
-#endif
-
-	return( process_count );
-}
-
-/* Writes a buffer to the output of the alteration handle
- * Returns the amount of bytes written or -1 on error
- */
-ssize_t alteration_handle_write_buffer(
-         alteration_handle_t *alteration_handle,
-         storage_media_buffer_t *storage_media_buffer,
-         size_t write_size,
-         liberror_error_t **error )
-{
-	static char *function        = "alteration_handle_write_buffer";
-	ssize_t write_count          = 0;
-
-#if defined( HAVE_LOW_LEVEL_FUNCTIONS )
-	uint8_t *raw_write_buffer    = NULL;
-	size_t raw_write_buffer_size = 0;
-#endif
-
-	if( alteration_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid alteration handle.",
-		 function );
-
-		return( -1 );
-	}
-	if( alteration_handle->input_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
-		 "%s: invalid alteration handle - missing input handle.",
-		 function );
-
-		return( -1 );
-	}
-	if( storage_media_buffer == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid storage media buffer.",
-		 function );
-
-		return( -1 );
-	}
-	if( write_size == 0 )
-	{
-		return( 0 );
-	}
-#if defined( HAVE_LOW_LEVEL_FUNCTIONS )
-	if( storage_media_buffer->is_compressed == 0 )
-	{
-		raw_write_buffer      = storage_media_buffer->raw_buffer;
-		raw_write_buffer_size = storage_media_buffer->raw_buffer_amount;
-	}
-	else
-	{
-		raw_write_buffer      = storage_media_buffer->compression_buffer;
-		raw_write_buffer_size = storage_media_buffer->compression_buffer_amount;
-	}
-	if( write_size != raw_write_buffer_size )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_VALUE_OUT_OF_RANGE,
-		 "%s: mismatch in write size and amount of bytes in storage media buffer.",
-		 function );
-
-		return( -1 );
-	}
-#if defined( HAVE_V2_API )
-	write_count = libewf_handle_write_chunk(
-	               alteration_handle->input_handle,
-	               raw_write_buffer,
-	               raw_write_buffer_size,
-	               storage_media_buffer->raw_buffer_amount,
-	               storage_media_buffer->is_compressed,
-	               storage_media_buffer->crc_buffer,
-	               storage_media_buffer->crc,
-	               storage_media_buffer->process_crc,
-	               error );
-#else
-	write_count = libewf_raw_write_buffer(
-	               alteration_handle->input_handle,
-	               raw_write_buffer,
-	               raw_write_buffer_size,
-	               storage_media_buffer->raw_buffer_amount,
-	               storage_media_buffer->is_compressed,
-	               storage_media_buffer->crc,
-	               storage_media_buffer->process_crc );
-#endif
-#else
-#if defined( HAVE_V2_API )
-	write_count = libewf_handle_write_buffer(
-	               alteration_handle->input_handle,
-	               storage_media_buffer->raw_buffer,
-	               write_size,
-	               error );
-#else
-	write_count = libewf_write_buffer(
-	               alteration_handle->input_handle,
-	               storage_media_buffer->raw_buffer,
-	               write_size );
-#endif
-#endif
-	if( write_count == -1 )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_IO,
-		 LIBERROR_IO_ERROR_READ_FAILED,
-		 "%s: unable to write storage media buffer.",
-		 function );
-
-		return( -1 );
-	}
-	return( write_count );
-}
-
-/* Seeks the offset in the input file
- * Returns the new offset if successful or -1 on error
- */
-off64_t alteration_handle_seek_offset(
-         alteration_handle_t *alteration_handle,
-         off64_t offset,
-         liberror_error_t **error )
-{
-	static char *function = "alteration_handle_seek_offset";
-
-	if( alteration_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid alteration handle.",
-		 function );
-
-		return( -1 );
-	}
-	if( alteration_handle->input_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
-		 "%s: invalid alteration handle - missing input handle.",
-		 function );
-
-		return( -1 );
-	}
-#if defined( HAVE_V2_API )
-	offset = libewf_handle_seek_offset(
-	          alteration_handle->input_handle,
-	          offset,
-	          SEEK_SET,
-	          error );
-#else
-	offset = libewf_seek_offset(
-	          alteration_handle->input_handle,
-	          offset );
-#endif
-
-	if( offset == -1 )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_IO,
-		 LIBERROR_IO_ERROR_SEEK_FAILED,
-		 "%s: unable to seek offset in input handle.",
-		 function );
-
-		return( -1 );
-	}
-	return( offset );
-}
-
-/* Retrieves the media size
- * Returns 1 if successful or -1 on error
- */
-int alteration_handle_get_media_size(
-     alteration_handle_t *alteration_handle,
-     size64_t *media_size,
-     liberror_error_t **error )
-{
-	static char *function = "alteration_handle_get_media_size";
-
-	if( alteration_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid alteration handle.",
-		 function );
-
-		return( -1 );
-	}
-	if( alteration_handle->input_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
-		 "%s: invalid alteration handle - missing input handle.",
-		 function );
-
-		return( -1 );
-	}
-	if( media_size == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid media size.",
-		 function );
-
-		return( -1 );
-	}
-#if defined( HAVE_V2_API )
-	if( libewf_handle_get_media_size(
-	     alteration_handle->input_handle,
-	     media_size,
-	     error ) != 1 )
-#else
-	if( libewf_get_media_size(
-	     alteration_handle->input_handle,
-	     media_size ) != 1 )
-#endif
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_GET_FAILED,
-		 "%s: unable to retrieve media size.",
-		 function );
-
-		return( -1 );
-	}
-	return( 1 );
-}
-
-/* Retrieves the chunk size
- * Returns 1 if successful or -1 on error
- */
-int alteration_handle_get_chunk_size(
-     alteration_handle_t *alteration_handle,
-     size32_t *chunk_size,
-     liberror_error_t **error )
-{
-	static char *function = "alteration_handle_get_chunk_size";
-
-	if( alteration_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid alteration handle.",
-		 function );
-
-		return( -1 );
-	}
-	if( alteration_handle->input_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
-		 "%s: invalid alteration handle - missing input handle.",
-		 function );
-
-		return( -1 );
-	}
-	if( chunk_size == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid chunk size.",
-		 function );
-
-		return( -1 );
-	}
-#if defined( HAVE_V2_API )
-	if( libewf_handle_get_chunk_size(
-	     alteration_handle->input_handle,
-	     chunk_size,
-	     error ) != 1 )
-#else
-	if( libewf_get_chunk_size(
-	     alteration_handle->input_handle,
-	     chunk_size ) != 1 )
-#endif
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_GET_FAILED,
-		 "%s: unable to retrieve chunk size.",
-		 function );
-
-		return( -1 );
-	}
-	return( 1 );
-}
-
-/* Sets the header codepage
- * Returns 1 if successful or -1 on error
- */
-int alteration_handle_set_header_codepage(
-     alteration_handle_t *alteration_handle,
-     int header_codepage,
-     liberror_error_t **error )
-{
-	static char *function = "alteration_handle_set_header_codepage";
-
-	if( alteration_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid alteration handle.",
-		 function );
-
-		return( -1 );
-	}
-	if( alteration_handle->input_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
-		 "%s: invalid alteration handle - missing input handle.",
-		 function );
-
-		return( -1 );
-	}
-#if defined( HAVE_V2_API )
-	if( libewf_handle_set_header_codepage(
-	     alteration_handle->input_handle,
-	     header_codepage,
-	     error ) != 1 )
-#else
-	if( libewf_set_header_codepage(
-	     alteration_handle->input_handle,
-	     header_codepage ) != 1 )
-#endif
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_SET_FAILED,
-		 "%s: unable to set header codepage.",
-		 function );
-
-		return( -1 );
-	}
-	return( 1 );
-}
-
-/* Sets the output values of the alteration handle
- * Returns 1 if successful or -1 on error
- */
-int alteration_handle_set_output_values(
-     alteration_handle_t *alteration_handle,
-     libsystem_character_t *delta_segment_filename,
-     size_t delta_segment_filename_length,
-     liberror_error_t **error )
-{
-	static char *function = "alteration_handle_set_output_values";
-
-	if( alteration_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid alteration handle.",
-		 function );
-
-		return( -1 );
-	}
-	if( alteration_handle->input_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
-		 "%s: invalid alteration handle - missing input handle.",
-		 function );
-
-		return( -1 );
-	}
-#if defined( LIBSYSTEM_HAVE_WIDE_CHARACTER )
-#if defined( HAVE_V2_API )
-	if( libewf_handle_set_delta_segment_filename_wide(
-	     alteration_handle->input_handle,
-	     delta_segment_filename,
-	     delta_segment_filename_length,
-	     error ) != 1 )
-#else
-	if( libewf_set_delta_segment_filename_wide(
-	     alteration_handle->input_handle,
-	     delta_segment_filename,
-	     delta_segment_filename_length ) != 1 )
-#endif
-#else
-#if defined( HAVE_V2_API )
-	if( libewf_handle_set_delta_segment_filename(
-	     alteration_handle->input_handle,
-	     delta_segment_filename,
-	     delta_segment_filename_length,
-	     error ) != 1 )
-#else
-	if( libewf_set_delta_segment_filename(
-	     alteration_handle->input_handle,
-	     delta_segment_filename,
-	     delta_segment_filename_length ) != 1 )
-#endif
-#endif
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_SET_FAILED,
-		 "%s: unable to set delta segment filename.",
-		 function );
-
-		return( -1 );
-	}
-	return( 1 );
-}
-
diff --git a/ewftools/alteration_handle.h b/ewftools/alteration_handle.h
deleted file mode 100644
index 34c7eec..0000000
--- a/ewftools/alteration_handle.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* 
- * Alteration handle
- *
- * Copyright (C) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
- *
- * Refer to AUTHORS for acknowledgements.
- *
- * This software is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this software.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#if !defined( _ALTERATION_HANDLE_H )
-#define _ALTERATION_HANDLE_H
-
-#include <common.h>
-#include <types.h>
-
-#include <liberror.h>
-
-/* If libtool DLL support is enabled set LIBEWF_DLL_IMPORT
- * before including libewf.h
- */
-#if defined( _WIN32 ) && defined( DLL_EXPORT )
-#define LIBEWF_DLL_IMPORT
-#endif
-
-#include <libewf.h>
-
-#include <libsystem.h>
-
-#include "storage_media_buffer.h"
-
-#if defined( __cplusplus )
-extern "C" {
-#endif
-
-typedef struct alteration_handle alteration_handle_t;
-
-struct alteration_handle
-{
-	/* The libewf input handle
-	 */
-	libewf_handle_t *input_handle;
-};
-
-int alteration_handle_initialize(
-     alteration_handle_t **alteration_handle,
-     liberror_error_t **error );
-
-int alteration_handle_free(
-     alteration_handle_t **alteration_handle,
-     liberror_error_t **error );
-
-int alteration_handle_signal_abort(
-     alteration_handle_t *alteration_handle,
-     liberror_error_t **error );
-
-int alteration_handle_open_input(
-     alteration_handle_t *alteration_handle,
-     libsystem_character_t * const * filenames,
-     int amount_of_filenames,
-     liberror_error_t **error );
-
-int alteration_handle_close(
-     alteration_handle_t *alteration_handle,
-     liberror_error_t **error );
-
-#if defined( HAVE_LOW_LEVEL_FUNCTIONS )
-ssize_t alteration_handle_prepare_read_buffer(
-         alteration_handle_t *alteration_handle,
-         storage_media_buffer_t *storage_media_buffer,
-         liberror_error_t **error );
-
-ssize_t alteration_handle_read_buffer(
-         alteration_handle_t *alteration_handle,
-         storage_media_buffer_t *storage_media_buffer,
-         size_t read_size,
-         liberror_error_t **error );
-#endif
-
-ssize_t alteration_handle_prepare_write_buffer(
-         alteration_handle_t *alteration_handle,
-         storage_media_buffer_t *storage_media_buffer,
-         liberror_error_t **error );
-
-ssize_t alteration_handle_write_buffer(
-         alteration_handle_t *alteration_handle,
-         storage_media_buffer_t *storage_media_buffer,
-         size_t write_size,
-         liberror_error_t **error );
-
-off64_t alteration_handle_seek_offset(
-         alteration_handle_t *alteration_handle,
-         off64_t offset,
-         liberror_error_t **error );
-
-int alteration_handle_get_media_size(
-     alteration_handle_t *alteration_handle,
-     size64_t *media_size,
-     liberror_error_t **error );
-
-int alteration_handle_get_chunk_size(
-     alteration_handle_t *alteration_handle,
-     size32_t *chunk_size,
-     liberror_error_t **error );
-
-int alteration_handle_set_header_codepage(
-     alteration_handle_t *alteration_handle,
-     int header_codepage,
-     liberror_error_t **error );
-
-int alteration_handle_set_output_values(
-     alteration_handle_t *alteration_handle,
-     libsystem_character_t *delta_segment_filename,
-     size_t delta_segment_filename_length,
-     liberror_error_t **error );
-
-#if defined( __cplusplus )
-}
-#endif
-
-#endif
-
diff --git a/ewftools/byte_size_string.c b/ewftools/byte_size_string.c
index fe732e6..b4d8d99 100644
--- a/ewftools/byte_size_string.c
+++ b/ewftools/byte_size_string.c
@@ -2,7 +2,7 @@
  * Byte size string functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/byte_size_string.h b/ewftools/byte_size_string.h
index 12f1c9f..4bfdefe 100644
--- a/ewftools/byte_size_string.h
+++ b/ewftools/byte_size_string.h
@@ -2,7 +2,7 @@
  * Byte size string functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/device_handle.c b/ewftools/device_handle.c
index c996b27..04abd1f 100644
--- a/ewftools/device_handle.c
+++ b/ewftools/device_handle.c
@@ -2,7 +2,7 @@
  * Device handle
  *
  * Copyright (C) 2007-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -433,6 +433,26 @@ int device_handle_open_input(
 
 		return( -1 );
 	}
+#if defined( HAVE_POSIX_FADVISE )
+	/* Use this function to double the read-ahead system buffer
+	 * This provides for some additional performance
+	 */
+	if( posix_fadvise(
+	     device_handle->file_descriptor,
+	     0,
+	     0,
+	     POSIX_FADV_SEQUENTIAL ) != 0 )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_IO,
+		 LIBERROR_IO_ERROR_GENERIC,
+		 "%s: unable to advice file handle.",
+		 function );
+
+		return( -1 );
+	}
+#endif
 	if( fstat(
 	     device_handle->file_descriptor,
 	     &file_stat ) != 0 )
diff --git a/ewftools/device_handle.h b/ewftools/device_handle.h
index 978357d..ee6849e 100644
--- a/ewftools/device_handle.h
+++ b/ewftools/device_handle.h
@@ -2,7 +2,7 @@
  * Device handle
  *
  * Copyright (C) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/digest_context.c b/ewftools/digest_context.c
index 98f5dfc..d920121 100644
--- a/ewftools/digest_context.c
+++ b/ewftools/digest_context.c
@@ -2,7 +2,7 @@
  * Crypographic digest context
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/digest_context.h b/ewftools/digest_context.h
index 3f74bd4..88512a2 100644
--- a/ewftools/digest_context.h
+++ b/ewftools/digest_context.h
@@ -2,7 +2,7 @@
  * Crypographic digest context
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/digest_hash.c b/ewftools/digest_hash.c
index f60ba47..3ddbbc1 100644
--- a/ewftools/digest_hash.c
+++ b/ewftools/digest_hash.c
@@ -2,7 +2,7 @@
  * Crypographic digest hash
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/digest_hash.h b/ewftools/digest_hash.h
index 153f54b..af0b812 100644
--- a/ewftools/digest_hash.h
+++ b/ewftools/digest_hash.h
@@ -2,7 +2,7 @@
  * Crypographic digest hash
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/ewfacquire.c b/ewftools/ewfacquire.c
index d449cad..0b205fc 100644
--- a/ewftools/ewfacquire.c
+++ b/ewftools/ewfacquire.c
@@ -3,7 +3,7 @@
  * Reads data from a file or device and writes it in EWF format
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -122,8 +122,8 @@ void usage_fprint(
 
 	fprintf( stream, "\tsource: the source file or device\n\n" );
 
-	fprintf( stream, "\t-A:     codepage of header section, options: ascii (default), windows-1250,\n"
-	                 "\t        windows-1251, windows-1252, windows-1253, windows-1254,\n"
+	fprintf( stream, "\t-A:     codepage of header section, options: ascii (default), windows-874,\n"
+	                 "\t        windows-1250, windows-1251, windows-1252, windows-1253, windows-1254,\n"
 	                 "\t        windows-1255, windows-1256, windows-1257, windows-1258\n" );
 	fprintf( stream, "\t-b:     specify the amount of sectors to read at once (per chunk), options:\n"
 	                 "\t        64 (default), 128, 256, 512, 1024, 2048, 4096, 8192, 16384 or 32768\n" );
diff --git a/ewftools/ewfacquirestream.c b/ewftools/ewfacquirestream.c
index d696c6e..3dc426a 100644
--- a/ewftools/ewfacquirestream.c
+++ b/ewftools/ewfacquirestream.c
@@ -3,7 +3,7 @@
  * Reads data from a stdin and writes it in EWF format
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -121,8 +121,8 @@ void usage_fprint(
 
 	fprintf( stream, "\tReads data from stdin\n\n" );
 
-	fprintf( stream, "\t-A: codepage of header section, options: ascii (default), windows-1250,\n"
-	                 "\t    windows-1251, windows-1252, windows-1253, windows-1254,\n"
+	fprintf( stream, "\t-A: codepage of header section, options: ascii (default), windows-874,\n"
+	                 "\t    windows-1250, windows-1251, windows-1252, windows-1253, windows-1254,\n"
 	                 "\t    windows-1255, windows-1256, windows-1257, windows-1258\n" );
 	fprintf( stream, "\t-b: specify the amount of sectors to read at once (per chunk), options:\n"
 	                 "\t    64 (default), 128, 256, 512, 1024, 2048, 4096, 8192, 16384 or 32768\n" );
@@ -135,7 +135,7 @@ void usage_fprint(
 	fprintf( stream, "\t-e: specify the examiner name (default is examiner_name).\n" );
 	fprintf( stream, "\t-E: specify the evidence number (default is evidence_number).\n" );
 	fprintf( stream, "\t-f: specify the EWF file format to write to, options: ftk, encase2, encase3,\n"
-	                 "\t    encase4, encase5 (default), encase6, linen5, linen6, ewfx\n" );
+	                 "\t    encase4, encase5, encase6 (default), linen5, linen6, ewfx\n" );
 	fprintf( stream, "\t-h: shows this help\n" );
 	fprintf( stream, "\t-l: logs acquiry errors and the digest (hash) to the log_filename\n" );
 	fprintf( stream, "\t-m: specify the media type, options: fixed (default), removable, optical, memory\n" );
@@ -171,7 +171,7 @@ void usage_fprint(
 	fprintf( stream, "\t-v: verbose output to stderr\n" );
 	fprintf( stream, "\t-V: print version\n" );
 	fprintf( stream, "\t-w: wipe sectors on read error (mimic EnCase like behavior)\n" );
-	fprintf( stream, "\t-2:     specify the secondary target file (without extension) to write to\n" );
+	fprintf( stream, "\t-2: specify the secondary target file (without extension) to write to\n" );
 }
 
 /* Prints an overview of the aquiry parameters
@@ -1259,6 +1259,11 @@ int main( int argc, char * const argv[] )
 	FILE *log_file_stream                              = NULL;
 
 	libsystem_integer_t option                         = 0;
+	size_t case_number_length                          = 0;
+	size_t description_length                          = 0;
+	size_t evidence_number_length                      = 0;
+	size_t examiner_name_length                        = 0;
+	size_t notes_length                                = 0;
 	size_t string_length                               = 0;
 	int64_t write_count                                = 0;
 	uint64_t acquiry_offset                            = 0;
@@ -1690,13 +1695,13 @@ int main( int argc, char * const argv[] )
 
 	if( option_case_number != NULL )
 	{
-		string_length = libsystem_string_length(
-		                 option_case_number );
+		case_number_length = libsystem_string_length(
+		                      option_case_number );
 
-		if( string_length > 0 )
+		if( case_number_length > 0 )
 		{
 			case_number = (libsystem_character_t *) memory_allocate(
-			                                         sizeof( libsystem_character_t ) * ( string_length + 1 ) );
+			                                         sizeof( libsystem_character_t ) * ( case_number_length + 1 ) );
 
 			if( case_number == NULL )
 			{
@@ -1709,7 +1714,7 @@ int main( int argc, char * const argv[] )
 			else if( libsystem_string_copy(
 			          case_number,
 			          option_case_number,
-			          string_length + 1 ) == NULL )
+			          case_number_length + 1 ) == NULL )
 			{
 				fprintf(
 				 stderr,
@@ -1722,13 +1727,13 @@ int main( int argc, char * const argv[] )
 	if( ( error_abort == 0 )
 	 && ( option_description != NULL ) )
 	{
-		string_length = libsystem_string_length(
-		                 option_description );
+		description_length = libsystem_string_length(
+		                      option_description );
 
-		if( string_length > 0 )
+		if( description_length > 0 )
 		{
 			description = (libsystem_character_t *) memory_allocate(
-			                                         sizeof( libsystem_character_t ) * ( string_length + 1 ) );
+			                                         sizeof( libsystem_character_t ) * ( description_length + 1 ) );
 
 			if( description == NULL )
 			{
@@ -1741,7 +1746,7 @@ int main( int argc, char * const argv[] )
 			else if( libsystem_string_copy(
 			          description,
 			          option_description,
-			          string_length + 1 ) == NULL )
+			          description_length + 1 ) == NULL )
 			{
 				fprintf(
 				 stderr,
@@ -1754,13 +1759,13 @@ int main( int argc, char * const argv[] )
 	if( ( error_abort == 0 )
 	 && ( option_examiner_name != NULL ) )
 	{
-		string_length = libsystem_string_length(
-		                 option_examiner_name );
+		examiner_name_length = libsystem_string_length(
+		                        option_examiner_name );
 
-		if( string_length > 0 )
+		if( examiner_name_length > 0 )
 		{
 			examiner_name = (libsystem_character_t *) memory_allocate(
-			                                           sizeof( libsystem_character_t ) * ( string_length + 1 ) );
+			                                           sizeof( libsystem_character_t ) * ( examiner_name_length + 1 ) );
 
 			if( examiner_name == NULL )
 			{
@@ -1773,7 +1778,7 @@ int main( int argc, char * const argv[] )
 			else if( libsystem_string_copy(
 			          examiner_name,
 			          option_examiner_name,
-			          string_length + 1 ) == NULL )
+			          examiner_name_length + 1 ) == NULL )
 			{
 				fprintf(
 				 stderr,
@@ -1786,13 +1791,13 @@ int main( int argc, char * const argv[] )
 	if( ( error_abort == 0 )
 	 && ( option_evidence_number != NULL ) )
 	{
-		string_length = libsystem_string_length(
-		                 option_evidence_number );
+		evidence_number_length = libsystem_string_length(
+		                          option_evidence_number );
 
-		if( string_length > 0 )
+		if( evidence_number_length > 0 )
 		{
 			evidence_number = (libsystem_character_t *) memory_allocate(
-			                                             sizeof( libsystem_character_t ) * ( string_length + 1 ) );
+			                                             sizeof( libsystem_character_t ) * ( evidence_number_length + 1 ) );
 
 			if( evidence_number == NULL )
 			{
@@ -1805,7 +1810,7 @@ int main( int argc, char * const argv[] )
 			else if( libsystem_string_copy(
 			          evidence_number,
 			          option_evidence_number,
-			          string_length + 1 ) == NULL )
+			          evidence_number_length + 1 ) == NULL )
 			{
 				fprintf(
 				 stderr,
@@ -1818,13 +1823,13 @@ int main( int argc, char * const argv[] )
 	if( ( error_abort == 0 )
 	 && ( option_notes != NULL ) )
 	{
-		string_length = libsystem_string_length(
-		                 option_notes );
+		notes_length = libsystem_string_length(
+		                option_notes );
 
-		if( string_length > 0 )
+		if( notes_length > 0 )
 		{
 			notes = (libsystem_character_t *) memory_allocate(
-			                                   sizeof( libsystem_character_t ) * ( string_length + 1 ) );
+			                                   sizeof( libsystem_character_t ) * ( notes_length + 1 ) );
 
 			if( notes == NULL )
 			{
@@ -1837,7 +1842,7 @@ int main( int argc, char * const argv[] )
 			else if( libsystem_string_copy(
 			          notes,
 			          option_notes,
-			          string_length + 1 ) == NULL )
+			          notes_length + 1 ) == NULL )
 			{
 				fprintf(
 				 stderr,
@@ -2005,20 +2010,15 @@ int main( int argc, char * const argv[] )
 		if( imaging_handle_set_output_values(
 		     ewfacquirestream_imaging_handle,
 		     case_number,
-		     libsystem_string_length(
-		      case_number ),
+		     case_number_length,
 		     description,
-		     libsystem_string_length(
-		      description ),
+		     description_length,
 		     evidence_number,
-		     libsystem_string_length(
-		      evidence_number ),
+		     evidence_number_length,
 		     examiner_name,
-		     libsystem_string_length(
-		      examiner_name ),
+		     examiner_name_length,
 		     notes,
-		     libsystem_string_length(
-		      notes ),
+		     notes_length,
 		     acquiry_operating_system,
 		     libsystem_string_length(
 		      acquiry_operating_system ),
diff --git a/ewftools/ewfalter.c b/ewftools/ewfalter.c
deleted file mode 100644
index 6648fbe..0000000
--- a/ewftools/ewfalter.c
+++ /dev/null
@@ -1,1136 +0,0 @@
-/*
- * ewfalter
- * Alters media data in EWF files
- *
- * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
- *
- * Refer to AUTHORS for acknowledgements.
- *
- * This software is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this software.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <common.h>
-#include <memory.h>
-#include <types.h>
-
-#include <liberror.h>
-
-#if defined( HAVE_STDLIB_H ) || defined( WINAPI )
-#include <stdlib.h>
-#endif
-
-/* If libtool DLL support is enabled set LIBEWF_DLL_IMPORT
- * before including libewf.h
- */
-#if defined( _WIN32 ) && defined( DLL_EXPORT )
-#define LIBEWF_DLL_IMPORT
-#endif
-
-#include <libewf.h>
-
-#include <libsystem.h>
-
-#include "alteration_handle.h"
-#include "byte_size_string.h"
-#include "ewfcommon.h"
-#include "ewfinput.h"
-#include "ewfoutput.h"
-
-#define EWFALTER_INPUT_BUFFER_SIZE	64
-
-alteration_handle_t *ewfalter_alteration_handle = NULL;
-int ewfalter_abort                              = 0;
-
-/* Prints the executable usage information to the stream
- */
-void usage_fprint(
-      FILE *stream )
-{
-        if( stream == NULL )
-        {
-                return;
-        }
-	fprintf( stream, "Use ewfalter to test the libewf delta segment file support.\n\n" );
-
-	fprintf( stream, "Usage: ewfalter [ -A codepage ] [ -p process_buffer_size ] [ -t target_file ]\n"
-	                 "                [ -hqvV ] ewf_files\n\n" );
-
-	fprintf( stream, "\tewf_files: the first or the entire set of EWF segment files\n\n" );
-
-	fprintf( stream, "\t-A:        codepage of header section, options: ascii (default), windows-1250,\n"
-	                 "\t           windows-1251, windows-1252, windows-1253, windows-1254,\n"
-	                 "\t           windows-1255, windows-1256, windows-1257, windows-1258\n" );
-	fprintf( stream, "\t-B:        specify the amount of bytes to alter (default is all bytes)\n" );
-	fprintf( stream, "\t-h:        shows this help\n" );
-	fprintf( stream, "\t-q:        quiet shows no status information\n" );
-	fprintf( stream, "\t-o:        specify the offset to start to alter (default is 0)\n" );
-	fprintf( stream, "\t-p:        specify the process buffer size (default is the chunk size)\n" );
-	fprintf( stream, "\t-t:        specify the target delta path and base filename (default is the same\n"
-	                 "\t           as the ewf_files)\n" );
-	fprintf( stream, "\t-v:        verbose output to stderr\n" );
-	fprintf( stream, "\t-V:        print version\n" );
-}
-
-/* Alters a specific size of the input starting from a specific offset 
- * Returns 1 the amount of bytes altered or -1 on error
- */
-ssize64_t ewfalter_alter_input(
-           alteration_handle_t *alteration_handle,
-           size64_t alter_size,
-           off64_t alter_offset,
-           size_t process_buffer_size,
-           liberror_error_t **error )
-{
-	storage_media_buffer_t *storage_media_buffer = NULL;
-	static char *function                        = "ewfalter_alter_input";
-	ssize64_t alter_count                        = 0;
-	size_t write_size                            = 0;
-	size_t buffer_offset                         = 0;
-	ssize_t process_count                        = 0;
-	ssize_t write_count                          = 0;
-	uint32_t chunk_size                          = 0;
-
-#if defined( HAVE_LOW_LEVEL_FUNCTIONS )
-	ssize_t read_count                           = 0;
-#endif
-
-	if( alteration_handle == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid alteration handle.",
-		 function );
-
-		return( -1 );
-	}
-	if( process_buffer_size > (size_t) SSIZE_MAX )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
-		 "%s: invalid process buffer size value exceeds maximum.",
-		 function );
-
-		return( -1 );
-	}
-	if( alteration_handle_get_chunk_size(
-	     alteration_handle,
-	     &chunk_size,
-	     error ) != 1 )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_GET_FAILED,
-		 "%s: unable to retrieve chunk size.",
-		 function );
-
-		return( -1 );
-	}
-	if( chunk_size == 0 )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_VALUE_OUT_OF_RANGE,
-		 "%s: invalid chunk size.",
-		 function );
-
-		return( -1 );
-	}
-#if defined( HAVE_LOW_LEVEL_FUNCTIONS )
-	process_buffer_size = (size_t) chunk_size;
-#else
-	if( process_buffer_size == 0 )
-	{
-		process_buffer_size = (size_t) chunk_size;
-	}
-#endif
-
-	if( storage_media_buffer_initialize(
-	     &storage_media_buffer,
-	     process_buffer_size,
-	     error ) != 1 )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
-		 "%s: unable to create storage media buffer.",
-		 function );
-
-		return( -1 );
-	}
-#if defined( HAVE_LOW_LEVEL_FUNCTIONS )
-	buffer_offset = alter_offset % process_buffer_size;
-	alter_offset  = ( alter_offset / process_buffer_size ) * process_buffer_size;
-#endif
-
-	/* Find the first alteration offset
-	 */
-	if( alteration_handle_seek_offset(
-	     alteration_handle,
-	     alter_offset,
-	     error ) == -1 )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_IO,
-		 LIBERROR_IO_ERROR_SEEK_FAILED,
-		 "%s: unable to seek alteration offset.",
-		 function );
-
-		storage_media_buffer_free(
-		 &storage_media_buffer,
-		 NULL );
-
-		return( -1 );
-	}
-	while( alter_size > 0 )
-	{
-#if defined( HAVE_LOW_LEVEL_FUNCTIONS )
-		/* Read the buffer
-		 */
-		read_count = alteration_handle_read_buffer(
-			      alteration_handle,
-			      storage_media_buffer,
-			      process_buffer_size,
-			      error );
-
-		if( read_count < 0 )
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_IO,
-			 LIBERROR_IO_ERROR_READ_FAILED,
-			"%s: unable to read data.",
-			 function );
-
-			storage_media_buffer_free(
-			 &storage_media_buffer,
-			 NULL );
-
-			return( -1 );
-		}
-		if( read_count == 0 )
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_IO,
-			 LIBERROR_IO_ERROR_READ_FAILED,
-			 "%s: unexpected end of data.",
-			 function );
-
-			storage_media_buffer_free(
-			 &storage_media_buffer,
-			 NULL );
-
-			return( -1 );
-		}
-		process_count = alteration_handle_prepare_read_buffer(
-		                 alteration_handle,
-		                 storage_media_buffer,
-		                 error );
-
-		if( process_count < 0 )
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_IO,
-			 LIBERROR_IO_ERROR_READ_FAILED,
-			"%s: unable to prepare buffer after read.",
-			 function );
-
-			storage_media_buffer_free(
-			 &storage_media_buffer,
-			 NULL );
-
-			return( -1 );
-		}
-		if( process_count > (ssize_t) process_buffer_size )
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_IO,
-			 LIBERROR_IO_ERROR_READ_FAILED,
-			 "%s: more bytes read than requested.",
-			 function );
-
-			storage_media_buffer_free(
-			 &storage_media_buffer,
-			 NULL );
-
-			return( -1 );
-		}
-		/* if the data is in compression buffer move data to raw buffer
-		 */
-		if( storage_media_buffer->data_in_compression_buffer == 1 )
-		{
-			if( memory_copy(
-			     storage_media_buffer->raw_buffer,
-			     storage_media_buffer->compression_buffer,
-			     process_count ) == NULL )
-			{
-				liberror_error_set(
-				 error,
-				 LIBERROR_ERROR_DOMAIN_MEMORY,
-				 LIBERROR_MEMORY_ERROR_INSUFFICIENT,
-				 "%s: unable to data from compression buffer to raw buffer.",
-				 function );
-
-				storage_media_buffer_free(
-				 &storage_media_buffer,
-				 NULL );
-
-				return( -1 );
-			}
-			storage_media_buffer->data_in_compression_buffer = 0;
-			storage_media_buffer->raw_buffer_amount          = process_count;
-		}
-		/* Move the file pointer back to the previous chunk
-		 */
-		if( alteration_handle_seek_offset(
-		     alteration_handle,
-		     alter_offset,
-		     error ) == -1 )
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_IO,
-			 LIBERROR_IO_ERROR_SEEK_FAILED,
-			 "%s: unable to seek alteration offset.",
-			 function );
-
-			storage_media_buffer_free(
-			 &storage_media_buffer,
-			 NULL );
-
-			return( -1 );
-		}
-#endif
-		if( alter_size > (size64_t) process_buffer_size )
-		{
-			write_size = process_buffer_size;
-		}
-		else
-		{
-			write_size = (size_t) alter_size;
-		}
-		if( ( buffer_offset + write_size ) > process_buffer_size )
-		{
-			write_size = process_buffer_size - buffer_offset;
-		}
-		alter_size -= write_size;
-
-		/* Fill the buffer with X
-		 */
-		if( memory_set(
-		     &( storage_media_buffer->raw_buffer[ buffer_offset ] ),
-		     'X',
-		     write_size ) == NULL )
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_MEMORY,
-			 LIBERROR_MEMORY_ERROR_SET_FAILED,
-			 "%s: unable to set storage media buffer.",
-			 function );
-
-			storage_media_buffer_free(
-			 &storage_media_buffer,
-			 NULL );
-
-			return( -1 );
-		}
-#if defined( HAVE_LOW_LEVEL_FUNCTIONS )
-		storage_media_buffer->raw_buffer_amount = process_buffer_size;
-#else
-		storage_media_buffer->raw_buffer_amount = write_size;
-#endif
-
-		buffer_offset = 0;
-
-		/* Write the buffer
-		 */
-		process_count = alteration_handle_prepare_write_buffer(
-		                 alteration_handle,
-		                 storage_media_buffer,
-		                 error );
-
-		if( process_count < 0 )
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_IO,
-			 LIBERROR_IO_ERROR_READ_FAILED,
-			"%s: unable to prepare buffer before write.",
-			 function );
-
-			storage_media_buffer_free(
-			 &storage_media_buffer,
-			 NULL );
-
-			return( -1 );
-		}
-		write_count = alteration_handle_write_buffer(
-		               alteration_handle,
-		               storage_media_buffer,
-		               process_count,
-		               error );
-
-		if( write_count < 0 )
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_IO,
-			 LIBERROR_IO_ERROR_WRITE_FAILED,
-			 "%s: unable to write data to file.",
-			 function );
-
-			storage_media_buffer_free(
-			 &storage_media_buffer,
-			 NULL );
-
-			return( -1 );
-		}
-#if defined( HAVE_LOW_LEVEL_FUNCTIONS )
-		alter_offset += process_buffer_size;
-#endif
-		alter_count  += write_size;
-
-		if( ewfalter_abort != 0 )
-		{
-			break;
-		}
-	}
-	if( storage_media_buffer_free(
-	     &storage_media_buffer,
-	     error ) != 1 )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_FINALIZE_FAILED,
-		 "%s: unable to free storage media buffer.",
-		 function );
-
-		return( -1 );
-	}
-	return( alter_count );
-}
-
-/* Signal handler for ewfalter
- */
-void ewfalter_signal_handler(
-      libsystem_signal_t signal )
-{
-	liberror_error_t *error = NULL;
-	static char *function   = "ewfalter_signal_handler";
-
-	ewfalter_abort = 1;
-
-	if( ( ewfalter_alteration_handle != NULL )
-	 && ( alteration_handle_signal_abort(
-	       ewfalter_alteration_handle,
-	       &error ) != 1 ) )
-	{
-		libsystem_notify_printf(
-		 "%s: unable to signal alteration handle to abort.\n",
-		 function );
-
-		libsystem_notify_print_error_backtrace(
-		 error );
-		liberror_error_free(
-		 &error );
-
-		return;
-	}
-	/* Force stdin to close otherwise any function reading it will remain blocked
-	 */
-	if( libsystem_file_io_close(
-	     0 ) != 0 )
-	{
-		libsystem_notify_printf(
-		 "%s: unable to close stdin.\n",
-		 function );
-	}
-}
-
-/* The main program
- */
-#if defined( LIBSYSTEM_HAVE_WIDE_CHARACTER )
-int wmain( int argc, wchar_t * const argv[] )
-#else
-int main( int argc, char * const argv[] )
-#endif
-{
-	libsystem_character_t input_buffer[ EWFALTER_INPUT_BUFFER_SIZE ];
-
-	alteration_handle_t *alteration_handle        = NULL;
-
-#if !defined( LIBSYSTEM_HAVE_GLOB )
-	libsystem_glob_t *glob                        = NULL;
-#endif
-
-	liberror_error_t *error                       = NULL;
-
-	libsystem_character_t * const *argv_filenames = NULL;
-
-	libsystem_character_t *program                = _LIBSYSTEM_CHARACTER_T_STRING( "ewfalter" );
-	libsystem_character_t *target_filename        = NULL;
-
-	libsystem_integer_t option                    = 0;
-	size64_t media_size                           = 0;
-	ssize64_t alter_count                         = 0;
-	size_t string_length                          = 0;
-	uint64_t alter_offset                         = 0;
-	uint64_t alter_size                           = 0;
-	uint64_t process_buffer_size                  = EWFCOMMON_PROCESS_BUFFER_SIZE;
-	uint8_t verbose                               = 0;
-	int alteration_run                            = 0;
-	int alteration_runs                           = 1;
-	int amount_of_filenames                       = 0;
-	int argument_set_offset                       = 0;
-	int argument_set_size                         = 0;
-	int header_codepage                           = LIBEWF_CODEPAGE_ASCII;
-	int result                                    = 0;
-
-	libsystem_notify_set_stream(
-	 stderr,
-	 NULL );
-	libsystem_notify_set_verbose(
-	 1 );
-
-	if( libsystem_initialize(
-	     &error ) != 1 )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to initialize system values.\n" );
-
-		libsystem_notify_print_error_backtrace(
-		 error );
-		liberror_error_free(
-		 &error );
-
-		return( EXIT_FAILURE );
-	}
-	ewfoutput_version_fprint(
-	 stdout,
-	 program );
-
-	fprintf(
-	 stdout,
-	 "%" PRIs_LIBSYSTEM " is for testing purposes only.\n",
-	 program );
-
-	while( ( option = libsystem_getopt(
-			   argc,
-			   argv,
-			   _LIBSYSTEM_CHARACTER_T_STRING( "A:B:ho:p:qt:vV" ) ) ) != (libsystem_integer_t) -1 )
-	{
-		switch( option )
-		{
-			case (libsystem_integer_t) '?':
-			default:
-				fprintf(
-				 stderr,
-				 "Invalid argument: %" PRIs_LIBSYSTEM ".\n",
-				 argv[ optind ] );
-
-				usage_fprint(
-				 stdout );
-
-				return( EXIT_FAILURE );
-
-			case (libsystem_integer_t) 'A':
-				if( ewfinput_determine_header_codepage(
-				     optarg,
-				     &header_codepage,
-				     &error ) != 1 )
-				{
-					libsystem_notify_print_error_backtrace(
-					 error );
-					liberror_error_free(
-					 &error );
-
-					fprintf(
-					 stderr,
-					 "Unsuported header codepage defaulting to: ascii.\n" );
-
-					header_codepage = LIBEWF_CODEPAGE_ASCII;
-				}
-				break;
-
-			case (libsystem_integer_t) 'B':
-				string_length = libsystem_string_length(
-				                 optarg );
-
-				if( libsystem_string_to_uint64(
-				     optarg,
-				     string_length + 1,
-				     &alter_size,
-				     &error ) != 1 )
-				{
-					alter_size = 0;
-
-					fprintf(
-					 stderr,
-					 "Unsupported alter size defaulting to: all bytes.\n" );
-
-					libsystem_notify_print_error_backtrace(
-					 error );
-					liberror_error_free(
-					 &error );
-				}
-				argument_set_size = 1;
-
-				break;
-
-			case (libsystem_integer_t) 'h':
-				usage_fprint(
-				 stdout );
-
-				return( EXIT_SUCCESS );
-
-			case (libsystem_integer_t) 'o':
-				string_length = libsystem_string_length(
-				                 optarg );
-
-				if( libsystem_string_to_uint64(
-				     optarg,
-				     string_length + 1,
-				     &alter_offset,
-				     &error ) != 1 )
-				{
-					alter_offset = 0;
-
-					fprintf(
-					 stderr,
-					 "Unsupported alter offset defaulting to: %" PRIu64 ".\n",
-					 alter_offset );
-
-					libsystem_notify_print_error_backtrace(
-					 error );
-					liberror_error_free(
-					 &error );
-				}
-				argument_set_offset = 1;
-
-				break;
-
-			case (libsystem_integer_t) 'p':
-				string_length = libsystem_string_length(
-						 optarg );
-
-				result = byte_size_string_convert(
-					  optarg,
-					  string_length,
-					  &process_buffer_size,
-					  &error );
-
-				if( result != 1 )
-				{
-					libsystem_notify_print_error_backtrace(
-					 error );
-					liberror_error_free(
-					 &error );
-				}
-				if( ( result != 1 )
-				 || ( process_buffer_size > (uint64_t) SSIZE_MAX ) )
-				{
-					process_buffer_size = 0;
-
-					fprintf(
-					 stderr,
-					 "Unsupported process buffer size defaulting to: chunk size.\n" );
-				}
-				break;
-
-			case (libsystem_integer_t) 'q':
-				break;
-
-			case (libsystem_integer_t) 't':
-				target_filename = optarg;
-
-				break;
-
-			case (libsystem_integer_t) 'v':
-				verbose = 1;
-
-				break;
-
-			case (libsystem_integer_t) 'V':
-				ewfoutput_copyright_fprint(
-				 stdout );
-
-				return( EXIT_SUCCESS );
-		}
-	}
-	if( optind == argc )
-	{
-		fprintf(
-		 stderr,
-		 "Missing EWF image file(s).\n" );
-
-		usage_fprint(
-		 stdout );
-
-		return( EXIT_FAILURE );
-	}
-	libsystem_notify_set_verbose(
-	 verbose );
-#if defined( HAVE_V2_API )
-	libewf_notify_set_verbose(
-	 verbose );
-	libewf_notify_set_stream(
-	 stderr,
-	 NULL );
-#else
-	libewf_set_notify_values(
-	 stderr,
-	 verbose );
-#endif
-
-	if( libsystem_signal_attach(
-	     ewfalter_signal_handler,
-	     &error ) != 1 )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to attach signal handler.\n" );
-
-		libsystem_notify_print_error_backtrace(
-		 error );
-		liberror_error_free(
-		 &error );
-	}
-#if !defined( LIBSYSTEM_HAVE_GLOB )
-	if( libsystem_glob_initialize(
-	     &glob,
-	     &error ) != 1 )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to initialize glob.\n" );
-
-		libsystem_notify_print_error_backtrace(
-		 error );
-		liberror_error_free(
-		 &error );
-
-		return( EXIT_FAILURE );
-	}
-	if( libsystem_glob_resolve(
-	     glob,
-	     &argv[ optind ],
-	     argc - optind,
-	     &error ) != 1 )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to resolve glob.\n" );
-
-		libsystem_notify_print_error_backtrace(
-		 error );
-		liberror_error_free(
-		 &error );
-
-		libsystem_glob_free(
-		 &glob,
-		 NULL );
-
-		return( EXIT_FAILURE );
-	}
-	argv_filenames      = glob->result;
-	amount_of_filenames = glob->amount_of_results;
-#else
-	argv_filenames      = &argv[ optind ];
-	amount_of_filenames = argc - optind;
-#endif
-
-	if( alteration_handle_initialize(
-	     &alteration_handle,
-	     &error ) != 1 )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to create alteration handle.\n" );
-
-		libsystem_notify_print_error_backtrace(
-		 error );
-		liberror_error_free(
-		 &error );
-
-#if !defined( LIBSYSTEM_HAVE_GLOB )
-		libsystem_glob_free(
-		 &glob,
-		 NULL );
-#endif
-
-		return( EXIT_FAILURE );
-	}
-#if defined( HAVE_V2_API )
-	if( alteration_handle_set_header_codepage(
-	     alteration_handle,
-	     header_codepage,
-	     &error ) != 1 )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to set header codepage in alteration handle.\n" );
-
-		libsystem_notify_print_error_backtrace(
-		 error );
-		liberror_error_free(
-		 &error );
-
-		alteration_handle_free(
-		 &alteration_handle,
-		 NULL );
-
-#if !defined( LIBSYSTEM_HAVE_GLOB )
-		libsystem_glob_free(
-		 &glob,
-		 NULL );
-#endif
-
-		return( EXIT_FAILURE );
-	}
-#endif
-	result = alteration_handle_open_input(
-	          alteration_handle,
-	          argv_filenames,
-	          amount_of_filenames,
-	          &error );
-
-#if !defined( LIBSYSTEM_HAVE_GLOB )
-	if( libsystem_glob_free(
-	     &glob,
-	     &error ) != 1 )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to free glob.\n" );
-
-		libsystem_notify_print_error_backtrace(
-		 error );
-		liberror_error_free(
-		 &error );
-
-		return( EXIT_FAILURE );
-	}
-#endif
-
-	if( ( ewfalter_abort == 0 )
-	 && ( result != 1 ) )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to open EWF image file(s).\n" );
-
-		libsystem_notify_print_error_backtrace(
-		 error );
-		liberror_error_free(
-		 &error );
-
-		alteration_handle_free(
-		 &alteration_handle,
-		 NULL );
-
-		return( EXIT_FAILURE );
-	}
-	if( ( ewfalter_abort == 0 )
-	 && ( alteration_handle_get_media_size(
-	       alteration_handle,
-	       &media_size,
-	       &error ) != 1 ) )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to determine media size.\n" );
-
-		libsystem_notify_print_error_backtrace(
-		 error );
-		liberror_error_free(
-		 &error );
-
-		alteration_handle_close(
-		 alteration_handle,
-		 NULL );
-		alteration_handle_free(
-		 &alteration_handle,
-		 NULL );
-
-		return( EXIT_FAILURE );
-	}
-	if( ewfalter_abort == 0 )
-	{
-		if( libsystem_signal_detach(
-		     &error ) != 1 )
-		{
-			fprintf(
-			 stderr,
-			 "Unable to detach signal handler.\n" );
-
-			libsystem_notify_print_error_backtrace(
-			 error );
-			liberror_error_free(
-			 &error );
-		}
-		/* Request the necessary case data
-		 */
-		fprintf(
-		 stdout,
-		 "Information for alter required, please provide the necessary input\n" );
-
-		if( ( argument_set_offset == 0 )
-		 && ( ewfinput_get_size_variable(
-		       stdout,
-		       input_buffer,
-		       EWFALTER_INPUT_BUFFER_SIZE,
-		       _LIBSYSTEM_CHARACTER_T_STRING( "Start altering at offset" ),
-		       0,
-		       media_size,
-		       0,
-		       &alter_offset,
-		       &error ) == -1 ) )
-		{
-			libsystem_notify_print_error_backtrace(
-			 error );
-			liberror_error_free(
-			 &error );
-
-			alter_offset = 0;
-
-			fprintf(
-			 stdout,
-			 "Unable to determine the altertion offset defaulting to: %" PRIu64 ".\n",
-			 alter_offset );
-		}
-		if( ( argument_set_size == 0 )
-		 && ( ewfinput_get_size_variable(
-		       stdout,
-		       input_buffer,
-		       EWFALTER_INPUT_BUFFER_SIZE,
-		       _LIBSYSTEM_CHARACTER_T_STRING( "Amount of bytes to alter" ),
-		       0,
-		       media_size - alter_offset,
-		       media_size - alter_offset,
-		       &alter_size,
-		       &error ) == -1 ) )
-		{
-			libsystem_notify_print_error_backtrace(
-			 error );
-			liberror_error_free(
-			 &error );
-
-			alter_size = media_size - alter_offset;
-
-			fprintf(
-			 stdout,
-			 "Unable to determine the altertion size defaulting to: %" PRIu64 ".\n",
-			 alter_size );
-		}
-		if( process_buffer_size == 0 )
-		{
-			if( ewfinput_get_size_variable(
-			     stdout,
-			     input_buffer,
-			     EWFALTER_INPUT_BUFFER_SIZE,
-			     _LIBSYSTEM_CHARACTER_T_STRING( "Alteration buffer size" ),
-			     1,
-			     SSIZE_MAX,
-			     ( 64 * 512 ),
-			     &process_buffer_size,
-			     &error ) == -1 )
-			{
-				libsystem_notify_print_error_backtrace(
-				 error );
-				liberror_error_free(
-				 &error );
-
-				process_buffer_size = 64 * 512;
-
-				fprintf(
-				 stdout,
-				 "Unable to determine the altertion buffer size defaulting to: %" PRIu64 ".\n",
-				 process_buffer_size );
-			}
-			if( process_buffer_size > (size_t) SSIZE_MAX )
-			{
-				process_buffer_size = 64 * 512;
-
-				fprintf(
-				 stdout,
-				 "Invalid alteration buffer size defaulting to: %" PRIu64 ".\n",
-				 process_buffer_size );
-			}
-		}
-		if( target_filename != NULL )
-		{
-			if( alteration_handle_set_output_values(
-			     alteration_handle,
-			     target_filename,
-			     libsystem_string_length(
-			      target_filename ),
-			     &error ) != 1 )
-			{
-				fprintf(
-				 stderr,
-				 "Unable to set delta segment filename in handle.\n" );
-
-				libsystem_notify_print_error_backtrace(
-				 error );
-				liberror_error_free(
-				 &error );
-
-				alteration_handle_close(
-				 alteration_handle,
-				 NULL );
-				alteration_handle_free(
-				 &alteration_handle,
-				 NULL );
-
-				return( EXIT_FAILURE );
-			}
-		}
-		fprintf(
-		 stderr,
-		 "\n" );
-
-		if( libsystem_signal_attach(
-		     ewfalter_signal_handler,
-		     &error ) != 1 )
-		{
-			fprintf(
-			 stderr,
-			 "Unable to attach signal handler.\n" );
-
-			libsystem_notify_print_error_backtrace(
-			 error );
-			liberror_error_free(
-			 &error );
-		}
-	}
-	if( ewfalter_abort == 0 )
-	{
-		for( alteration_run = 0;
-		     alteration_run < alteration_runs;
-		     alteration_run++ )
-		{
-			fprintf(
-			 stdout,
-			 "Alteration run: %d\n",
-			 alteration_run + 1 );
-
-			alter_count = ewfalter_alter_input(
-				       alteration_handle,
-				       (size64_t) alter_size,
-				       (off64_t) alter_offset,
-				       (size_t) process_buffer_size,
-				       &error );
-
-			if( alter_count <= -1 )
-			{
-				fprintf(
-				 stdout,
-				 "Alteration failed.\n" );
-
-				libsystem_notify_print_error_backtrace(
-				 error );
-				liberror_error_free(
-				 &error );
-
-				alteration_handle_close(
-				 alteration_handle,
-				 NULL );
-				alteration_handle_free(
-				 &alteration_handle,
-				 NULL );
-
-				return( EXIT_FAILURE );
-			}
-			if( ewfalter_abort != 0 )
-			{
-				break;
-			}
-		}
-	}
-	if( alteration_handle_close(
-	     alteration_handle,
-	     &error ) != 0 )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to close EWF file(s).\n" );
-
-		libsystem_notify_print_error_backtrace(
-		 error );
-		liberror_error_free(
-		 &error );
-
-		alteration_handle_free(
-		 &alteration_handle,
-		 NULL );
-
-		return( EXIT_FAILURE );
-	}
-	if( alteration_handle_free(
-	     &alteration_handle,
-	     &error ) != 1 )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to free alteration handle.\n" );
-
-		libsystem_notify_print_error_backtrace(
-		 error );
-		liberror_error_free(
-		 &error );
-
-		return( EXIT_FAILURE );
-	}
-	if( libsystem_signal_detach(
-	     &error ) != 1 )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to detach signal handler.\n" );
-
-		libsystem_notify_print_error_backtrace(
-		 error );
-		liberror_error_free(
-		 &error );
-	}
-	if( ewfalter_abort != 0 )
-	{
-		fprintf(
-		 stdout,
-		 "%s: ABORTED\n",
-		 program );
-
-		return( EXIT_FAILURE );
-	}
-	fprintf(
-	 stdout,
-	 "Alteration completed.\n" );
-
-	return( EXIT_SUCCESS );
-}
-
diff --git a/ewftools/ewfcommon.h b/ewftools/ewfcommon.h
index 8783090..f40eaa4 100644
--- a/ewftools/ewfcommon.h
+++ b/ewftools/ewfcommon.h
@@ -2,7 +2,7 @@
  * Common functions for the ewftools
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/ewfdebug.c b/ewftools/ewfdebug.c
deleted file mode 100644
index 18c4a2f..0000000
--- a/ewftools/ewfdebug.c
+++ /dev/null
@@ -1,507 +0,0 @@
-/*
- * ewfdebug
- * Debugs EWF files
- *
- * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
- *
- * Refer to AUTHORS for acknowledgements.
- *
- * This software is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this software.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <common.h>
-#include <memory.h>
-#include <types.h>
-
-#include <liberror.h>
-
-#if defined( HAVE_STDLIB_H ) || defined( WINAPI )
-#include <stdlib.h>
-#endif
-
-/* If libtool DLL support is enabled set LIBEWF_DLL_IMPORT
- * before including libewf.h
- */
-#if defined( _WIN32 ) && defined( DLL_EXPORT )
-#define LIBEWF_DLL_IMPORT
-#endif
-
-#include <libewf.h>
-
-#include <libsystem.h>
-
-#include "ewfinput.h"
-#include "ewfoutput.h"
-
-libewf_handle_t *ewfdebug_input_handle = NULL;
-int ewfdebug_abort                     = 0;
-
-/* Prints the executable usage information to the stream
- *  */
-void usage_fprint(
-      FILE *stream )
-{
-        if( stream == NULL )
-        {
-                return;
-        }
-	fprintf( stream, "Use ewfdebug to analyze EWF file(s).\n\n" );
-
-	fprintf( stream, "Usage: ewfdebug [ -A codepage ] [ -hqvV ] ewf_files\n\n" );
-
-	fprintf( stream, "\tewf_files: the first or the entire set of EWF segment files\n\n" );
-
-	fprintf( stream, "\t-A:        codepage of header section, options: ascii (default), windows-1250,\n"
-	                 "\t           windows-1251, windows-1252, windows-1253, windows-1254,\n"
-	                 "\t           windows-1255, windows-1256, windows-1257, windows-1258\n" );
-	fprintf( stream, "\t-h:        shows this help\n" );
-	fprintf( stream, "\t-q:        quiet shows no status information\n" );
-	fprintf( stream, "\t-v:        verbose output to stderr\n" );
-	fprintf( stream, "\t-V:        print version\n" );
-}
-
-/* Signal handler for ewfdebug
- */
-void ewfdebug_signal_handler(
-      libsystem_signal_t signal )
-{
-	liberror_error_t *error = NULL;
-	static char *function   = "ewfdebug_signal_handler";
-
-	ewfdebug_abort = 1;
-
-	if( ( ewfdebug_input_handle != NULL )
-#if defined( HAVE_V2_API )
-	 && ( libewf_handle_signal_abort(
-	       ewfdebug_input_handle,
-	       &error ) != 1 ) )
-#else
-	 && ( libewf_signal_abort(
-	       ewfdebug_input_handle ) != 1 ) )
-#endif
-	{
-		libsystem_notify_printf(
-		 "%s: unable to signal input handle to abort.\n",
-		 function );
-
-#if defined( HAVE_V2_API )
-		libsystem_notify_print_error_backtrace(
-		 error );
-		liberror_error_free(
-		 &error );
-#endif
-
-		return;
-	}
-	/* Force stdin to close otherwise any function reading it will remain blocked
-	 */
-	if( libsystem_file_io_close(
-	     0 ) != 0 )
-	{
-		libsystem_notify_printf(
-		 "%s: unable to close stdin.\n",
-		 function );
-	}
-}
-
-/* The main program
- */
-#if defined( LIBSYSTEM_HAVE_WIDE_CHARACTER )
-int wmain( int argc, wchar_t * const argv[] )
-#else
-int main( int argc, char * const argv[] )
-#endif
-{
-#if !defined( LIBSYSTEM_HAVE_GLOB )
-	libsystem_glob_t *glob                        = NULL;
-#endif
-
-	liberror_error_t *error                       = NULL;
-
-	libsystem_character_t * const *argv_filenames = NULL;
-	libsystem_character_t **ewf_filenames         = NULL;
-
-	libsystem_character_t *program                = _LIBSYSTEM_CHARACTER_T_STRING( "ewfdebug" );
-
-	libsystem_integer_t option                    = 0;
-	size_t first_filename_length                  = 0;
-	uint8_t verbose                               = 0;
-	int amount_of_filenames                       = 0;
-	int header_codepage                           = LIBEWF_CODEPAGE_ASCII;
-	int result                                    = 0;
-
-	libsystem_notify_set_stream(
-	 stderr,
-	 NULL );
-	libsystem_notify_set_verbose(
-	 1 );
-
-	if( libsystem_initialize(
-	     &error ) != 1 )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to initialize system values.\n" );
-
-		libsystem_notify_print_error_backtrace(
-		 error );
-		liberror_error_free(
-		 &error );
-
-		return( EXIT_FAILURE );
-	}
-	ewfoutput_version_fprint(
-	 stdout,
-	 program );
-
-	while( ( option = libsystem_getopt(
-			   argc,
-			   argv,
-			   _LIBSYSTEM_CHARACTER_T_STRING( "A:hqvV" ) ) ) != (libsystem_integer_t) -1 )
-	{
-		switch( option )
-		{
-			case (libsystem_integer_t) '?':
-			default:
-				fprintf(
-				 stderr,
-				 "Invalid argument: %" PRIs_LIBSYSTEM ".\n",
-				 argv[ optind ] );
-
-				usage_fprint(
-				 stdout );
-
-				return( EXIT_FAILURE );
-
-			case (libsystem_integer_t) 'A':
-				if( ewfinput_determine_header_codepage(
-				     optarg,
-				     &header_codepage,
-				     &error ) != 1 )
-				{
-					libsystem_notify_print_error_backtrace(
-					 error );
-					liberror_error_free(
-					 &error );
-
-					fprintf(
-					 stderr,
-					 "Unsuported header codepage defaulting to: ascii.\n" );
-
-					header_codepage = LIBEWF_CODEPAGE_ASCII;
-				}
-				break;
-
-			case (libsystem_integer_t) 'h':
-				usage_fprint(
-				 stdout );
-
-				return( EXIT_SUCCESS );
-
-			case (libsystem_integer_t) 'q':
-				break;
-
-			case (libsystem_integer_t) 'v':
-				verbose = 1;
-
-				break;
-
-			case (libsystem_integer_t) 'V':
-				ewfoutput_copyright_fprint(
-				 stdout );
-
-				return( EXIT_SUCCESS );
-		}
-	}
-	if( optind == argc )
-	{
-		fprintf(
-		 stderr,
-		 "Missing EWF image file(s).\n" );
-
-		usage_fprint(
-		 stdout );
-
-		return( EXIT_FAILURE );
-	}
-	libsystem_notify_set_verbose(
-	 verbose );
-#if defined( HAVE_V2_API )
-	libewf_notify_set_verbose(
-	 verbose );
-	libewf_notify_set_stream(
-	 stderr,
-	 NULL );
-#else
-	libewf_set_notify_values(
-	 stderr,
-	 verbose );
-#endif
-
-	if( libsystem_signal_attach(
-	     ewfdebug_signal_handler,
-	     &error ) != 1 )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to attach signal handler.\n" );
-
-		libsystem_notify_print_error_backtrace(
-		 error );
-		liberror_error_free(
-		 &error );
-	}
-#if !defined( LIBSYSTEM_HAVE_GLOB )
-	if( libsystem_glob_initialize(
-	     &glob
-	     &error ) != 1 )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to initialize glob.\n" );
-
-		libsystem_notify_print_error_backtrace(
-		 error );
-		liberror_error_free(
-		 &error );
-
-		return( EXIT_FAILURE );
-	}
-	if( libsystem_glob_resolve(
-	     glob,
-	     &argv[ optind ],
-	     argc - optind,
-	     &error ) != 1 )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to resolve glob.\n" );
-
-		libsystem_notify_print_error_backtrace(
-		 error );
-		liberror_error_free(
-		 &error );
-
-		libsystem_glob_free(
-		 &glob,
-		 NULL );
-
-		return( EXIT_FAILURE );
-	}
-	argv_filenames      = glob->result;
-	amount_of_filenames = glob->amount_of_results;
-#else
-	argv_filenames      = &argv[ optind ];
-	amount_of_filenames = argc - optind;
-#endif
-
-	if( amount_of_filenames == 1 )
-	{
-		first_filename_length = libsystem_string_length(
-		                         argv_filenames[ 0 ] );
-
-#if defined( LIBSYSTEM_HAVE_WIDE_CHARACTER )
-#if defined( HAVE_V2_API )
-		if( libewf_glob_wide(
-		     argv_filenames[ 0 ],
-		     first_filename_length,
-		     LIBEWF_FORMAT_UNKNOWN,
-		     &ewf_filenames,
-		     &amount_of_filenames,
-		     &error ) != 1 )
-#else
-		amount_of_filenames = libewf_glob_wide(
-		                       argv_filenames[ 0 ],
-		                       first_filename_length,
-		                       LIBEWF_FORMAT_UNKNOWN,
-		                       &ewf_filenames );
-
-		if( amount_of_filenames <= 0 )
-#endif
-#else
-#if defined( HAVE_V2_API )
-		if( libewf_glob(
-		     argv_filenames[ 0 ],
-		     first_filename_length,
-		     LIBEWF_FORMAT_UNKNOWN,
-		     &ewf_filenames,
-		     &amount_of_filenames,
-		     &error ) != 1 )
-#else
-		amount_of_filenames = libewf_glob(
-		                       argv_filenames[ 0 ],
-		                       first_filename_length,
-		                       LIBEWF_FORMAT_UNKNOWN,
-		                       &ewf_filenames );
-
-		if( amount_of_filenames <= 0 )
-#endif
-#endif
-		{
-			fprintf(
-			 stderr,
-			 "Unable to resolve ewf file(s).\n" );
-
-#if defined( HAVE_V2_API )
-			libsystem_notify_print_error_backtrace(
-			 error );
-			liberror_error_free(
-			 &error );
-#endif
-
-#if !defined( LIBSYSTEM_HAVE_GLOB )
-			libsystem_glob_free(
-			 &glob,
-			 NULL );
-#endif
-
-			return( EXIT_FAILURE );
-		}
-		argv_filenames = (libsystem_character_t * const *) ewf_filenames;
-	}
-#if defined( HAVE_V2_API )
-	if( libewf_handle_initialize(
-	     &ewfdebug_input_handle,
-	     &error ) != 1 )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to initialize input handle.\n" );
-
-		libsystem_notify_print_error_backtrace(
-		 error );
-		liberror_error_free(
-		 &error );
-
-#if !defined( LIBSYSTEM_HAVE_GLOB )
-		libsystem_glob_free(
-		 &glob,
-		 NULL );
-#endif
-
-		return( EXIT_FAILURE );
-	}
-	result = libewf_handle_open(
-	          ewfdebug_input_handle,
-	          argv_filenames,
-	          amount_of_filenames,
-	          LIBEWF_OPEN_READ_WRITE,
-	          &error );
-
-#if !defined( LIBSYSTEM_HAVE_GLOB )
-	if( libsystem_glob_free(
-	     &glob,
-	     &error ) != 1 )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to free glob.\n" );
-
-		libsystem_notify_print_error_backtrace(
-		 error );
-		liberror_error_free(
-		 &error );
-
-		return( EXIT_FAILURE );
-	}
-#endif
-	if( ewf_filenames != NULL )
-	{
-		for( ; amount_of_filenames > 0; amount_of_filenames-- )
-		{
-			memory_free(
-			 ewf_filenames[ amount_of_filenames - 1 ] );
-		}
-		memory_free(
-		 ewf_filenames );
-	}
-	if( ( ewfdebug_abort == 0 )
-	 && ( result != 1 ) )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to open EWF file(s)" );
-
-		libewf_handle_close(
-		 ewfdebug_input_handle,
-		 NULL );
-		libewf_handle_free(
-		 &ewfdebug_input_handle,
-		 NULL );
-
-		return( EXIT_FAILURE );
-	}
-	/* TODO */
-
-	if( libewf_handle_close(
-	     ewfdebug_input_handle,
-	     &error ) != 0 )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to close EWF file(s).\n" );
-
-		libewf_handle_free(
-		 &ewfdebug_input_handle,
-		 NULL );
-
-		return( EXIT_FAILURE );
-	}
-	if( libewf_handle_free(
-	     &ewfdebug_input_handle,
-	     &error ) != 1 )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to free input handle.\n" );
-
-		return( EXIT_FAILURE );
-	}
-	if( libsystem_signal_detach(
-	     &error ) != 1 )
-	{
-		fprintf(
-		 stderr,
-		 "Unable to detach signal handler.\n" );
-
-		libsystem_notify_print_error_backtrace(
-		 error );
-		liberror_error_free(
-		 &error );
-	}
-	if( ewfdebug_abort != 0 )
-	{
-		fprintf(
-		 stdout,
-		 "%s: ABORTED\n",
-		 program );
-
-		return( EXIT_FAILURE );
-	}
-	fprintf(
-	 stdout,
-	 "Debug completed.\n" );
-
-	return( EXIT_SUCCESS );
-#else
-	fprintf(
-	 stdout,
-	 "Requires libewf version 2 API.\n" );
-
-	return( EXIT_SUCCESS );
-	
-#endif
-}
-
diff --git a/ewftools/ewfexport.c b/ewftools/ewfexport.c
index e257e1a..ac7b44f 100644
--- a/ewftools/ewfexport.c
+++ b/ewftools/ewfexport.c
@@ -3,7 +3,7 @@
  * Export media data from EWF files to a file
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -126,8 +126,8 @@ void usage_fprint(
 
 	fprintf( stream, "\tewf_files: the first or the entire set of EWF segment files\n\n" );
 
-	fprintf( stream, "\t-A:        codepage of header section, options: ascii (default), windows-1250,\n"
-	                 "\t           windows-1251, windows-1252, windows-1253, windows-1254,\n"
+	fprintf( stream, "\t-A:        codepage of header section, options: ascii (default), windows-874,\n"
+	                 "\t           windows-1250, windows-1251, windows-1252, windows-1253, windows-1254,\n"
 	                 "\t           windows-1255, windows-1256, windows-1257, windows-1258\n" );
 #ifdef DISABLED
 	fprintf( stream, "\t-b:        specify the amount of sectors to read at once (per chunk), options:\n"
diff --git a/ewftools/ewfinfo.c b/ewftools/ewfinfo.c
index 8ecc71b..a13b130 100644
--- a/ewftools/ewfinfo.c
+++ b/ewftools/ewfinfo.c
@@ -3,7 +3,7 @@
  * Shows information stored in an EWF file
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -67,8 +67,8 @@ void usage_fprint(
 
 	fprintf( stream, "\tewf_files: the first or the entire set of EWF segment files\n\n" );
 
-	fprintf( stream, "\t-A:        codepage of header section, options: ascii (default), windows-1250,\n"
-	                 "\t           windows-1251, windows-1252, windows-1253, windows-1254,\n"
+	fprintf( stream, "\t-A:        codepage of header section, options: ascii (default), windows-874,\n"
+	                 "\t           windows-1250, windows-1251, windows-1252, windows-1253, windows-1254,\n"
 	                 "\t           windows-1255, windows-1256, windows-1257, windows-1258\n" );
 	fprintf( stream, "\t-d:        specify the date format, options: ctime (default), dm (day/month),\n"
 	                 "\t           md (month/day), iso8601\n" );
@@ -612,7 +612,7 @@ int main( int argc, char * const argv[] )
 	if( ewfinfo_abort != 0 )
 	{
 		fprintf(
-		 stdout, "%s: ABORTED\n",
+		 stdout, "%" PRIs_LIBSYSTEM ": ABORTED\n",
 		 program );
 
 		return( EXIT_FAILURE );
diff --git a/ewftools/ewfinput.c b/ewftools/ewfinput.c
index d105b05..80ff013 100644
--- a/ewftools/ewfinput.c
+++ b/ewftools/ewfinput.c
@@ -2,7 +2,7 @@
  * User input functions for the ewftools
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/ewfinput.h b/ewftools/ewfinput.h
index 0e5ae6a..593120a 100644
--- a/ewftools/ewfinput.h
+++ b/ewftools/ewfinput.h
@@ -2,7 +2,7 @@
  * User input functions for the ewftools
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/ewfoutput.c b/ewftools/ewfoutput.c
index 7ee079c..1cc0b0b 100644
--- a/ewftools/ewfoutput.c
+++ b/ewftools/ewfoutput.c
@@ -2,7 +2,7 @@
  * Output functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/ewfoutput.h b/ewftools/ewfoutput.h
index aef31c7..75a00e1 100644
--- a/ewftools/ewfoutput.h
+++ b/ewftools/ewfoutput.h
@@ -2,7 +2,7 @@
  * Output functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/ewfverify.c b/ewftools/ewfverify.c
index 0262b93..6b63f02 100644
--- a/ewftools/ewfverify.c
+++ b/ewftools/ewfverify.c
@@ -3,7 +3,7 @@
  * Verifies the integrity of the media data within the EWF file
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -73,8 +73,8 @@ void usage_fprint(
 
 	fprintf( stream, "\tewf_files: the first or the entire set of EWF segment files\n\n" );
 
-	fprintf( stream, "\t-A:        codepage of header section, options: ascii (default), windows-1250,\n"
-	                 "\t           windows-1251, windows-1252, windows-1253, windows-1254,\n"
+	fprintf( stream, "\t-A:        codepage of header section, options: ascii (default), windows-874,\n"
+	                 "\t           windows-1250, windows-1251, windows-1252, windows-1253, windows-1254,\n"
 	                 "\t           windows-1255, windows-1256, windows-1257, windows-1258\n" );
 	fprintf( stream, "\t-d:        calculate additional digest (hash) types besides md5, options: sha1\n" );
 	fprintf( stream, "\t-h:        shows this help\n" );
@@ -1347,7 +1347,7 @@ int main( int argc, char * const argv[] )
 	{
 		fprintf(
 		 stdout,
-		 "\n%s: SUCCESS\n",
+		 "\n%" PRIs_LIBSYSTEM ": SUCCESS\n",
 		 program );
 
 		result = EXIT_SUCCESS;
@@ -1356,7 +1356,7 @@ int main( int argc, char * const argv[] )
 	{
 		fprintf(
 		 stdout,
-		 "\n%s: FAILURE\n",
+		 "\n%" PRIs_LIBSYSTEM ": FAILURE\n",
 		 program );
 
 		result = EXIT_FAILURE;
diff --git a/ewftools/export_handle.c b/ewftools/export_handle.c
index aa621ed..84731c7 100644
--- a/ewftools/export_handle.c
+++ b/ewftools/export_handle.c
@@ -2,7 +2,7 @@
  * Export handle
  *
  * Copyright (C) 2007-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/export_handle.h b/ewftools/export_handle.h
index 5e55424..b22267f 100644
--- a/ewftools/export_handle.h
+++ b/ewftools/export_handle.h
@@ -2,7 +2,7 @@
  * Export handle
  *
  * Copyright (C) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/guid.c b/ewftools/guid.c
index df6da95..57cb203 100644
--- a/ewftools/guid.c
+++ b/ewftools/guid.c
@@ -2,7 +2,7 @@
  * GUID functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -21,7 +21,7 @@
  */
 
 #include <common.h>
-#include <endian.h>
+#include <byte_stream.h>
 #include <types.h>
 
 #include <liberror.h>
@@ -122,19 +122,19 @@ int guid_generate(
 #endif
 	}
 #if defined( WINAPI )
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 guid,
 	 uuid.Data1 );
 
 	guid += 4;
 
-	endian_little_revert_16bit(
+	byte_stream_copy_from_uint16_little_endian(
 	 guid,
 	 uuid.Data2 );
 
 	guid += 2;
 
-	endian_little_revert_16bit(
+	byte_stream_copy_from_uint16_little_endian(
 	 guid,
 	 uuid.Data3 );
 
@@ -201,8 +201,8 @@ int guid_to_string(
 
 		return( -1 );
 	}
-	if( ( byte_order != _ENDIAN_BIG )
-	 && ( byte_order != _ENDIAN_LITTLE ) )
+	if( ( byte_order != _BYTE_STREAM_ENDIAN_BIG )
+	 && ( byte_order != _BYTE_STREAM_ENDIAN_LITTLE ) )
 	{
 		liberror_error_set(
 		 error,
@@ -249,7 +249,7 @@ int guid_to_string(
 	/* Create the GUID string
 	 * It is stored as uint32 - uint16 - uint16 - 8 byte array
 	 */
-	if( byte_order == _ENDIAN_BIG )
+	if( byte_order == _BYTE_STREAM_ENDIAN_BIG )
 	{
 		print_count = libsystem_string_snprintf(
 			       string,
@@ -276,7 +276,7 @@ int guid_to_string(
 			       guid[ 8 ], guid[ 9 ],
 			       guid[ 10 ], guid[ 11 ], guid[ 12 ], guid[ 13 ], guid[ 14 ], guid[ 15 ] );
 	}
-	else if( byte_order == _ENDIAN_LITTLE )
+	else if( byte_order == _BYTE_STREAM_ENDIAN_LITTLE )
 	{
 		print_count = libsystem_string_snprintf(
 			       string,
diff --git a/ewftools/guid.h b/ewftools/guid.h
index 3541b28..92d9c79 100644
--- a/ewftools/guid.h
+++ b/ewftools/guid.h
@@ -2,7 +2,7 @@
  * GUID functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/imaging_handle.c b/ewftools/imaging_handle.c
index 68e6148..9723aa6 100644
--- a/ewftools/imaging_handle.c
+++ b/ewftools/imaging_handle.c
@@ -2,7 +2,7 @@
  * Imaging handle
  *
  * Copyright (C) 2007-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -2135,100 +2135,120 @@ int imaging_handle_set_output_values(
 
 		return( -1 );
 	}
-	/* Set case number
-	 */
-	if( imaging_handle_set_header_value(
-	     imaging_handle,
-	     "case_number",
-	     11,
-	     case_number,
-	     case_number_length,
-	     error ) != 1 )
+	if( ( case_number != NULL )
+	 && ( case_number_length > 0 ) )
 	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_SET_FAILED,
-		 "%s: unable to set header value: case number.",
-		 function );
+		/* Set case number
+		 */
+		if( imaging_handle_set_header_value(
+		     imaging_handle,
+		     "case_number",
+		     11,
+		     case_number,
+		     case_number_length,
+		     error ) != 1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_RUNTIME,
+			 LIBERROR_RUNTIME_ERROR_SET_FAILED,
+			 "%s: unable to set header value: case number.",
+			 function );
 
-		return( -1 );
+			return( -1 );
+		}
 	}
-	/* Set description
-	 */
-	if( imaging_handle_set_header_value(
-	     imaging_handle,
-	     "description",
-	     11,
-	     description,
-	     description_length,
-	     error ) != 1 )
+	if( ( description != NULL )
+	 && ( description_length > 0 ) )
 	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_SET_FAILED,
-		 "%s: unable to set header value: description.",
-		 function );
+		/* Set description
+		 */
+		if( imaging_handle_set_header_value(
+		     imaging_handle,
+		     "description",
+		     11,
+		     description,
+		     description_length,
+		     error ) != 1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_RUNTIME,
+			 LIBERROR_RUNTIME_ERROR_SET_FAILED,
+			 "%s: unable to set header value: description.",
+			 function );
 
-		return( -1 );
+			return( -1 );
+		}
 	}
-	/* Set evidence number
-	 */
-	if( imaging_handle_set_header_value(
-	     imaging_handle,
-	     "evidence_number",
-	     15,
-	     evidence_number,
-	     evidence_number_length,
-	     error ) != 1 )
+	if( ( evidence_number != NULL )
+	 && ( evidence_number_length > 0 ) )
 	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_SET_FAILED,
-		 "%s: unable to set header value: evidence number.",
-		 function );
+		/* Set evidence number
+		 */
+		if( imaging_handle_set_header_value(
+		     imaging_handle,
+		     "evidence_number",
+		     15,
+		     evidence_number,
+		     evidence_number_length,
+		     error ) != 1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_RUNTIME,
+			 LIBERROR_RUNTIME_ERROR_SET_FAILED,
+			 "%s: unable to set header value: evidence number.",
+			 function );
 
-		return( -1 );
+			return( -1 );
+		}
 	}
-	/* Set examiner name
-	 */
-	if( imaging_handle_set_header_value(
-	     imaging_handle,
-	     "examiner_name",
-	     13,
-	     examiner_name,
-	     examiner_name_length,
-	     error ) != 1 )
+	if( ( examiner_name != NULL )
+	 && ( examiner_name_length > 0 ) )
 	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_SET_FAILED,
-		 "%s: unable to set header value: examiner name.",
-		 function );
+		/* Set examiner name
+		 */
+		if( imaging_handle_set_header_value(
+		     imaging_handle,
+		     "examiner_name",
+		     13,
+		     examiner_name,
+		     examiner_name_length,
+		     error ) != 1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_RUNTIME,
+			 LIBERROR_RUNTIME_ERROR_SET_FAILED,
+			 "%s: unable to set header value: examiner name.",
+			 function );
 
-		return( -1 );
+			return( -1 );
+		}
 	}
-	/* Set notes
-	 */
-	if( imaging_handle_set_header_value(
-	     imaging_handle,
-	     "notes",
-	     5,
-	     notes,
-	     notes_length,
-	     error ) != 1 )
+	if( ( notes != NULL )
+	 && ( notes_length > 0 ) )
 	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_RUNTIME,
-		 LIBERROR_RUNTIME_ERROR_SET_FAILED,
-		 "%s: unable to set header value: notes.",
-		 function );
+		/* Set notes
+		 */
+		if( imaging_handle_set_header_value(
+		     imaging_handle,
+		     "notes",
+		     5,
+		     notes,
+		     notes_length,
+		     error ) != 1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_RUNTIME,
+			 LIBERROR_RUNTIME_ERROR_SET_FAILED,
+			 "%s: unable to set header value: notes.",
+			 function );
 
-		return( -1 );
+			return( -1 );
+		}
 	}
 	/* Password is not used within libewf
 	 */
diff --git a/ewftools/imaging_handle.h b/ewftools/imaging_handle.h
index 19f2347..b2af735 100644
--- a/ewftools/imaging_handle.h
+++ b/ewftools/imaging_handle.h
@@ -2,7 +2,7 @@
  * Imaging handle
  *
  * Copyright (C) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/info_handle.c b/ewftools/info_handle.c
index 192d1ae..84fe5b2 100644
--- a/ewftools/info_handle.c
+++ b/ewftools/info_handle.c
@@ -2,7 +2,7 @@
  * Info handle
  *
  * Copyright (C) 2007-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -21,7 +21,7 @@
  */
 
 #include <common.h>
-#include <endian.h>
+#include <byte_stream.h>
 #include <memory.h>
 #include <types.h>
 
@@ -1869,7 +1869,7 @@ int info_handle_media_information_fprint(
 		else if( guid_to_string(
 		          guid,
 		          GUID_SIZE,
-		          _ENDIAN_LITTLE,
+		          _BYTE_STREAM_ENDIAN_LITTLE,
 		          guid_string,
 		          GUID_STRING_SIZE,
 		          NULL ) != 1 )
diff --git a/ewftools/info_handle.h b/ewftools/info_handle.h
index 7f41e23..e52ca1a 100644
--- a/ewftools/info_handle.h
+++ b/ewftools/info_handle.h
@@ -2,7 +2,7 @@
  * Info handle
  *
  * Copyright (C) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/io_ata.c b/ewftools/io_ata.c
index 0b16142..d4fcdba 100644
--- a/ewftools/io_ata.c
+++ b/ewftools/io_ata.c
@@ -2,7 +2,7 @@
  * ATA/ATAPI IO functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -21,7 +21,6 @@
  */
 
 #include <common.h>
-#include <endian.h>
 #include <memory.h>
 #include <narrow_string.h>
 #include <types.h>
diff --git a/ewftools/io_ata.h b/ewftools/io_ata.h
index 3dce39b..e92e3c0 100644
--- a/ewftools/io_ata.h
+++ b/ewftools/io_ata.h
@@ -2,7 +2,7 @@
  * ATA/ATAPI IO functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/io_bus.h b/ewftools/io_bus.h
index a8a4bac..e507535 100644
--- a/ewftools/io_bus.h
+++ b/ewftools/io_bus.h
@@ -2,7 +2,7 @@
  * IO bus functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/io_optical_disk.c b/ewftools/io_optical_disk.c
index 2bb7549..c39e081 100644
--- a/ewftools/io_optical_disk.c
+++ b/ewftools/io_optical_disk.c
@@ -2,7 +2,7 @@
  * Optical disk functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -21,7 +21,6 @@
  */
 
 #include <common.h>
-#include <endian.h>
 #include <memory.h>
 #include <types.h>
 
diff --git a/ewftools/io_optical_disk.h b/ewftools/io_optical_disk.h
index 948dc69..e8c0c42 100644
--- a/ewftools/io_optical_disk.h
+++ b/ewftools/io_optical_disk.h
@@ -2,7 +2,7 @@
  * Optical disk IO functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/io_scsi.c b/ewftools/io_scsi.c
index 0f23fc5..b8ac122 100644
--- a/ewftools/io_scsi.c
+++ b/ewftools/io_scsi.c
@@ -2,7 +2,7 @@
  * SCSI IO functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/io_scsi.h b/ewftools/io_scsi.h
index 1c97a01..424a71f 100644
--- a/ewftools/io_scsi.h
+++ b/ewftools/io_scsi.h
@@ -2,7 +2,7 @@
  * SCSI IO functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/io_usb.c b/ewftools/io_usb.c
index e797c4a..f0ee585 100644
--- a/ewftools/io_usb.c
+++ b/ewftools/io_usb.c
@@ -2,7 +2,7 @@
  * USB IO functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -21,7 +21,6 @@
  */
 
 #include <common.h>
-#include <endian.h>
 #include <memory.h>
 #include <narrow_string.h>
 #include <types.h>
diff --git a/ewftools/io_usb.h b/ewftools/io_usb.h
index 1b604b9..27b354a 100644
--- a/ewftools/io_usb.h
+++ b/ewftools/io_usb.h
@@ -2,7 +2,7 @@
  * USB IO functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/md5.h b/ewftools/md5.h
index d9f995d..5bb31f2 100644
--- a/ewftools/md5.h
+++ b/ewftools/md5.h
@@ -2,7 +2,7 @@
  * MD5 support
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/platform.c b/ewftools/platform.c
index 475cdea..3113eac 100644
--- a/ewftools/platform.c
+++ b/ewftools/platform.c
@@ -2,7 +2,7 @@
  * Platform functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/platform.h b/ewftools/platform.h
index 48eb5bb..b7d74d5 100644
--- a/ewftools/platform.h
+++ b/ewftools/platform.h
@@ -2,7 +2,7 @@
  * Platform functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/process_status.c b/ewftools/process_status.c
index 9810919..2bd687c 100644
--- a/ewftools/process_status.c
+++ b/ewftools/process_status.c
@@ -2,7 +2,7 @@
  * Process status functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/process_status.h b/ewftools/process_status.h
index 5023e6b..01d91bd 100644
--- a/ewftools/process_status.h
+++ b/ewftools/process_status.h
@@ -2,7 +2,7 @@
  * Process status functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/sha1.h b/ewftools/sha1.h
index b898b67..e54da73 100644
--- a/ewftools/sha1.h
+++ b/ewftools/sha1.h
@@ -2,7 +2,7 @@
  * SHA1 support
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/storage_media_buffer.c b/ewftools/storage_media_buffer.c
index 054f019..c6d617e 100644
--- a/ewftools/storage_media_buffer.c
+++ b/ewftools/storage_media_buffer.c
@@ -2,7 +2,7 @@
  * Storage media buffer
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/storage_media_buffer.h b/ewftools/storage_media_buffer.h
index c8f5a7c..e8d49a2 100644
--- a/ewftools/storage_media_buffer.h
+++ b/ewftools/storage_media_buffer.h
@@ -2,7 +2,7 @@
  * Storage media buffer
  *
  * Copyright (C) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/verification_handle.c b/ewftools/verification_handle.c
index c9bdab7..3316cd4 100644
--- a/ewftools/verification_handle.c
+++ b/ewftools/verification_handle.c
@@ -2,7 +2,7 @@
  * Verification handle
  *
  * Copyright (C) 2007-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/ewftools/verification_handle.h b/ewftools/verification_handle.h
index e22f85e..5ccff09 100644
--- a/ewftools/verification_handle.h
+++ b/ewftools/verification_handle.h
@@ -2,7 +2,7 @@
  * Verification handle
  *
  * Copyright (C) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/include/libewf.h b/include/libewf.h
index 4c60f1b..2e65fdb 100644
--- a/include/libewf.h
+++ b/include/libewf.h
@@ -2,7 +2,7 @@
  * Library for the Expert Witness Compression Format Support (EWF)
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -105,7 +105,7 @@ LIBEWF_EXTERN int libewf_check_file_signature_wide(
  * Returns 1 if true, 0 if not or -1 on error
  */
 LIBEWF_EXTERN int libewf_check_file_signature_file_io_handle(
-                   libbfio_handle_t *bfio_handle,
+                   libbfio_handle_t *file_io_handle,
                    libewf_error_t **error );
 #endif
 #endif
diff --git a/include/libewf.h.in b/include/libewf.h.in
index 6a90f84..68b736e 100644
--- a/include/libewf.h.in
+++ b/include/libewf.h.in
@@ -2,7 +2,7 @@
  * Library for the Expert Witness Compression Format Support (EWF)
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -105,7 +105,7 @@ LIBEWF_EXTERN int libewf_check_file_signature_wide(
  * Returns 1 if true, 0 if not or -1 on error
  */
 LIBEWF_EXTERN int libewf_check_file_signature_file_io_handle(
-                   libbfio_handle_t *bfio_handle,
+                   libbfio_handle_t *file_io_handle,
                    libewf_error_t **error );
 #endif
 #endif
diff --git a/include/libewf/codepage.h b/include/libewf/codepage.h
index 79795fc..3c5ee26 100644
--- a/include/libewf/codepage.h
+++ b/include/libewf/codepage.h
@@ -2,7 +2,7 @@
  * Codepage definitions for libewf
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/include/libewf/definitions.h b/include/libewf/definitions.h
index 54f4a1e..a185004 100644
--- a/include/libewf/definitions.h
+++ b/include/libewf/definitions.h
@@ -2,7 +2,7 @@
  * Definitions for libewf
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -25,11 +25,11 @@
 
 #include <libewf/types.h>
 
-#define LIBEWF_VERSION				20091003
+#define LIBEWF_VERSION				20091114
 
 /* The libewf version string
  */
-#define LIBEWF_VERSION_STRING			"20091003"
+#define LIBEWF_VERSION_STRING			"20091114"
 
 /* The libewf file access
  * bit 1	set to 1 for read access
diff --git a/include/libewf/definitions.h.in b/include/libewf/definitions.h.in
index 3d9adc9..249a212 100644
--- a/include/libewf/definitions.h.in
+++ b/include/libewf/definitions.h.in
@@ -2,7 +2,7 @@
  * Definitions for libewf
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/include/libewf/error.h b/include/libewf/error.h
index 1ea9003..00ce0c5 100644
--- a/include/libewf/error.h
+++ b/include/libewf/error.h
@@ -2,7 +2,7 @@
  * The error code definitions for libewf
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/include/libewf/extern.h b/include/libewf/extern.h
index 9327bab..8e28e2e 100644
--- a/include/libewf/extern.h
+++ b/include/libewf/extern.h
@@ -4,7 +4,7 @@
  * library functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/include/libewf/features.h b/include/libewf/features.h
index 47904e2..2713491 100644
--- a/include/libewf/features.h
+++ b/include/libewf/features.h
@@ -2,7 +2,7 @@
  * Features of libewf
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/include/libewf/features.h.in b/include/libewf/features.h.in
index 9dc1d94..553f5bc 100644
--- a/include/libewf/features.h.in
+++ b/include/libewf/features.h.in
@@ -2,7 +2,7 @@
  * Features of libewf
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/include/libewf/handle.h b/include/libewf/handle.h
index 34b3073..90375f5 100644
--- a/include/libewf/handle.h
+++ b/include/libewf/handle.h
@@ -2,7 +2,7 @@
  * The external handle, hides internal data structures
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/include/libewf/types.h b/include/libewf/types.h
index d9062fc..26b6792 100644
--- a/include/libewf/types.h
+++ b/include/libewf/types.h
@@ -2,7 +2,7 @@
  * Type definitions for libewf
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/include/libewf/types.h.in b/include/libewf/types.h.in
index 3119c2f..dd8acb4 100644
--- a/include/libewf/types.h.in
+++ b/include/libewf/types.h.in
@@ -2,7 +2,7 @@
  * Type definitions for libewf
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libbfio/libbfio_definitions.h b/libbfio/libbfio_definitions.h
index 06a999e..37b63a2 100644
--- a/libbfio/libbfio_definitions.h
+++ b/libbfio/libbfio_definitions.h
@@ -2,7 +2,7 @@
  * The internal definitions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -34,11 +34,11 @@
  * for local use of libbfio
  */
 #else
-#define LIBBFIO_VERSION			20091003
+#define LIBBFIO_VERSION					20091114
 
 /* The libbfio version string
  */
-#define LIBBFIO_VERSION_STRING		"20091003"
+#define LIBBFIO_VERSION_STRING				"20091114"
 
 /* The libbfio file access
  * bit 1	set to 1 for read access
@@ -46,17 +46,17 @@
  * bit 3	set to 1 to truncate an existing file on write
  * bit 4-8	not used
  */
-#define LIBBFIO_FLAG_READ		0x01
-#define LIBBFIO_FLAG_WRITE		0x02
-#define LIBBFIO_FLAG_TRUNCATE		0x04
+#define LIBBFIO_FLAG_READ				0x01
+#define LIBBFIO_FLAG_WRITE				0x02
+#define LIBBFIO_FLAG_TRUNCATE				0x04
 
 /* The libbfio file access macros
  */
-#define LIBBFIO_OPEN_READ			( LIBBFIO_FLAG_READ )
-#define LIBBFIO_OPEN_WRITE			( LIBBFIO_FLAG_WRITE )
-#define LIBBFIO_OPEN_READ_WRITE			( LIBBFIO_FLAG_READ | LIBBFIO_FLAG_WRITE )
-#define LIBBFIO_OPEN_WRITE_TRUNCATE		( LIBBFIO_FLAG_WRITE | LIBBFIO_FLAG_TRUNCATE )
-#define LIBBFIO_OPEN_READ_WRITE_TRUNCATE	( LIBBFIO_FLAG_READ | LIBBFIO_FLAG_WRITE | LIBBFIO_FLAG_TRUNCATE )
+#define LIBBFIO_OPEN_READ				( LIBBFIO_FLAG_READ )
+#define LIBBFIO_OPEN_WRITE				( LIBBFIO_FLAG_WRITE )
+#define LIBBFIO_OPEN_READ_WRITE				( LIBBFIO_FLAG_READ | LIBBFIO_FLAG_WRITE )
+#define LIBBFIO_OPEN_WRITE_TRUNCATE			( LIBBFIO_FLAG_WRITE | LIBBFIO_FLAG_TRUNCATE )
+#define LIBBFIO_OPEN_READ_WRITE_TRUNCATE		( LIBBFIO_FLAG_READ | LIBBFIO_FLAG_WRITE | LIBBFIO_FLAG_TRUNCATE )
 
 #define LIBBFIO_POOL_UNLIMITED_AMOUNT_OF_OPEN_HANDLES	0
 
@@ -65,10 +65,10 @@
 /* Platform specific macros
  */
 #if defined( _MSC_VER )
-#define LIBBFIO_LARGE_INTEGER_ZERO      { 0, 0 }
+#define LIBBFIO_LARGE_INTEGER_ZERO			{ 0, 0 }
 
 #elif defined( __BORLANDC__ )
-#define LIBBFIO_LARGE_INTEGER_ZERO      { 0 }
+#define LIBBFIO_LARGE_INTEGER_ZERO			{ 0 }
 
 #endif
 
diff --git a/libbfio/libbfio_error.h b/libbfio/libbfio_error.h
index 07dff93..09cbae4 100644
--- a/libbfio/libbfio_error.h
+++ b/libbfio/libbfio_error.h
@@ -2,7 +2,7 @@
  * Error functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libbfio/libbfio_error_string.c b/libbfio/libbfio_error_string.c
index 4df2174..38d1ddc 100644
--- a/libbfio/libbfio_error_string.c
+++ b/libbfio/libbfio_error_string.c
@@ -2,7 +2,7 @@
  * Error string functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libbfio/libbfio_error_string.h b/libbfio/libbfio_error_string.h
index 0ecf144..7b98886 100644
--- a/libbfio/libbfio_error_string.h
+++ b/libbfio/libbfio_error_string.h
@@ -2,7 +2,7 @@
  * Error string functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libbfio/libbfio_extern.h b/libbfio/libbfio_extern.h
index 16aa93b..5b06b42 100644
--- a/libbfio/libbfio_extern.h
+++ b/libbfio/libbfio_extern.h
@@ -2,7 +2,7 @@
  * The internal extern definition
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libbfio/libbfio_file.c b/libbfio/libbfio_file.c
index 5300d35..2ca82cb 100644
--- a/libbfio/libbfio_file.c
+++ b/libbfio/libbfio_file.c
@@ -2,7 +2,7 @@
  * File functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -233,14 +233,8 @@ int libbfio_file_io_handle_clone(
      intptr_t *source_io_handle,
      liberror_error_t **error )
 {
-	libbfio_system_character_t error_string[ LIBBFIO_ERROR_STRING_DEFAULT_SIZE ];
-
 	static char *function = "libbfio_file_io_handle_clone";
 
-#if defined( WINAPI ) && !defined( USE_CRT_FUNCTIONS )
-	DWORD error_code      = 0;
-#endif
-
 	if( destination_io_handle == NULL )
 	{
 		liberror_error_set(
@@ -252,7 +246,7 @@ int libbfio_file_io_handle_clone(
 
 		return( -1 );
 	}
-	if( *destination_io_handle == NULL )
+	if( *destination_io_handle != NULL )
 	{
 		liberror_error_set(
 		 error,
@@ -331,98 +325,6 @@ int libbfio_file_io_handle_clone(
 
 	( (libbfio_file_io_handle_t *) *destination_io_handle )->name_size = ( (libbfio_file_io_handle_t *) source_io_handle )->name_size;
 
-#if defined( WINAPI ) && !defined( USE_CRT_FUNCTIONS )
-	if( DuplicateHandle(
-	     GetCurrentProcess(),
-	     ( (libbfio_file_io_handle_t *) source_io_handle )->file_handle,
-	     GetCurrentProcess(),
-	     ( (libbfio_file_io_handle_t *) *destination_io_handle )->file_handle,
-	     0,
-	     FALSE,
-	     DUPLICATE_SAME_ACCESS ) == 0 )
-	{
-		error_code = GetLastError();
-
-		if( libbfio_error_string_copy_from_error_number(
-		     error_string,
-		     LIBBFIO_ERROR_STRING_DEFAULT_SIZE,
-		     error_code,
-		     error ) != 1 )
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_IO,
-			 LIBERROR_IO_ERROR_OPEN_FAILED,
-			 "%s: unable to duplicate file handle for file: %" PRIs_LIBBFIO_SYSTEM " with error: %" PRIs_LIBBFIO_SYSTEM "",
-			 function,
-			 ( (libbfio_file_io_handle_t *) source_io_handle )->name,
-			 error_string );
-		}
-		else
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_IO,
-			 LIBERROR_IO_ERROR_OPEN_FAILED,
-			 "%s: unable to duplicate file handle for file: %" PRIs_LIBBFIO_SYSTEM ".",
-			 function,
-			 ( (libbfio_file_io_handle_t *) source_io_handle )->name );
-		}
-		libbfio_file_io_handle_free(
-		 *destination_io_handle,
-		 NULL );
-
-		*destination_io_handle = NULL;
-
-		return( -1 );
-	}
-#else
-#if defined( WINAPI )
-	( (libbfio_file_io_handle_t *) *destination_io_handle )->file_descriptor = _dup(
-	                                                                            ( (libbfio_file_io_handle_t *) source_io_handle )->file_descriptor );
-#else
-	( (libbfio_file_io_handle_t *) *destination_io_handle )->file_descriptor = dup(
-	                                                                            ( (libbfio_file_io_handle_t *) source_io_handle )->file_descriptor );
-#endif
-
-	if( ( (libbfio_file_io_handle_t *) *destination_io_handle )->file_descriptor == -1 )
-	{
-		if( libbfio_error_string_copy_from_error_number(
-		     error_string,
-		     LIBBFIO_ERROR_STRING_DEFAULT_SIZE,
-		     errno,
-		     error ) != 1 )
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_IO,
-			 LIBERROR_IO_ERROR_OPEN_FAILED,
-			 "%s: unable to duplicate file descriptor for file: %" PRIs_LIBBFIO_SYSTEM " with error: %" PRIs_LIBBFIO_SYSTEM "",
-			 function,
-			 ( (libbfio_file_io_handle_t *) *destination_io_handle )->name,
-			 error_string );
-		}
-		else
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_IO,
-			 LIBERROR_IO_ERROR_OPEN_FAILED,
-			 "%s: unable to duplicate file descriptor for file: %" PRIs_LIBBFIO_SYSTEM ".",
-			 function,
-			 ( (libbfio_file_io_handle_t *) *destination_io_handle )->name );
-		}
-		libbfio_file_io_handle_free(
-		 *destination_io_handle,
-		 NULL );
-
-		*destination_io_handle = NULL;
-
-		return( -1 );
-	}
-#endif
-	( (libbfio_file_io_handle_t *) *destination_io_handle )->flags = ( (libbfio_file_io_handle_t *) source_io_handle )->flags;
-
 	return( 1 );
 }
 
@@ -1293,8 +1195,9 @@ int libbfio_file_open(
 		 error,
 		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
 		 LIBERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
-		 "%s: unsupported flags.",
-		 function );
+		 "%s: unsupported flags: 0x%02x.",
+		 function,
+		 flags );
 
 		return( -1 );
 	}
@@ -1303,77 +1206,84 @@ int libbfio_file_open(
 	{
 		file_io_creation_flags = CREATE_ALWAYS;
 	}
+	if( file_io_handle->file_handle != INVALID_HANDLE_VALUE )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_RUNTIME,
+		 LIBERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
+		 "%s: file handle already set.",
+		 function );
+
+		return( -1 );
+	}
+	file_io_handle->file_handle = CreateFile(
+				       (LPCTSTR) file_io_handle->name,
+				       file_io_access_flags,
+				       file_io_shared_flags,
+				       NULL,
+				       file_io_creation_flags,
+				       FILE_ATTRIBUTE_NORMAL,
+				       NULL );
 
 	if( file_io_handle->file_handle == INVALID_HANDLE_VALUE )
 	{
-		file_io_handle->file_handle = CreateFile(
-		                               (LPCTSTR) file_io_handle->name,
-		                               file_io_access_flags,
-		                               file_io_shared_flags,
-		                               NULL,
-		                               file_io_creation_flags,
-		                               FILE_ATTRIBUTE_NORMAL,
-		                               NULL );
+		error_code = GetLastError();
 
-		if( file_io_handle->file_handle == INVALID_HANDLE_VALUE )
+		switch( error_code )
 		{
-			error_code = GetLastError();
+			case ERROR_ACCESS_DENIED:
+				liberror_error_set(
+				 error,
+				 LIBERROR_ERROR_DOMAIN_IO,
+				 LIBERROR_IO_ERROR_ACCESS_DENIED,
+				 "%s: access denied to file: %" PRIs_LIBBFIO_SYSTEM ".",
+				 function,
+				 file_io_handle->name );
+
+				break;
+
+			case ERROR_FILE_NOT_FOUND:
+			case ERROR_PATH_NOT_FOUND:
+				liberror_error_set(
+				 error,
+				 LIBERROR_ERROR_DOMAIN_IO,
+				 LIBERROR_IO_ERROR_INVALID_RESOURCE,
+				 "%s: no such file: %" PRIs_LIBBFIO_SYSTEM ".",
+				 function,
+				 file_io_handle->name );
+
+				break;
 
-			switch( error_code )
-			{
-				case ERROR_ACCESS_DENIED:
+			default:
+				if( libbfio_error_string_copy_from_error_number(
+				     error_string,
+				     LIBBFIO_ERROR_STRING_DEFAULT_SIZE,
+				     error_code,
+				     error ) != 1 )
+				{
 					liberror_error_set(
 					 error,
 					 LIBERROR_ERROR_DOMAIN_IO,
-					 LIBERROR_IO_ERROR_ACCESS_DENIED,
-					 "%s: access denied to file: %" PRIs_LIBBFIO_SYSTEM ".",
+					 LIBERROR_IO_ERROR_OPEN_FAILED,
+					 "%s: unable to open file: %" PRIs_LIBBFIO_SYSTEM " with error: %" PRIs_LIBBFIO_SYSTEM "",
 					 function,
-					 file_io_handle->name );
-
-					break;
-
-				case ERROR_FILE_NOT_FOUND:
-				case ERROR_PATH_NOT_FOUND:
+					 file_io_handle->name,
+					 error_string );
+				}
+				else
+				{
 					liberror_error_set(
 					 error,
 					 LIBERROR_ERROR_DOMAIN_IO,
-					 LIBERROR_IO_ERROR_INVALID_RESOURCE,
-					 "%s: no such file: %" PRIs_LIBBFIO_SYSTEM ".",
+					 LIBERROR_IO_ERROR_OPEN_FAILED,
+					 "%s: unable to open file: %" PRIs_LIBBFIO_SYSTEM ".",
 					 function,
 					 file_io_handle->name );
-
-					break;
-
-				default:
-					if( libbfio_error_string_copy_from_error_number(
-					     error_string,
-					     LIBBFIO_ERROR_STRING_DEFAULT_SIZE,
-					     error_code,
-					     error ) != 1 )
-					{
-						liberror_error_set(
-						 error,
-						 LIBERROR_ERROR_DOMAIN_IO,
-						 LIBERROR_IO_ERROR_OPEN_FAILED,
-						 "%s: unable to open file: %" PRIs_LIBBFIO_SYSTEM " with error: %" PRIs_LIBBFIO_SYSTEM "",
-						 function,
-						 file_io_handle->name,
-						 error_string );
-					}
-					else
-					{
-						liberror_error_set(
-						 error,
-						 LIBERROR_ERROR_DOMAIN_IO,
-						 LIBERROR_IO_ERROR_OPEN_FAILED,
-						 "%s: unable to open file: %" PRIs_LIBBFIO_SYSTEM ".",
-						 function,
-						 file_io_handle->name );
-					}
-					break;
-			}
-			return( -1 );
+				}
+				break;
 		}
+		return( -1 );
 	}
 #else
 	if( ( ( flags & LIBBFIO_FLAG_READ ) == LIBBFIO_FLAG_READ )
@@ -1432,268 +1342,279 @@ int libbfio_file_open(
 		file_io_flags |= O_TRUNC;
 #endif
 	}
-	if( file_io_handle->file_descriptor == -1 )
+	if( file_io_handle->file_descriptor != -1 )
 	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_RUNTIME,
+		 LIBERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
+		 "%s: file descriptor already set.",
+		 function );
+
+		return( -1 );
+	}
 #if defined( WINAPI )
 #if defined( _MSC_VER )
 #if defined( LIBBFIO_HAVE_WIDE_SYSTEM_CHARACTER )
-		if( _wsopen_s(
-		     &( file_io_handle->file_descriptor ),
-		     (wchar_t *) file_io_handle->name,
-		     file_io_flags | _O_BINARY,
-		     file_io_shared_flags,
-		     file_io_persmission_flags ) != 0 )
+	if( _wsopen_s(
+	     &( file_io_handle->file_descriptor ),
+	     (wchar_t *) file_io_handle->name,
+	     file_io_flags | _O_BINARY,
+	     file_io_shared_flags,
+	     file_io_persmission_flags ) != 0 )
 #else
-		if( _sopen_s(
-		     &( file_io_handle->file_descriptor ),
-		     (char *) file_io_handle->name,
-		     file_io_flags | _O_BINARY,
-		     file_io_shared_flags,
-		     file_io_persmission_flags ) != 0 )
+	if( _sopen_s(
+	     &( file_io_handle->file_descriptor ),
+	     (char *) file_io_handle->name,
+	     file_io_flags | _O_BINARY,
+	     file_io_shared_flags,
+	     file_io_persmission_flags ) != 0 )
 #endif /* LIBBFIO_HAVE_WIDE_SYSTEM_CHARACTER */
 #else
 #if defined( LIBBFIO_HAVE_WIDE_SYSTEM_CHARACTER )
-		file_io_handle->file_descriptor = _wsopen(
-		                                   (wchar_t *) file_io_handle->name,
-		                                   file_io_flags | _O_BINARY,
-		                                   file_io_persmission_flags );
+	file_io_handle->file_descriptor = _wsopen(
+					   (wchar_t *) file_io_handle->name,
+					   file_io_flags | _O_BINARY,
+					   file_io_persmission_flags );
 #else
-		file_io_handle->file_descriptor = _sopen(
-		                                   (char *) file_io_handle->name,
-		                                   file_io_flags | _O_BINARY,
-		                                   file_io_persmission_flags );
+	file_io_handle->file_descriptor = _sopen(
+					   (char *) file_io_handle->name,
+					   file_io_flags | _O_BINARY,
+					   file_io_persmission_flags );
 #endif /* LIBBFIO_HAVE_WIDE_SYSTEM_CHARACTER */
-		if( file_io_handle->file_descriptor == -1 )
+
+	if( file_io_handle->file_descriptor == -1 )
 #endif /* _MSC_VER */
+	{
+		switch( errno )
 		{
-			switch( errno )
-			{
-				case EACCES:
+			case EACCES:
+				liberror_error_set(
+				 error,
+				 LIBERROR_ERROR_DOMAIN_IO,
+				 LIBERROR_IO_ERROR_ACCESS_DENIED,
+				 "%s: access denied to file: %" PRIs_LIBBFIO_SYSTEM ".",
+				 function,
+				 file_io_handle->name );
+
+				break;
+
+			case ENOENT:
+				liberror_error_set(
+				 error,
+				 LIBERROR_ERROR_DOMAIN_IO,
+				 LIBERROR_IO_ERROR_INVALID_RESOURCE,
+				 "%s: no such file: %" PRIs_LIBBFIO_SYSTEM ".",
+				 function,
+				 file_io_handle->name );
+
+				break;
+
+			default:
+				if( libbfio_error_string_copy_from_error_number(
+				     error_string,
+				     LIBBFIO_ERROR_STRING_DEFAULT_SIZE,
+				     errno,
+				     error ) != 1 )
+				{
 					liberror_error_set(
 					 error,
 					 LIBERROR_ERROR_DOMAIN_IO,
-					 LIBERROR_IO_ERROR_ACCESS_DENIED,
-					 "%s: access denied to file: %" PRIs_LIBBFIO_SYSTEM ".",
+					 LIBERROR_IO_ERROR_OPEN_FAILED,
+					 "%s: unable to open file: %" PRIs_LIBBFIO_SYSTEM " with error: %" PRIs_LIBBFIO_SYSTEM "",
 					 function,
-					 file_io_handle->name );
-
-					break;
-
-				case ENOENT:
+					 file_io_handle->name,
+					 error_string );
+				}
+				else
+				{
 					liberror_error_set(
 					 error,
 					 LIBERROR_ERROR_DOMAIN_IO,
-					 LIBERROR_IO_ERROR_INVALID_RESOURCE,
-					 "%s: no such file: %" PRIs_LIBBFIO_SYSTEM ".",
+					 LIBERROR_IO_ERROR_OPEN_FAILED,
+					 "%s: unable to open file: %" PRIs_LIBBFIO_SYSTEM ".",
 					 function,
 					 file_io_handle->name );
-
-					break;
-
-				default:
-					if( libbfio_error_string_copy_from_error_number(
-					     error_string,
-					     LIBBFIO_ERROR_STRING_DEFAULT_SIZE,
-					     errno,
-					     error ) != 1 )
-					{
-						liberror_error_set(
-						 error,
-						 LIBERROR_ERROR_DOMAIN_IO,
-						 LIBERROR_IO_ERROR_OPEN_FAILED,
-						 "%s: unable to open file: %" PRIs_LIBBFIO_SYSTEM " with error: %" PRIs_LIBBFIO_SYSTEM "",
-						 function,
-						 file_io_handle->name,
-						 error_string );
-					}
-					else
-					{
-						liberror_error_set(
-						 error,
-						 LIBERROR_ERROR_DOMAIN_IO,
-						 LIBERROR_IO_ERROR_OPEN_FAILED,
-						 "%s: unable to open file: %" PRIs_LIBBFIO_SYSTEM ".",
-						 function,
-						 file_io_handle->name );
-					}
-					break;
-			}
-			return( -1 );
+				}
+				break;
 		}
+		return( -1 );
+	}
 #if defined( _MSC_VER )
-		if( file_io_handle->file_descriptor == -1 )
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_IO,
-			 LIBERROR_IO_ERROR_OPEN_FAILED,
-			 "%s: invalid file descriptor: %d returned.",
-			 function,
-			 file_io_handle->file_descriptor );
+	if( file_io_handle->file_descriptor == -1 )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_IO,
+		 LIBERROR_IO_ERROR_OPEN_FAILED,
+		 "%s: invalid file descriptor: %d returned.",
+		 function,
+		 file_io_handle->file_descriptor );
 
-			return( -1 );
-		}
+		return( -1 );
+	}
 #endif
 #else
 #if defined( LIBBFIO_HAVE_WIDE_SYSTEM_CHARACTER )
-		/* Assumed here that the narrow open function can handle UTF-8
-		 */
+	/* Assumed here that the narrow open function can handle UTF-8
+	 */
 #if SIZEOF_WCHAR_T == 4
-		if( libuna_utf8_string_size_from_utf32(
-		     (libuna_utf32_character_t *) file_io_handle->name,
-		     file_io_handle->name_size,
-		     &narrow_filename_size,
-		     error ) != 1 )
+	if( libuna_utf8_string_size_from_utf32(
+	     (libuna_utf32_character_t *) file_io_handle->name,
+	     file_io_handle->name_size,
+	     &narrow_filename_size,
+	     error ) != 1 )
 #elif SIZEOF_WCHAR_T == 2
-		if( libuna_utf8_string_size_from_utf16(
-		     (libuna_utf16_character_t *) file_io_handle->name,
-		     file_io_handle->name_size,
-		     &narrow_filename_size,
-		     error ) != 2 )
+	if( libuna_utf8_string_size_from_utf16(
+	     (libuna_utf16_character_t *) file_io_handle->name,
+	     file_io_handle->name_size,
+	     &narrow_filename_size,
+	     error ) != 2 )
 #else
 #error Unsupported size of wchar_t
 #endif
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_CONVERSION,
-			 LIBERROR_CONVERSION_ERROR_GENERIC,
-			 "%s: unable to determine narrow character filename size.",
-			 function );
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_CONVERSION,
+		 LIBERROR_CONVERSION_ERROR_GENERIC,
+		 "%s: unable to determine narrow character filename size.",
+		 function );
 
-			return( -1 );
-		}
-		narrow_filename = (char *) memory_allocate(
-					    sizeof( char ) * narrow_filename_size );
+		return( -1 );
+	}
+	narrow_filename = (char *) memory_allocate(
+				    sizeof( char ) * narrow_filename_size );
 
-		if( narrow_filename == NULL )
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_MEMORY,
-			 LIBERROR_MEMORY_ERROR_INSUFFICIENT,
-			 "%s: unable to create narrow character filename.",
-			 function );
+	if( narrow_filename == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_MEMORY,
+		 LIBERROR_MEMORY_ERROR_INSUFFICIENT,
+		 "%s: unable to create narrow character filename.",
+		 function );
 
-			return( -1 );
-		}
+		return( -1 );
+	}
 #if SIZEOF_WCHAR_T == 4
-		if( libuna_utf8_string_copy_from_utf32(
-		     (libuna_utf8_character_t *) narrow_filename,
-		     narrow_filename_size,
-		     (libuna_utf32_character_t *) file_io_handle->name,
-		     file_io_handle->name_size,
-		     error ) != 1 )
+	if( libuna_utf8_string_copy_from_utf32(
+	     (libuna_utf8_character_t *) narrow_filename,
+	     narrow_filename_size,
+	     (libuna_utf32_character_t *) file_io_handle->name,
+	     file_io_handle->name_size,
+	     error ) != 1 )
 #elif SIZEOF_WCHAR_T == 2
-		if( libuna_utf8_string_copy_from_utf16(
-		     (libuna_utf8_character_t *) narrow_filename,
-		     narrow_filename_size,
-		     (libuna_utf16_character_t *) file_io_handle->name,
-		     file_io_handle->name_size,
-		     error ) != 1 )
+	if( libuna_utf8_string_copy_from_utf16(
+	     (libuna_utf8_character_t *) narrow_filename,
+	     narrow_filename_size,
+	     (libuna_utf16_character_t *) file_io_handle->name,
+	     file_io_handle->name_size,
+	     error ) != 1 )
 #else
 #error Unsupported size of wchar_t
 #endif
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_CONVERSION,
-			 LIBERROR_CONVERSION_ERROR_GENERIC,
-			 "%s: unable to set narrow character filename.",
-			 function );
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_CONVERSION,
+		 LIBERROR_CONVERSION_ERROR_GENERIC,
+		 "%s: unable to set narrow character filename.",
+		 function );
 
-			memory_free(
-			 narrow_filename );
+		memory_free(
+		 narrow_filename );
 
-			return( -1 );
-		}
+		return( -1 );
+	}
 #if defined( HAVE_GLIB_H )
-		file_io_handle->file_descriptor = g_open(
-		                                   narrow_filename,
-		                                   file_io_flags,
-		                                   0644 );
+	file_io_handle->file_descriptor = g_open(
+					   narrow_filename,
+					   file_io_flags,
+					   0644 );
 #else
-		file_io_handle->file_descriptor = open(
-		                                   narrow_filename,
-		                                   file_io_flags,
-		                                   0644 );
+	file_io_handle->file_descriptor = open(
+					   narrow_filename,
+					   file_io_flags,
+					   0644 );
 #endif /* HAVE_GLIB_H */
 
-		memory_free(
-		 narrow_filename );
+	memory_free(
+	 narrow_filename );
 #else
 #if defined( HAVE_GLIB_H )
-		file_io_handle->file_descriptor = g_open(
-		                                   file_io_handle->name,
-		                                   file_io_flags,
-		                                   0644 );
+	file_io_handle->file_descriptor = g_open(
+					   file_io_handle->name,
+					   file_io_flags,
+					   0644 );
 #else
-		file_io_handle->file_descriptor = open(
-		                                   file_io_handle->name,
-		                                   file_io_flags,
-		                                   0644 );
+	file_io_handle->file_descriptor = open(
+					   file_io_handle->name,
+					   file_io_flags,
+					   0644 );
 #endif /* HAVE_GLIB_H */
 #endif
 
-		if( file_io_handle->file_descriptor == -1 )
+	if( file_io_handle->file_descriptor == -1 )
+	{
+		switch( errno )
 		{
-			switch( errno )
-			{
-				case EACCES:
+			case EACCES:
+				liberror_error_set(
+				 error,
+				 LIBERROR_ERROR_DOMAIN_IO,
+				 LIBERROR_IO_ERROR_ACCESS_DENIED,
+				 "%s: access denied to file: %" PRIs_LIBBFIO_SYSTEM ".",
+				 function,
+				 file_io_handle->name );
+
+				break;
+
+			case ENOENT:
+				liberror_error_set(
+				 error,
+				 LIBERROR_ERROR_DOMAIN_IO,
+				 LIBERROR_IO_ERROR_INVALID_RESOURCE,
+				 "%s: no such file: %" PRIs_LIBBFIO_SYSTEM ".",
+				 function,
+				 file_io_handle->name );
+
+				break;
+
+			default:
+				if( libbfio_error_string_copy_from_error_number(
+				     error_string,
+				     LIBBFIO_ERROR_STRING_DEFAULT_SIZE,
+				     errno,
+				     error ) != 1 )
+				{
 					liberror_error_set(
 					 error,
 					 LIBERROR_ERROR_DOMAIN_IO,
-					 LIBERROR_IO_ERROR_ACCESS_DENIED,
-					 "%s: access denied to file: %" PRIs_LIBBFIO_SYSTEM ".",
+					 LIBERROR_IO_ERROR_OPEN_FAILED,
+					 "%s: unable to open file: %" PRIs_LIBBFIO_SYSTEM " with error: %" PRIs_LIBBFIO_SYSTEM "",
 					 function,
-					 file_io_handle->name );
-
-					break;
-
-				case ENOENT:
+					 file_io_handle->name,
+					 error_string );
+				}
+				else
+				{
 					liberror_error_set(
 					 error,
 					 LIBERROR_ERROR_DOMAIN_IO,
-					 LIBERROR_IO_ERROR_INVALID_RESOURCE,
-					 "%s: no such file: %" PRIs_LIBBFIO_SYSTEM ".",
+					 LIBERROR_IO_ERROR_OPEN_FAILED,
+					 "%s: unable to open file: %" PRIs_LIBBFIO_SYSTEM ".",
 					 function,
 					 file_io_handle->name );
-
-					break;
-
-				default:
-					if( libbfio_error_string_copy_from_error_number(
-					     error_string,
-					     LIBBFIO_ERROR_STRING_DEFAULT_SIZE,
-					     errno,
-					     error ) != 1 )
-					{
-						liberror_error_set(
-						 error,
-						 LIBERROR_ERROR_DOMAIN_IO,
-						 LIBERROR_IO_ERROR_OPEN_FAILED,
-						 "%s: unable to open file: %" PRIs_LIBBFIO_SYSTEM " with error: %" PRIs_LIBBFIO_SYSTEM "",
-						 function,
-						 file_io_handle->name,
-						 error_string );
-					}
-					else
-					{
-						liberror_error_set(
-						 error,
-						 LIBERROR_ERROR_DOMAIN_IO,
-						 LIBERROR_IO_ERROR_OPEN_FAILED,
-						 "%s: unable to open file: %" PRIs_LIBBFIO_SYSTEM ".",
-						 function,
-						 file_io_handle->name );
-					}
-					break;
-			}
-			return( -1 );
+				}
+				break;
 		}
-#endif
+		return( -1 );
 	}
 #endif
+#endif
+	file_io_handle->access_flags = flags;
+
 	return( 1 );
 }
 
@@ -1834,6 +1755,8 @@ int libbfio_file_close(
 	}
 	file_io_handle->file_descriptor = -1;
 #endif
+	file_io_handle->access_flags = 0;
+
 	return( 0 );
 }
 
diff --git a/libbfio/libbfio_file.h b/libbfio/libbfio_file.h
index d86f6b6..6885b37 100644
--- a/libbfio/libbfio_file.h
+++ b/libbfio/libbfio_file.h
@@ -2,7 +2,7 @@
  * File functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -60,9 +60,9 @@ struct libbfio_file_io_handle
 	int file_descriptor;
 #endif
 
-	/* The flags
+	/* The access flags
 	 */
-	int flags;
+	int access_flags;
 };
 
 int libbfio_file_io_handle_initialize(
diff --git a/libbfio/libbfio_handle.c b/libbfio/libbfio_handle.c
index 967f53e..9654ee9 100644
--- a/libbfio/libbfio_handle.c
+++ b/libbfio/libbfio_handle.c
@@ -2,7 +2,7 @@
  * The internal handle functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -222,7 +222,7 @@ int libbfio_handle_clone(
 
 		return( -1 );
 	}
-	if( *destination_handle == NULL )
+	if( *destination_handle != NULL )
 	{
 		liberror_error_set(
 		 error,
@@ -321,6 +321,43 @@ int libbfio_handle_clone(
 
 		return( -1 );
 	}
+	if( libbfio_handle_open(
+	     *destination_handle,
+	     internal_source_handle->flags,
+	     error ) == -1 )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_IO,
+		 LIBERROR_IO_ERROR_OPEN_FAILED,
+		 "%s: unable to open destination handle.",
+		 function );
+
+		internal_source_handle->free_io_handle(
+		 destination_io_handle,
+		 NULL );
+
+		return( -1 );
+	}
+	if( libbfio_handle_seek_offset(
+	     *destination_handle,
+	     internal_source_handle->offset,
+	     SEEK_SET,
+	     error ) == -1 )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_IO,
+		 LIBERROR_IO_ERROR_SEEK_FAILED,
+		 "%s: unable to seek offset in destination handle.",
+		 function );
+
+		internal_source_handle->free_io_handle(
+		 destination_io_handle,
+		 NULL );
+
+		return( -1 );
+	}
 	return( 1 );
 }
 
@@ -377,21 +414,36 @@ int libbfio_handle_open(
 		 error,
 		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
 		 LIBERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
-		 "%s: unsupported flags.",
-		 function );
+		 "%s: unsupported flags: 0x%02x.",
+		 function,
+		 flags );
 
 		return( -1 );
 	}
-	if( internal_handle->open(
-	     internal_handle->io_handle,
-	     flags,
-	     error ) != 1 )
+	if( internal_handle->open_on_demand == 0 )
+	{
+		if( internal_handle->open(
+		     internal_handle->io_handle,
+		     flags,
+		     error ) != 1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_IO,
+			 LIBERROR_IO_ERROR_OPEN_FAILED,
+			 "%s: unable to open handle.",
+			 function );
+
+			return( -1 );
+		}
+	}
+	else if( ( flags & LIBBFIO_FLAG_WRITE ) == LIBBFIO_FLAG_WRITE )
 	{
 		liberror_error_set(
 		 error,
-		 LIBERROR_ERROR_DOMAIN_IO,
-		 LIBERROR_IO_ERROR_OPEN_FAILED,
-		 "%s: unable to open handle.",
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
+		 "%s: open on demand cannot be used in combination with write access.",
 		 function );
 
 		return( -1 );
@@ -498,42 +550,48 @@ int libbfio_handle_reopen(
 
 			return( -1 );
 		}
-		if( internal_handle->open(
-		     internal_handle->io_handle,
-		     flags,
-		     error ) != 1 )
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_IO,
-			 LIBERROR_IO_ERROR_OPEN_FAILED,
-			 "%s: unable to open handle.",
-			 function );
-
-			return( -1 );
-		}
-		internal_handle->flags = flags;
-
-		/* Seek the previous file offset only when at least reading the file
-		 */
-		if( ( flags & LIBBFIO_FLAG_READ ) == LIBBFIO_FLAG_READ )
+		if( internal_handle->open_on_demand == 0 )
 		{
-			if( internal_handle->seek_offset(
+			if( internal_handle->open(
 			     internal_handle->io_handle,
-			     internal_handle->offset,
-			     SEEK_CUR,
-			     error ) == -1 )
+			     flags,
+			     error ) != 1 )
 			{
 				liberror_error_set(
 				 error,
 				 LIBERROR_ERROR_DOMAIN_IO,
-				 LIBERROR_IO_ERROR_SEEK_FAILED,
-				 "%s: unable to seek offset in handle.",
+				 LIBERROR_IO_ERROR_OPEN_FAILED,
+				 "%s: unable to open handle.",
 				 function );
 
 				return( -1 );
 			}
 		}
+		internal_handle->flags = flags;
+
+		if( internal_handle->open_on_demand == 0 )
+		{
+			/* Seek the previous file offset only when at least reading the file
+			 */
+			if( ( internal_handle->flags & LIBBFIO_FLAG_READ ) == LIBBFIO_FLAG_READ )
+			{
+				if( internal_handle->seek_offset(
+				     internal_handle->io_handle,
+				     internal_handle->offset,
+				     SEEK_CUR,
+				     error ) == -1 )
+				{
+					liberror_error_set(
+					 error,
+					 LIBERROR_ERROR_DOMAIN_IO,
+					 LIBERROR_IO_ERROR_SEEK_FAILED,
+					 "%s: unable to seek offset in handle.",
+					 function );
+
+					return( -1 );
+				}
+			}
+		}
 	}
 	return( 1 );
 }
@@ -547,6 +605,7 @@ int libbfio_handle_close(
 {
 	libbfio_internal_handle_t *internal_handle = NULL;
 	static char *function                      = "libbfio_handle_close";
+	int is_open                                = 0;
 
 	if( handle == NULL )
 	{
@@ -583,6 +642,39 @@ int libbfio_handle_close(
 
 		return( -1 );
 	}
+	if( internal_handle->open_on_demand != 0 )
+	{
+		if( internal_handle->is_open == NULL )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_RUNTIME,
+			 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
+			 "%s: invalid handle - missing is open function.",
+			 function );
+
+			return( -1 );
+		}
+		is_open = internal_handle->is_open(
+			   internal_handle->io_handle,
+		           error );
+
+		if( is_open == -1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_IO,
+			 LIBERROR_IO_ERROR_OPEN_FAILED,
+			 "%s: unable to determine if handle is open.",
+			 function );
+
+			return( -1 );
+		}
+		else if( is_open == 0 )
+		{
+			return( 0 );
+		}
+	}
 	if( internal_handle->close(
 	     internal_handle->io_handle,
 	     error ) != 0 )
@@ -611,6 +703,7 @@ ssize_t libbfio_handle_read(
 	libbfio_internal_handle_t *internal_handle = NULL;
 	static char *function                      = "libbfio_handle_read";
 	ssize_t read_count                         = 0;
+	int is_open                                = 0;
 
 	if( handle == NULL )
 	{
@@ -658,6 +751,90 @@ ssize_t libbfio_handle_read(
 
 		return( -1 );
 	}
+	if( internal_handle->open_on_demand != 0 )
+	{
+		if( internal_handle->is_open == NULL )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_RUNTIME,
+			 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
+			 "%s: invalid handle - missing is open function.",
+			 function );
+
+			return( -1 );
+		}
+		if( internal_handle->open == NULL )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_RUNTIME,
+			 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
+			 "%s: invalid handle - missing open function.",
+			 function );
+
+			return( -1 );
+		}
+		if( internal_handle->seek_offset == NULL )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_RUNTIME,
+			 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
+			 "%s: invalid handle - missing seek offset function.",
+			 function );
+
+			return( -1 );
+		}
+		is_open = internal_handle->is_open(
+			   internal_handle->io_handle,
+		           error );
+
+		if( is_open == -1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_IO,
+			 LIBERROR_IO_ERROR_OPEN_FAILED,
+			 "%s: unable to determine if handle is open.",
+			 function );
+
+			return( -1 );
+		}
+		else if( is_open == 0 )
+		{
+			if( internal_handle->open(
+			     internal_handle->io_handle,
+			     internal_handle->flags,
+			     error ) != 1 )
+			{
+				liberror_error_set(
+				 error,
+				 LIBERROR_ERROR_DOMAIN_IO,
+				 LIBERROR_IO_ERROR_OPEN_FAILED,
+				 "%s: unable to open handle on demand.",
+				 function );
+
+				return( -1 );
+			}
+			if( internal_handle->seek_offset(
+			     internal_handle->io_handle,
+			     internal_handle->offset,
+			     SEEK_SET,
+			     error ) == -1 )
+			{
+				liberror_error_set(
+				 error,
+				 LIBERROR_ERROR_DOMAIN_IO,
+				 LIBERROR_IO_ERROR_SEEK_FAILED,
+				 "%s: unable to find current offset: %" PRIi64 " in handle.",
+				 function,
+				 internal_handle->offset );
+
+				return( -1 );
+			}
+		}
+	}
 	read_count = internal_handle->read(
 	              internal_handle->io_handle,
 	              buffer,
@@ -706,6 +883,33 @@ ssize_t libbfio_handle_read(
 	}
 	internal_handle->offset += (off64_t) read_count;
 
+	if( internal_handle->open_on_demand != 0 )
+	{
+		if( internal_handle->close == NULL )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_RUNTIME,
+			 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
+			 "%s: invalid handle - missing close function.",
+			 function );
+
+			return( -1 );
+		}
+		if( internal_handle->close(
+		     internal_handle->io_handle,
+		     error ) != 0 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_IO,
+			 LIBERROR_IO_ERROR_OPEN_FAILED,
+			 "%s: unable to close handle on demand.",
+			 function );
+
+			return( -1 );
+		}
+	}
 	return( read_count );
 }
 
@@ -801,6 +1005,7 @@ off64_t libbfio_handle_seek_offset(
 {
 	libbfio_internal_handle_t *internal_handle = NULL;
 	static char *function                      = "libbfio_handle_seek_offset";
+	int is_open                                = 0;
 
 	if( handle == NULL )
 	{
@@ -852,11 +1057,84 @@ off64_t libbfio_handle_seek_offset(
 	}
 	if( internal_handle->offset != offset )
 	{
+		if( internal_handle->open_on_demand != 0 )
+		{
+			if( internal_handle->is_open == NULL )
+			{
+				liberror_error_set(
+				 error,
+				 LIBERROR_ERROR_DOMAIN_RUNTIME,
+				 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
+				 "%s: invalid handle - missing is open function.",
+				 function );
+
+				return( -1 );
+			}
+			if( internal_handle->open == NULL )
+			{
+				liberror_error_set(
+				 error,
+				 LIBERROR_ERROR_DOMAIN_RUNTIME,
+				 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
+				 "%s: invalid handle - missing open function.",
+				 function );
+
+				return( -1 );
+			}
+			is_open = internal_handle->is_open(
+				   internal_handle->io_handle,
+				   error );
+
+			if( is_open == -1 )
+			{
+				liberror_error_set(
+				 error,
+				 LIBERROR_ERROR_DOMAIN_IO,
+				 LIBERROR_IO_ERROR_OPEN_FAILED,
+				 "%s: unable to determine if handle is open.",
+				 function );
+
+				return( -1 );
+			}
+			else if( is_open == 0 )
+			{
+				if( internal_handle->open(
+				     internal_handle->io_handle,
+				     internal_handle->flags,
+				     error ) != 1 )
+				{
+					liberror_error_set(
+					 error,
+					 LIBERROR_ERROR_DOMAIN_IO,
+					 LIBERROR_IO_ERROR_OPEN_FAILED,
+					 "%s: unable to open handle on demand.",
+					 function );
+
+					return( -1 );
+				}
+				if( internal_handle->seek_offset(
+				     internal_handle->io_handle,
+				     internal_handle->offset,
+				     SEEK_SET,
+				     error ) == -1 )
+				{
+					liberror_error_set(
+					 error,
+					 LIBERROR_ERROR_DOMAIN_IO,
+					 LIBERROR_IO_ERROR_SEEK_FAILED,
+					 "%s: unable to find current offset: %" PRIi64 " in handle.",
+					 function,
+					 internal_handle->offset );
+
+					return( -1 );
+				}
+			}
+		}
 		offset = internal_handle->seek_offset(
-		          internal_handle->io_handle,
-		          offset,
-		          whence,
-		          error );
+			  internal_handle->io_handle,
+			  offset,
+			  whence,
+			  error );
 
 		if( offset == -1 )
 		{
@@ -864,7 +1142,7 @@ off64_t libbfio_handle_seek_offset(
 			 error,
 			 LIBERROR_ERROR_DOMAIN_IO,
 			 LIBERROR_IO_ERROR_SEEK_FAILED,
-			 "%s: unable to find offset: %" PRIjd " in handle.",
+			 "%s: unable to find offset: %" PRIi64 " in handle.",
 			 function,
 			 offset );
 
@@ -1204,8 +1482,51 @@ int libbfio_handle_get_offset(
 	return( 1 );
 }
 
+/* Set the value to have the library open and close 
+ * the systems file descriptor or handle on demand
+ * 0 disables open on demand any other value enables it
+ * Returns 1 if successful or -1 on error
+ */
+int libbfio_handle_set_open_on_demand(
+     libbfio_handle_t *handle,
+     uint8_t open_on_demand,
+     liberror_error_t **error )
+{
+	libbfio_internal_handle_t *internal_handle = NULL;
+	static char *function                      = "libbfio_handle_set_open_on_demand";
+
+	if( handle == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid handle.",
+		 function );
+
+		return( -1 );
+	}
+	internal_handle = (libbfio_internal_handle_t *) handle;
+
+	if( ( ( internal_handle->flags & LIBBFIO_FLAG_WRITE ) == LIBBFIO_FLAG_WRITE )
+	 && ( open_on_demand != 0 ) )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
+		 "%s: open on demand cannot be used in combination with write access.",
+		 function );
+
+		return( -1 );
+	}
+	internal_handle->open_on_demand = open_on_demand;
+
+	return( 1 );
+}
+
 /* Set the value to have the library track the offsets read
- * 0 disables tracking any other value enables tracking
+ * 0 disables tracking any other value enables it
  * Returns 1 if successful or -1 on error
  */
 int libbfio_handle_set_track_offsets_read(
diff --git a/libbfio/libbfio_handle.h b/libbfio/libbfio_handle.h
index 06710e6..64a921c 100644
--- a/libbfio/libbfio_handle.h
+++ b/libbfio/libbfio_handle.h
@@ -2,7 +2,7 @@
  * The internal handle functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -60,6 +60,11 @@ struct libbfio_internal_handle
 	 */
 	uint8_t size_set;
 
+	/* Value to indicate to open and close
+	 * the systems file descriptor or handle on demand
+	 */
+	uint8_t open_on_demand;
+
 	/* Reference to the pool last used list element
 	 */
 	libbfio_list_element_t *pool_last_used_list_element;
@@ -227,6 +232,11 @@ LIBBFIO_EXTERN int libbfio_handle_get_offset(
                     off64_t *offset,
                     liberror_error_t **error );
 
+LIBBFIO_EXTERN int libbfio_handle_set_open_on_demand(
+                    libbfio_handle_t *handle,
+                    uint8_t open_on_demand,
+                    liberror_error_t **error );
+
 LIBBFIO_EXTERN int libbfio_handle_set_track_offsets_read(
                     libbfio_handle_t *handle,
                     uint8_t track_offsets_read,
diff --git a/libbfio/libbfio_libuna.h b/libbfio/libbfio_libuna.h
index 8fe67c7..845c984 100644
--- a/libbfio/libbfio_libuna.h
+++ b/libbfio/libbfio_libuna.h
@@ -2,7 +2,7 @@
  * The internal libuna header
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libbfio/libbfio_list_type.c b/libbfio/libbfio_list_type.c
index e1d6005..950fe7c 100644
--- a/libbfio/libbfio_list_type.c
+++ b/libbfio/libbfio_list_type.c
@@ -2,7 +2,7 @@
  * List type functions
  *
  * Copyright (C) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libbfio/libbfio_list_type.h b/libbfio/libbfio_list_type.h
index edf444f..cd02a97 100644
--- a/libbfio/libbfio_list_type.h
+++ b/libbfio/libbfio_list_type.h
@@ -2,7 +2,7 @@
  * List type functions
  *
  * Copyright (C) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libbfio/libbfio_memory_range.c b/libbfio/libbfio_memory_range.c
index db11d46..0b484f6 100644
--- a/libbfio/libbfio_memory_range.c
+++ b/libbfio/libbfio_memory_range.c
@@ -1,8 +1,8 @@
 /*
- * File functions
+ * Memory range functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -22,9 +22,7 @@
 
 #include <common.h>
 #include <memory.h>
-#include <narrow_string.h>
 #include <types.h>
-#include <wide_string.h>
 
 #include <liberror.h>
 
@@ -206,7 +204,7 @@ int libbfio_memory_range_io_handle_clone(
 
 		return( -1 );
 	}
-	if( *destination_io_handle == NULL )
+	if( *destination_io_handle != NULL )
 	{
 		liberror_error_set(
 		 error,
@@ -418,6 +416,17 @@ int libbfio_memory_range_open(
 
 		return( -1 );
 	}
+	if( memory_range_io_handle->access_flags != 0 )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_RUNTIME,
+		 LIBERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
+		 "%s: IO handle already open.",
+		 function );
+
+		return( -1 );
+	}
 	/* Either read or write flag should be set
 	 */
 	if( ( ( flags & LIBBFIO_FLAG_READ ) == 0 )
@@ -427,13 +436,13 @@ int libbfio_memory_range_open(
 		 error,
 		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
 		 LIBERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
-		 "%s: unsupported flags.",
+		 "%s: unsupported flags: 0x%02x.",
 		 function );
 
 		return( -1 );
 	}
 	memory_range_io_handle->range_offset = 0;
-	memory_range_io_handle->access_flags = (uint8_t) flags;
+	memory_range_io_handle->access_flags = flags;
 
 	return( 1 );
 }
@@ -742,6 +751,17 @@ off64_t libbfio_memory_range_seek_offset(
 
 		return( -1 );
 	}
+	if( memory_range_io_handle->access_flags == 0 )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_RUNTIME,
+		 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
+		 "%s: invalid IO handle - no access.",
+		 function );
+
+		return( -1 );
+	}
 	if( offset > (off64_t) INT64_MAX )
 	{
 		liberror_error_set(
diff --git a/libbfio/libbfio_memory_range.h b/libbfio/libbfio_memory_range.h
index 1530c74..f4c9e1f 100644
--- a/libbfio/libbfio_memory_range.h
+++ b/libbfio/libbfio_memory_range.h
@@ -2,7 +2,7 @@
  * Memory range functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -24,9 +24,7 @@
 #define _LIBBFIO_MEMORY_RANGE_H
 
 #include <common.h>
-#include <narrow_string.h>
 #include <types.h>
-#include <wide_string.h>
 
 #include <liberror.h>
 
@@ -56,7 +54,7 @@ struct libbfio_memory_range_io_handle
 
 	/* Value to indicate the current access flags
 	 */
-	uint8_t access_flags;
+	int access_flags;
 };
 
 int libbfio_memory_range_io_handle_initialize(
diff --git a/libbfio/libbfio_offset_list.c b/libbfio/libbfio_offset_list.c
index ec6d9d9..2b8740c 100644
--- a/libbfio/libbfio_offset_list.c
+++ b/libbfio/libbfio_offset_list.c
@@ -2,7 +2,7 @@
  * Offset list
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libbfio/libbfio_offset_list.h b/libbfio/libbfio_offset_list.h
index 1883de1..b73449d 100644
--- a/libbfio/libbfio_offset_list.h
+++ b/libbfio/libbfio_offset_list.h
@@ -2,7 +2,7 @@
  * Offset list
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libbfio/libbfio_pool.c b/libbfio/libbfio_pool.c
index 1c9e3e5..e488f5d 100644
--- a/libbfio/libbfio_pool.c
+++ b/libbfio/libbfio_pool.c
@@ -2,7 +2,7 @@
  * The internal pool functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libbfio/libbfio_pool.h b/libbfio/libbfio_pool.h
index a8fd338..a224617 100644
--- a/libbfio/libbfio_pool.h
+++ b/libbfio/libbfio_pool.h
@@ -2,7 +2,7 @@
  * The internal pool functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libbfio/libbfio_support.c b/libbfio/libbfio_support.c
index eba227c..132c627 100644
--- a/libbfio/libbfio_support.c
+++ b/libbfio/libbfio_support.c
@@ -2,7 +2,7 @@
  * Support functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libbfio/libbfio_support.h b/libbfio/libbfio_support.h
index 5f9f06d..49598f0 100644
--- a/libbfio/libbfio_support.h
+++ b/libbfio/libbfio_support.h
@@ -2,7 +2,7 @@
  * Support functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libbfio/libbfio_system_string.h b/libbfio/libbfio_system_string.h
index b2e32fe..dfc560b 100644
--- a/libbfio/libbfio_system_string.h
+++ b/libbfio/libbfio_system_string.h
@@ -2,7 +2,7 @@
  * System character type string functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libbfio/libbfio_types.h b/libbfio/libbfio_types.h
index 956c274..8dbdee1 100644
--- a/libbfio/libbfio_types.h
+++ b/libbfio/libbfio_types.h
@@ -2,7 +2,7 @@
  * The internal type definitions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/liberror/liberror.h b/liberror/liberror.h
index eb82472..6e80708 100644
--- a/liberror/liberror.h
+++ b/liberror/liberror.h
@@ -2,7 +2,7 @@
  * The include header
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/liberror/liberror_definitions.h b/liberror/liberror_definitions.h
index 2cd79b6..b3833b3 100644
--- a/liberror/liberror_definitions.h
+++ b/liberror/liberror_definitions.h
@@ -2,7 +2,7 @@
  * The internal definitions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/liberror/liberror_error.c b/liberror/liberror_error.c
index 85e8839..d24a086 100644
--- a/liberror/liberror_error.c
+++ b/liberror/liberror_error.c
@@ -2,7 +2,7 @@
  * Error functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/liberror/liberror_error.h b/liberror/liberror_error.h
index fb1ee29..eb39d1b 100644
--- a/liberror/liberror_error.h
+++ b/liberror/liberror_error.h
@@ -2,7 +2,7 @@
  * Error functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/liberror/liberror_types.h b/liberror/liberror_types.h
index d078249..428fe5e 100644
--- a/liberror/liberror_types.h
+++ b/liberror/liberror_types.h
@@ -2,7 +2,7 @@
  * The internal type definitions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf.pc b/libewf.pc
index 142300c..e98d29f 100644
--- a/libewf.pc
+++ b/libewf.pc
@@ -5,7 +5,7 @@ includedir=${prefix}/include
 
 Name: libewf
 Description: Library to support the Expert Witness Compression Format (EWF)
-Version: 20091003
+Version: 20091114
 Libs: -L${libdir} -lewf
 Libs.private: -lz  
 Cflags: -I${includedir}
diff --git a/libewf.spec b/libewf.spec
index be7886c..dd41c51 100644
--- a/libewf.spec
+++ b/libewf.spec
@@ -1,5 +1,5 @@
 Name: libewf
-Version: 20091003
+Version: 20091114
 Release: 1
 Summary: Library to support the Expert Witness Compression Format
 Group: System Environment/Libraries
@@ -77,11 +77,10 @@ rm -rf ${RPM_BUILD_ROOT}
 %attr(755,root,root) %{_bindir}/ewfverify
 %{_mandir}/man1/*
 
-### Exclude expirimental files ###
-%exclude %{_bindir}/ewfalter
-%exclude %{_bindir}/ewfdebug
-
 %changelog
+* Sat Nov 14 2009 Joachim Metz <forensics at hoffmannbv.nl> 20091114-1
+- Removed ewfalter and ewfdebug exclusion for stable release
+
 * Fri Aug 28 2009 Joachim Metz <forensics at hoffmannbv.nl> 20090828-1
 - Added dynamic support for libuuid requires and build requires
 
diff --git a/libewf.spec.in b/libewf.spec.in
index 054ceac..1e45657 100644
--- a/libewf.spec.in
+++ b/libewf.spec.in
@@ -77,11 +77,10 @@ rm -rf ${RPM_BUILD_ROOT}
 %attr(755,root,root) %{_bindir}/ewfverify
 %{_mandir}/man1/*
 
-### Exclude expirimental files ###
-%exclude %{_bindir}/ewfalter
-%exclude %{_bindir}/ewfdebug
-
 %changelog
+* Sat Nov 14 2009 Joachim Metz <forensics at hoffmannbv.nl> 20091114-1
+- Removed ewfalter and ewfdebug exclusion for stable release
+
 * Fri Aug 28 2009 Joachim Metz <forensics at hoffmannbv.nl> 20090828-1
 - Added dynamic support for libuuid requires and build requires
 
diff --git a/libewf/Makefile.am b/libewf/Makefile.am
index 226d107..c8252cf 100644
--- a/libewf/Makefile.am
+++ b/libewf/Makefile.am
@@ -1,4 +1,11 @@
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/common -I$(top_srcdir)/liberror -I$(top_srcdir)/libnotify @LIBUNA_CPPFLAGS@ @LIBBFIO_CPPFLAGS@ @MEMWATCH_CPPFLAGS@
+AM_CPPFLAGS = \
+	-I$(top_srcdir)/include \
+	-I$(top_srcdir)/common \
+	-I$(top_srcdir)/liberror \
+	-I$(top_srcdir)/libnotify \
+	@LIBUNA_CPPFLAGS@ \
+	@LIBBFIO_CPPFLAGS@ \
+	@MEMWATCH_CPPFLAGS@
 
 lib_LTLIBRARIES = libewf.la
 
@@ -20,11 +27,13 @@ libewf_la_SOURCES = \
 	libewf.c \
 	libewf_chunk_cache.c libewf_chunk_cache.h \
 	libewf_chunk_offset.h \
+	libewf_codepage.h \
 	libewf_compression.c libewf_compression.h \
 	libewf_date_time.c libewf_date_time.h \
 	libewf_date_time_values.c libewf_date_time_values.h \
 	libewf_debug.c libewf_debug.h \
 	libewf_definitions.h \
+	libewf_empty_block.c libewf_empty_block.h \
 	libewf_error.c libewf_error.h \
 	libewf_extern.h \
 	libewf_filename.c libewf_filename.h \
@@ -56,7 +65,11 @@ libewf_la_SOURCES = \
 	libewf_values_table.c libewf_values_table.h \
 	libewf_write_io_handle.c libewf_write_io_handle.h
 
-libewf_la_LIBADD  = ../liberror/liberror.la ../libnotify/libnotify.la @LIBUNA_LIBADD@ @LIBBFIO_LIBADD@
+libewf_la_LIBADD = \
+	../liberror/liberror.la \
+	../libnotify/libnotify.la \
+	@LIBUNA_LIBADD@ \
+	@LIBBFIO_LIBADD@
 
 if HAVE_V2_API
 libewf_la_LDFLAGS = -no-undefined -version-info 2:0:0
diff --git a/libewf/Makefile.in b/libewf/Makefile.in
index e8cf1db..6d47824 100644
--- a/libewf/Makefile.in
+++ b/libewf/Makefile.in
@@ -75,17 +75,18 @@ libewf_la_DEPENDENCIES = ../liberror/liberror.la \
 	../libnotify/libnotify.la
 am_libewf_la_OBJECTS = libewf.lo libewf_chunk_cache.lo \
 	libewf_compression.lo libewf_date_time.lo \
-	libewf_date_time_values.lo libewf_debug.lo libewf_error.lo \
-	libewf_filename.lo libewf_handle.lo libewf_hash_sections.lo \
-	libewf_hash_values.lo libewf_header_sections.lo \
-	libewf_header_values.lo libewf_io_handle.lo libewf_legacy.lo \
-	libewf_list_type.lo libewf_media_values.lo libewf_metadata.lo \
-	libewf_notify.lo libewf_offset_table.lo \
-	libewf_read_io_handle.lo libewf_section.lo \
-	libewf_section_list.lo libewf_sector_table.lo \
-	libewf_segment_file.lo libewf_segment_file_handle.lo \
-	libewf_segment_table.lo libewf_string.lo libewf_support.lo \
-	libewf_values_table.lo libewf_write_io_handle.lo
+	libewf_date_time_values.lo libewf_debug.lo \
+	libewf_empty_block.lo libewf_error.lo libewf_filename.lo \
+	libewf_handle.lo libewf_hash_sections.lo libewf_hash_values.lo \
+	libewf_header_sections.lo libewf_header_values.lo \
+	libewf_io_handle.lo libewf_legacy.lo libewf_list_type.lo \
+	libewf_media_values.lo libewf_metadata.lo libewf_notify.lo \
+	libewf_offset_table.lo libewf_read_io_handle.lo \
+	libewf_section.lo libewf_section_list.lo \
+	libewf_sector_table.lo libewf_segment_file.lo \
+	libewf_segment_file_handle.lo libewf_segment_table.lo \
+	libewf_string.lo libewf_support.lo libewf_values_table.lo \
+	libewf_write_io_handle.lo
 libewf_la_OBJECTS = $(am_libewf_la_OBJECTS)
 libewf_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -268,7 +269,15 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/common -I$(top_srcdir)/liberror -I$(top_srcdir)/libnotify @LIBUNA_CPPFLAGS@ @LIBBFIO_CPPFLAGS@ @MEMWATCH_CPPFLAGS@
+AM_CPPFLAGS = \
+	-I$(top_srcdir)/include \
+	-I$(top_srcdir)/common \
+	-I$(top_srcdir)/liberror \
+	-I$(top_srcdir)/libnotify \
+	@LIBUNA_CPPFLAGS@ \
+	@LIBBFIO_CPPFLAGS@ \
+	@MEMWATCH_CPPFLAGS@
+
 lib_LTLIBRARIES = libewf.la
 libewf_la_SOURCES = \
 	ewf_crc.h \
@@ -288,11 +297,13 @@ libewf_la_SOURCES = \
 	libewf.c \
 	libewf_chunk_cache.c libewf_chunk_cache.h \
 	libewf_chunk_offset.h \
+	libewf_codepage.h \
 	libewf_compression.c libewf_compression.h \
 	libewf_date_time.c libewf_date_time.h \
 	libewf_date_time_values.c libewf_date_time_values.h \
 	libewf_debug.c libewf_debug.h \
 	libewf_definitions.h \
+	libewf_empty_block.c libewf_empty_block.h \
 	libewf_error.c libewf_error.h \
 	libewf_extern.h \
 	libewf_filename.c libewf_filename.h \
@@ -324,7 +335,12 @@ libewf_la_SOURCES = \
 	libewf_values_table.c libewf_values_table.h \
 	libewf_write_io_handle.c libewf_write_io_handle.h
 
-libewf_la_LIBADD = ../liberror/liberror.la ../libnotify/libnotify.la @LIBUNA_LIBADD@ @LIBBFIO_LIBADD@
+libewf_la_LIBADD = \
+	../liberror/liberror.la \
+	../libnotify/libnotify.la \
+	@LIBUNA_LIBADD@ \
+	@LIBBFIO_LIBADD@
+
 @HAVE_V2_API_FALSE at libewf_la_LDFLAGS = -no-undefined -version-info 1:4:0
 @HAVE_V2_API_TRUE at libewf_la_LDFLAGS = -no-undefined -version-info 2:0:0
 EXTRA_DIST = \
@@ -412,6 +428,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libewf_date_time.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libewf_date_time_values.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libewf_debug.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libewf_empty_block.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libewf_error.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libewf_filename.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libewf_handle.Plo at am__quote@
diff --git a/libewf/ewf_crc.h b/libewf/ewf_crc.h
index 6b4f5a1..9133cf3 100644
--- a/libewf/ewf_crc.h
+++ b/libewf/ewf_crc.h
@@ -2,7 +2,7 @@
  * EWF CRC handling
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/ewf_data.h b/libewf/ewf_data.h
index 84b4a49..cbd69a4 100644
--- a/libewf/ewf_data.h
+++ b/libewf/ewf_data.h
@@ -2,7 +2,7 @@
  * EWF data section
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/ewf_definitions.h b/libewf/ewf_definitions.h
index b19a0cc..96826e0 100644
--- a/libewf/ewf_definitions.h
+++ b/libewf/ewf_definitions.h
@@ -2,7 +2,7 @@
  * Definitions for libewf
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/ewf_digest.h b/libewf/ewf_digest.h
index 23ef3a8..5cd0ef9 100644
--- a/libewf/ewf_digest.h
+++ b/libewf/ewf_digest.h
@@ -2,7 +2,7 @@
  * EWF degest section
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/ewf_error2.h b/libewf/ewf_error2.h
index ceb7d05..b8e69a5 100644
--- a/libewf/ewf_error2.h
+++ b/libewf/ewf_error2.h
@@ -2,7 +2,7 @@
  * EWF error2 section
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/ewf_file_header.h b/libewf/ewf_file_header.h
index 0fdb785..2ad9737 100644
--- a/libewf/ewf_file_header.h
+++ b/libewf/ewf_file_header.h
@@ -2,7 +2,7 @@
  * EWF file header
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/ewf_hash.h b/libewf/ewf_hash.h
index 823a05f..e989e7c 100644
--- a/libewf/ewf_hash.h
+++ b/libewf/ewf_hash.h
@@ -2,7 +2,7 @@
  * EWF hash section
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/ewf_ltree.h b/libewf/ewf_ltree.h
index d4f0002..b15eee9 100644
--- a/libewf/ewf_ltree.h
+++ b/libewf/ewf_ltree.h
@@ -2,7 +2,7 @@
  * EWF ltree section
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/ewf_section.h b/libewf/ewf_section.h
index eaa36c9..0add8cd 100644
--- a/libewf/ewf_section.h
+++ b/libewf/ewf_section.h
@@ -2,7 +2,7 @@
  * EWF section start
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/ewf_session.h b/libewf/ewf_session.h
index 8f3f4d6..91c9711 100644
--- a/libewf/ewf_session.h
+++ b/libewf/ewf_session.h
@@ -2,7 +2,7 @@
  * EWF session section (EWF-E01)
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/ewf_table.h b/libewf/ewf_table.h
index b51cf63..f8aa7d9 100644
--- a/libewf/ewf_table.h
+++ b/libewf/ewf_table.h
@@ -2,7 +2,7 @@
  * EWF table section
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/ewf_volume.h b/libewf/ewf_volume.h
index 27e6287..455c303 100644
--- a/libewf/ewf_volume.h
+++ b/libewf/ewf_volume.h
@@ -2,7 +2,7 @@
  * EWF volume section (EWF-E01 EWF-L01)
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/ewf_volume_smart.h b/libewf/ewf_volume_smart.h
index 746a3b6..537192b 100644
--- a/libewf/ewf_volume_smart.h
+++ b/libewf/ewf_volume_smart.h
@@ -2,7 +2,7 @@
  * EWF SMART volume section (EWF-S01)
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/ewfx_delta_chunk.h b/libewf/ewfx_delta_chunk.h
index 032e63b..ad0781a 100644
--- a/libewf/ewfx_delta_chunk.h
+++ b/libewf/ewfx_delta_chunk.h
@@ -2,7 +2,7 @@
  * libewf EWF eXtention delta chunk
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf.c b/libewf/libewf.c
index 7b4d74e..e5c0142 100644
--- a/libewf/libewf.c
+++ b/libewf/libewf.c
@@ -2,7 +2,7 @@
  * Library for the Expert Witness Compression Format Support (EWF)
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_chunk_cache.c b/libewf/libewf_chunk_cache.c
index a47f87c..6aeef0d 100644
--- a/libewf/libewf_chunk_cache.c
+++ b/libewf/libewf_chunk_cache.c
@@ -2,7 +2,7 @@
  * Chunk cache functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -172,6 +172,11 @@ int libewf_chunk_cache_free(
 			memory_free(
 			 ( *chunk_cache )->data );
 		}
+		if( ( *chunk_cache )->zero_byte_empty_block_compressed != NULL )
+		{
+			memory_free(
+			 ( *chunk_cache )->zero_byte_empty_block_compressed );
+		}
 		memory_free(
 		 *chunk_cache );
 
diff --git a/libewf/libewf_chunk_cache.h b/libewf/libewf_chunk_cache.h
index deda776..bf98c28 100644
--- a/libewf/libewf_chunk_cache.h
+++ b/libewf/libewf_chunk_cache.h
@@ -2,7 +2,7 @@
  * Chunk cache functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -63,6 +63,18 @@ struct libewf_chunk_cache
 	/* The data buffer
 	 */
 	uint8_t *data;
+
+	/* The zero byte empty block compressed data buffer
+	 */
+	uint8_t *zero_byte_empty_block_compressed;
+
+	/* The size of the compressed zero byte empty block data
+	 */
+	size_t zero_byte_empty_block_compressed_size;
+
+	/* The size of the uncompress zero byte empty block data
+	 */
+	size_t zero_byte_empty_block_uncompressed_size;
 };
 
 int libewf_chunk_cache_initialize(
diff --git a/libewf/libewf_chunk_offset.h b/libewf/libewf_chunk_offset.h
index 089c7fa..7c6c73a 100644
--- a/libewf/libewf_chunk_offset.h
+++ b/libewf/libewf_chunk_offset.h
@@ -2,7 +2,7 @@
  * Chunk offset functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_codepage.h b/libewf/libewf_codepage.h
new file mode 100644
index 0000000..2f94f3c
--- /dev/null
+++ b/libewf/libewf_codepage.h
@@ -0,0 +1,84 @@
+/*
+ * Codepage functions
+ *
+ * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
+ * Hoffmann Investigations.
+ *
+ * Refer to AUTHORS for acknowledgements.
+ *
+ * This software is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#if !defined( _LIBEWF_INTERNAL_CODEPAGE_H )
+#define _LIBEWF_INTERNAL_CODEPAGE_H
+
+#include <common.h>
+#include <types.h>
+
+#if defined( __cplusplus )
+extern "C" {
+#endif
+
+#if !defined( HAVE_LOCAL_LIBEWF )
+
+#include <libewf/codepage.h>
+
+/* Define HAVE_LOCAL_LIBEWF for local use of libewf
+ * The definitions in <libewf/codepage.h> are copied here
+ * for local use of libewf
+ */
+#else
+
+/* The codepage definitions
+ */
+enum LIBEWF_CODEPAGE
+{
+	LIBEWF_CODEPAGE_ASCII				= 20127,
+
+	LIBEWF_CODEPAGE_ISO_8859_1			= 28591,
+	LIBEWF_CODEPAGE_ISO_8859_2			= 28592,
+	LIBEWF_CODEPAGE_ISO_8859_3			= 28593,
+	LIBEWF_CODEPAGE_ISO_8859_4			= 28594,
+	LIBEWF_CODEPAGE_ISO_8859_5			= 28595,
+	LIBEWF_CODEPAGE_ISO_8859_6			= 28596,
+	LIBEWF_CODEPAGE_ISO_8859_7			= 28597,
+	LIBEWF_CODEPAGE_ISO_8859_8			= 28598,
+	LIBEWF_CODEPAGE_ISO_8859_9			= 28599,
+	LIBEWF_CODEPAGE_ISO_8859_10			= 28600,
+	LIBEWF_CODEPAGE_ISO_8859_11			= 28601,
+	LIBEWF_CODEPAGE_ISO_8859_13			= 28603,
+	LIBEWF_CODEPAGE_ISO_8859_14			= 28604,
+	LIBEWF_CODEPAGE_ISO_8859_15			= 28605,
+	LIBEWF_CODEPAGE_ISO_8859_16			= 28606,
+
+	LIBEWF_CODEPAGE_WINDOWS_874			= 874,
+	LIBEWF_CODEPAGE_WINDOWS_1250			= 1250,
+	LIBEWF_CODEPAGE_WINDOWS_1251			= 1251,
+	LIBEWF_CODEPAGE_WINDOWS_1252			= 1252,
+	LIBEWF_CODEPAGE_WINDOWS_1253			= 1253,
+	LIBEWF_CODEPAGE_WINDOWS_1254			= 1254,
+	LIBEWF_CODEPAGE_WINDOWS_1255			= 1255,
+	LIBEWF_CODEPAGE_WINDOWS_1256			= 1256,
+	LIBEWF_CODEPAGE_WINDOWS_1257			= 1257,
+	LIBEWF_CODEPAGE_WINDOWS_1258			= 1258
+};
+
+#endif
+
+#if defined( __cplusplus )
+}
+#endif
+
+#endif
+
diff --git a/libewf/libewf_compression.c b/libewf/libewf_compression.c
index a9cf37e..c62f4ce 100644
--- a/libewf/libewf_compression.c
+++ b/libewf/libewf_compression.c
@@ -2,7 +2,7 @@
  * Compression handling functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_compression.h b/libewf/libewf_compression.h
index f3c09e3..0174229 100644
--- a/libewf/libewf_compression.h
+++ b/libewf/libewf_compression.h
@@ -2,7 +2,7 @@
  * Compression handling functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_date_time.c b/libewf/libewf_date_time.c
index d0d39a0..b46df66 100644
--- a/libewf/libewf_date_time.c
+++ b/libewf/libewf_date_time.c
@@ -2,7 +2,7 @@
  * Date and time functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_date_time.h b/libewf/libewf_date_time.h
index 23b4cfe..e7c3597 100644
--- a/libewf/libewf_date_time.h
+++ b/libewf/libewf_date_time.h
@@ -2,7 +2,7 @@
  * Date and time functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_date_time_values.c b/libewf/libewf_date_time_values.c
index 6ace8e5..4f3d4cd 100644
--- a/libewf/libewf_date_time_values.c
+++ b/libewf/libewf_date_time_values.c
@@ -2,7 +2,7 @@
  * Date and time values functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_date_time_values.h b/libewf/libewf_date_time_values.h
index 5e05498..f507be2 100644
--- a/libewf/libewf_date_time_values.h
+++ b/libewf/libewf_date_time_values.h
@@ -2,7 +2,7 @@
  * Date and time values functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_debug.c b/libewf/libewf_debug.c
index 967302a..0ed3277 100644
--- a/libewf/libewf_debug.c
+++ b/libewf/libewf_debug.c
@@ -2,7 +2,7 @@
  * Debugging functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -21,7 +21,7 @@
  */
 
 #include <common.h>
-#include <endian.h>
+#include <byte_stream.h>
 #include <memory.h>
 #include <types.h>
 
@@ -87,9 +87,9 @@ int libewf_debug_dump_data(
 
 	crc_data = &data[ data_size - sizeof( ewf_crc_t ) ];
 
-	endian_little_convert_32bit(
-	 stored_crc,
-	 crc_data );
+	byte_stream_copy_to_uint32_little_endian(
+	 crc_data,
+	 stored_crc );
 
 	libnotify_printf(
 	 "%" PRIs_LIBEWF ":\n",
@@ -137,17 +137,17 @@ int libewf_debug_section_print(
 	                  sizeof( ewf_section_t ) - sizeof( ewf_crc_t ),
 	                  1 );
 
-	endian_little_convert_32bit(
-	 stored_crc,
-	 section->crc );
+	byte_stream_copy_to_uint32_little_endian(
+	 section->crc,
+	 stored_crc );
 
-	endian_little_convert_64bit(
-	 section_next,
-	 section->next );
+	byte_stream_copy_to_uint64_little_endian(
+	 section->next,
+	 section_next );
 
-	endian_little_convert_64bit(
-	 section_size,
-	 section->size );
+	byte_stream_copy_to_uint64_little_endian(
+	 section->size,
+	 section_size );
 
 	libnotify_printf(
 	 "Section:\n"
diff --git a/libewf/libewf_debug.h b/libewf/libewf_debug.h
index dc6081b..d95d669 100644
--- a/libewf/libewf_debug.h
+++ b/libewf/libewf_debug.h
@@ -2,7 +2,7 @@
  * Debugging functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_definitions.h b/libewf/libewf_definitions.h
index b83772c..fa2985a 100644
--- a/libewf/libewf_definitions.h
+++ b/libewf/libewf_definitions.h
@@ -2,7 +2,7 @@
  * The internal definitions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -24,25 +24,24 @@
 #define _LIBEWF_INTERNAL_DEFINITIONS_H
 
 #include <common.h>
-#include <endian.h>
+#include <byte_stream.h>
 
-#define LIBEWF_ENDIAN_BIG	_ENDIAN_BIG
-#define LIBEWF_ENDIAN_LITTLE	_ENDIAN_LITTLE
+#define LIBEWF_ENDIAN_BIG			_BYTE_STREAM_ENDIAN_BIG
+#define LIBEWF_ENDIAN_LITTLE			_BYTE_STREAM_ENDIAN_LITTLE
 
-#define LIBEWF_2_TIB		0x20000000000ULL
+#define LIBEWF_2_TIB				0x20000000000ULL
 
 /* Define HAVE_LOCAL_LIBEWF for local use of libewf
  */
 #if !defined( HAVE_LOCAL_LIBEWF )
-#include <libewf/codepage.h>
 #include <libewf/definitions.h>
 
 #else
-#define LIBEWF_VERSION				20091003
+#define LIBEWF_VERSION				20091114
 
 /* The libewf version string
  */
-#define LIBEWF_VERSION_STRING			"20091003"
+#define LIBEWF_VERSION_STRING			"20091114"
 
 /* The libewf file access
  * bit 1	set to 1 for read access
@@ -161,22 +160,6 @@ enum LIBEWF_SEGMENT_FILE_TYPES
 	LIBEWF_SEGMENT_FILE_TYPE_LWF		= (int) 'L'
 };
 
-/* The codepages
- */
-enum LIBEWF_CODEPAGES
-{
-	LIBEWF_CODEPAGE_ASCII			= 20127,
-	LIBEWF_CODEPAGE_WINDOWS_1250		= 1250,
-	LIBEWF_CODEPAGE_WINDOWS_1251		= 1251,
-	LIBEWF_CODEPAGE_WINDOWS_1252		= 1252,
-	LIBEWF_CODEPAGE_WINDOWS_1253		= 1253,
-	LIBEWF_CODEPAGE_WINDOWS_1254		= 1254,
-	LIBEWF_CODEPAGE_WINDOWS_1255		= 1255,
-	LIBEWF_CODEPAGE_WINDOWS_1256		= 1256,
-	LIBEWF_CODEPAGE_WINDOWS_1257		= 1257,
-	LIBEWF_CODEPAGE_WINDOWS_1258		= 1258
-};
-
 #endif
 
 #endif
diff --git a/libewf/libewf_definitions.h.in b/libewf/libewf_definitions.h.in
index 29c49c5..32957d0 100644
--- a/libewf/libewf_definitions.h.in
+++ b/libewf/libewf_definitions.h.in
@@ -2,7 +2,7 @@
  * The internal definitions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -24,17 +24,16 @@
 #define _LIBEWF_INTERNAL_DEFINITIONS_H
 
 #include <common.h>
-#include <endian.h>
+#include <byte_stream.h>
 
-#define LIBEWF_ENDIAN_BIG	_ENDIAN_BIG
-#define LIBEWF_ENDIAN_LITTLE	_ENDIAN_LITTLE
+#define LIBEWF_ENDIAN_BIG			_BYTE_STREAM_ENDIAN_BIG
+#define LIBEWF_ENDIAN_LITTLE			_BYTE_STREAM_ENDIAN_LITTLE
 
-#define LIBEWF_2_TIB		0x20000000000ULL
+#define LIBEWF_2_TIB				0x20000000000ULL
 
 /* Define HAVE_LOCAL_LIBEWF for local use of libewf
  */
 #if !defined( HAVE_LOCAL_LIBEWF )
-#include <libewf/codepage.h>
 #include <libewf/definitions.h>
 
 #else
@@ -161,22 +160,6 @@ enum LIBEWF_SEGMENT_FILE_TYPES
 	LIBEWF_SEGMENT_FILE_TYPE_LWF		= (int) 'L'
 };
 
-/* The codepages
- */
-enum LIBEWF_CODEPAGES
-{
-	LIBEWF_CODEPAGE_ASCII			= 20127,
-	LIBEWF_CODEPAGE_WINDOWS_1250		= 1250,
-	LIBEWF_CODEPAGE_WINDOWS_1251		= 1251,
-	LIBEWF_CODEPAGE_WINDOWS_1252		= 1252,
-	LIBEWF_CODEPAGE_WINDOWS_1253		= 1253,
-	LIBEWF_CODEPAGE_WINDOWS_1254		= 1254,
-	LIBEWF_CODEPAGE_WINDOWS_1255		= 1255,
-	LIBEWF_CODEPAGE_WINDOWS_1256		= 1256,
-	LIBEWF_CODEPAGE_WINDOWS_1257		= 1257,
-	LIBEWF_CODEPAGE_WINDOWS_1258		= 1258
-};
-
 #endif
 
 #endif
diff --git a/libewf/libewf_empty_block.c b/libewf/libewf_empty_block.c
new file mode 100644
index 0000000..cdba464
--- /dev/null
+++ b/libewf/libewf_empty_block.c
@@ -0,0 +1,128 @@
+/*
+ * Empty block test functions
+ *
+ * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
+ * Hoffmann Investigations.
+ *
+ * Refer to AUTHORS for acknowledgements.
+ *
+ * This software is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <common.h>
+#include <types.h>
+
+#include <liberror.h>
+
+#include "libewf_empty_block.h"
+
+/* The largest primary (or scalar) available
+ * supported by a single load and store instruction
+ */
+typedef unsigned long int libewf_aligned_t;
+
+/* Check for empty block
+ * An emtpy block is a block that contains the same value for every byte
+ * Returns 1 if block is empty, 0 if not or -1 on error
+ */
+int libewf_empty_block_test(
+     const uint8_t *block_buffer,
+     size_t block_size,
+     liberror_error_t **error )
+{
+	libewf_aligned_t *aligned_block_iterator = NULL;
+	libewf_aligned_t *aligned_block_start    = NULL;
+	uint8_t *block_iterator                  = NULL;
+	uint8_t *block_start                     = NULL;
+	static char *function                    = "libewf_empty_block_test";
+
+	if( block_buffer == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid block buffer.",
+		 function );
+
+		return( -1 );
+	}
+	if( block_size > (size_t) SSIZE_MAX )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
+		 "%s: invalid block size value exceeds maximum.",
+		 function );
+
+		return( -1 );
+	}
+	block_start    = (uint8_t *) block_buffer;
+	block_iterator = (uint8_t *) block_buffer + 1;
+	block_size    -= 1;
+
+	/* Only optimize for blocks larger than the alignment
+	 */
+	if( block_size > ( 2 * sizeof( libewf_aligned_t ) ) )
+	{
+		/* Align the block start
+		 */
+		while( ( (intptr_t) block_start % sizeof( libewf_aligned_t ) ) != 0 )
+		{
+			if( *block_start != *block_iterator )
+			{
+				return( 0 );
+			}
+			block_start    += 1;
+			block_iterator += 1;
+			block_size     -= 1;
+		}
+		/* Align the block iterator
+		 */
+		while( ( (intptr_t) block_iterator % sizeof( libewf_aligned_t ) ) != 0 )
+		{
+			if( *block_start != *block_iterator )
+			{
+				return( 0 );
+			}
+			block_iterator += 1;
+			block_size     -= 1;
+		}
+		aligned_block_start    = (libewf_aligned_t *) block_start;
+		aligned_block_iterator = (libewf_aligned_t *) block_iterator;
+
+		while( block_size > sizeof( libewf_aligned_t ) )
+		{
+			if( *aligned_block_start != *aligned_block_iterator )
+			{
+				return( 0 );
+			}
+			aligned_block_iterator += 1;
+			block_size             -= sizeof( libewf_aligned_t );
+		}
+		block_iterator = (uint8_t *) aligned_block_iterator;
+	}
+	while( block_size != 0 )
+	{
+		if( *block_start != *block_iterator )
+		{
+			return( 0 );
+		}
+		block_iterator += 1;
+		block_size     -= 1;
+	}
+	return( 1 );
+}
+
diff --git a/libsystem/libsystem_support.h b/libewf/libewf_empty_block.h
similarity index 76%
copy from libsystem/libsystem_support.h
copy to libewf/libewf_empty_block.h
index 2d05cef..86761cc 100644
--- a/libsystem/libsystem_support.h
+++ b/libewf/libewf_empty_block.h
@@ -1,8 +1,8 @@
 /*
- * Support functions
+ * Empty block test functions
  *
- * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -20,13 +20,11 @@
  * along with this software.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#if !defined( _LIBSYSTEM_SUPPORT_H )
-#define _LIBSYSTEM_SUPPORT_H
+#if !defined( _LIBEWF_EMPTY_BLOCK_H )
+#define _LIBEWF_EMPTY_BLOCK_H
 
 #include <common.h>
-#include <narrow_string.h>
 #include <types.h>
-#include <wide_string.h>
 
 #include <liberror.h>
 
@@ -34,7 +32,9 @@
 extern "C" {
 #endif
 
-int libsystem_initialize(
+int libewf_empty_block_test(
+     const uint8_t *block_buffer,
+     size_t block_size,
      liberror_error_t **error );
 
 #if defined( __cplusplus )
diff --git a/libewf/libewf_error.c b/libewf/libewf_error.c
index 88d52be..ce651ab 100644
--- a/libewf/libewf_error.c
+++ b/libewf/libewf_error.c
@@ -2,7 +2,7 @@
  * Error functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_error.h b/libewf/libewf_error.h
index 863f284..72c2553 100644
--- a/libewf/libewf_error.h
+++ b/libewf/libewf_error.h
@@ -2,7 +2,7 @@
  * Error functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_extern.h b/libewf/libewf_extern.h
index e70ddcc..22377cd 100644
--- a/libewf/libewf_extern.h
+++ b/libewf/libewf_extern.h
@@ -2,7 +2,7 @@
  * The internal extern definition
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_filename.c b/libewf/libewf_filename.c
index 9906f17..cad4e23 100644
--- a/libewf/libewf_filename.c
+++ b/libewf/libewf_filename.c
@@ -2,7 +2,7 @@
  * Filename functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_filename.h b/libewf/libewf_filename.h
index 8224262..886d8c1 100644
--- a/libewf/libewf_filename.h
+++ b/libewf/libewf_filename.h
@@ -2,7 +2,7 @@
  * Filename functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_handle.c b/libewf/libewf_handle.c
index 8493d9d..0f229db 100644
--- a/libewf/libewf_handle.c
+++ b/libewf/libewf_handle.c
@@ -2,7 +2,7 @@
  * libewf main handle
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -1734,9 +1734,10 @@ int libewf_handle_close(
 
 		return( -1 );
 	}
-	if( libbfio_pool_close_all(
-	     internal_handle->io_handle->file_io_pool,
-	     error ) != 0 )
+	if( ( internal_handle->io_handle->pool_created_in_library != 0 )
+	 && ( libbfio_pool_close_all(
+	       internal_handle->io_handle->file_io_pool,
+	       error ) != 0 ) )
 	{
 		liberror_error_set(
 		 error,
@@ -1778,6 +1779,17 @@ off64_t libewf_handle_seek_offset(
 	}
 	internal_handle = (libewf_internal_handle_t *) handle;
 
+	if( internal_handle->io_handle == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_RUNTIME,
+		 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
+		 "%s: invalid handle - missing io handle.",
+		 function );
+
+		return( -1 );
+	}
 	if( internal_handle->media_values == NULL )
 	{
 		liberror_error_set(
@@ -2026,6 +2038,17 @@ ssize_t libewf_handle_read_chunk(
 	}
 	internal_handle = (libewf_internal_handle_t *) handle;
 
+	if( internal_handle->io_handle == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_RUNTIME,
+		 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
+		 "%s: invalid handle - missing io handle.",
+		 function );
+
+		return( -1 );
+	}
 	if( internal_handle->chunk_cache == NULL )
 	{
 		liberror_error_set(
@@ -2105,6 +2128,17 @@ ssize_t libewf_handle_read_buffer(
 	}
 	internal_handle = (libewf_internal_handle_t *) handle;
 
+	if( internal_handle->io_handle == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_RUNTIME,
+		 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
+		 "%s: invalid handle - missing io handle.",
+		 function );
+
+		return( -1 );
+	}
 	if( internal_handle->media_values == NULL )
 	{
 		liberror_error_set(
@@ -2339,6 +2373,17 @@ ssize_t libewf_handle_prepare_write_chunk(
 	}
 	internal_handle = (libewf_internal_handle_t *) handle;
 
+	if( internal_handle->io_handle == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_RUNTIME,
+		 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
+		 "%s: invalid handle - missing io handle.",
+		 function );
+
+		return( -1 );
+	}
 	if( internal_handle->chunk_cache == NULL )
 	{
 		liberror_error_set(
@@ -2466,6 +2511,17 @@ ssize_t libewf_handle_write_chunk(
 	}
 	internal_handle = (libewf_internal_handle_t *) handle;
 
+	if( internal_handle->io_handle == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_RUNTIME,
+		 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
+		 "%s: invalid handle - missing io handle.",
+		 function );
+
+		return( -1 );
+	}
 	if( internal_handle->media_values == NULL )
 	{
 		liberror_error_set(
@@ -2669,6 +2725,17 @@ ssize_t libewf_handle_write_buffer(
 	}
 	internal_handle = (libewf_internal_handle_t *) handle;
 
+	if( internal_handle->io_handle == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_RUNTIME,
+		 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
+		 "%s: invalid handle - missing io handle.",
+		 function );
+
+		return( -1 );
+	}
 	if( internal_handle->write_io_handle == NULL )
 	{
 		liberror_error_set(
@@ -3015,6 +3082,17 @@ int libewf_handle_get_offset(
 	}
 	internal_handle = (libewf_internal_handle_t *) handle;
 
+	if( internal_handle->io_handle == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_RUNTIME,
+		 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
+		 "%s: invalid handle - missing io handle.",
+		 function );
+
+		return( -1 );
+	}
 	if( internal_handle->media_values == NULL )
 	{
 		liberror_error_set(
@@ -4412,6 +4490,17 @@ int libewf_internal_handle_add_segment_file(
 
 		return( -1 );
 	}
+	if( internal_handle->io_handle == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_RUNTIME,
+		 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
+		 "%s: invalid handle - missing io handle.",
+		 function );
+
+		return( -1 );
+	}
 	if( file_io_pool_entry < 0 )
 	{
 		liberror_error_set(
@@ -4831,6 +4920,17 @@ int libewf_internal_handle_set_format(
 
 		return( -1 );
 	}
+	if( internal_handle->io_handle == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_RUNTIME,
+		 LIBERROR_RUNTIME_ERROR_VALUE_MISSING,
+		 "%s: invalid handle - missing io handle.",
+		 function );
+
+		return( -1 );
+	}
 	if( ( format != LIBEWF_FORMAT_ENCASE1 )
 	 && ( format != LIBEWF_FORMAT_ENCASE2 )
 	 && ( format != LIBEWF_FORMAT_ENCASE3 )
diff --git a/libewf/libewf_handle.h b/libewf/libewf_handle.h
index 9630ab6..3e989f3 100644
--- a/libewf/libewf_handle.h
+++ b/libewf/libewf_handle.h
@@ -2,7 +2,7 @@
  * libewf main handle
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_hash_sections.c b/libewf/libewf_hash_sections.c
index 247ae39..eef6722 100644
--- a/libewf/libewf_hash_sections.c
+++ b/libewf/libewf_hash_sections.c
@@ -2,7 +2,7 @@
  * Hash sections functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_hash_sections.h b/libewf/libewf_hash_sections.h
index 909bb4b..37233c5 100644
--- a/libewf/libewf_hash_sections.h
+++ b/libewf/libewf_hash_sections.h
@@ -2,7 +2,7 @@
  * Hash sections functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_hash_values.c b/libewf/libewf_hash_values.c
index 72af7e4..4c98214 100644
--- a/libewf/libewf_hash_values.c
+++ b/libewf/libewf_hash_values.c
@@ -2,7 +2,7 @@
  * Hash values functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_hash_values.h b/libewf/libewf_hash_values.h
index 7fa3ff6..0deb6d5 100644
--- a/libewf/libewf_hash_values.h
+++ b/libewf/libewf_hash_values.h
@@ -2,7 +2,7 @@
  * Hash values functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_header_sections.c b/libewf/libewf_header_sections.c
index f24f920..9a49eea 100644
--- a/libewf/libewf_header_sections.c
+++ b/libewf/libewf_header_sections.c
@@ -2,7 +2,7 @@
  * Header sections functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -26,6 +26,7 @@
 #include <liberror.h>
 #include <libnotify.h>
 
+#include "libewf_codepage.h"
 #include "libewf_definitions.h"
 #include "libewf_header_sections.h"
 #include "libewf_header_values.h"
diff --git a/libewf/libewf_header_sections.h b/libewf/libewf_header_sections.h
index ce4f255..6a1cb25 100644
--- a/libewf/libewf_header_sections.h
+++ b/libewf/libewf_header_sections.h
@@ -2,7 +2,7 @@
  * Header sections functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_header_values.c b/libewf/libewf_header_values.c
index 59c6419..bcf1072 100644
--- a/libewf/libewf_header_values.c
+++ b/libewf/libewf_header_values.c
@@ -2,7 +2,7 @@
  * Header values functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -21,7 +21,6 @@
  */
 
 #include <common.h>
-#include <endian.h>
 #include <memory.h>
 #include <narrow_string.h>
 #include <types.h>
diff --git a/libewf/libewf_header_values.h b/libewf/libewf_header_values.h
index 5e275fe..9da3cf3 100644
--- a/libewf/libewf_header_values.h
+++ b/libewf/libewf_header_values.h
@@ -2,7 +2,7 @@
  * Header values functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_io_handle.c b/libewf/libewf_io_handle.c
index f429411..fd4cc3e 100644
--- a/libewf/libewf_io_handle.c
+++ b/libewf/libewf_io_handle.c
@@ -2,7 +2,7 @@
  * IO handle functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_io_handle.h b/libewf/libewf_io_handle.h
index c1eb830..0ea639f 100644
--- a/libewf/libewf_io_handle.h
+++ b/libewf/libewf_io_handle.h
@@ -2,7 +2,7 @@
  * IO handle functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_legacy.c b/libewf/libewf_legacy.c
index 79aab3e..6a2d2be 100644
--- a/libewf/libewf_legacy.c
+++ b/libewf/libewf_legacy.c
@@ -2,7 +2,7 @@
  * Legacy functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -37,6 +37,8 @@
 
 #if defined( HAVE_V1_API )
 
+#if !defined( HAVE_LOCAL_LIBEWF )
+
 /* Set the notify values
  */
 void libewf_set_notify_values(
@@ -66,6 +68,8 @@ void libewf_set_notify_values(
 	 verbose );
 }
 
+#endif
+
 /* Signals the libewf handle to abort its current activity
  * Returns 1 if successful or -1 on error
  */
diff --git a/libewf/libewf_legacy.h b/libewf/libewf_legacy.h
index 52d9589..4dcf6b7 100644
--- a/libewf/libewf_legacy.h
+++ b/libewf/libewf_legacy.h
@@ -2,7 +2,7 @@
  * Legacy functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -39,10 +39,14 @@ extern "C" {
 
 #if defined( HAVE_V1_API )
 
+#if !defined( HAVE_LOCAL_LIBEWF )
+
 LIBEWF_EXTERN void libewf_set_notify_values(
                     FILE *stream,
                     int verbose );
 
+#endif
+
 LIBEWF_EXTERN int libewf_signal_abort(
                    libewf_handle_t *handle );
 
diff --git a/libewf/libewf_libbfio.h b/libewf/libewf_libbfio.h
index 46533d4..e6286b2 100644
--- a/libewf/libewf_libbfio.h
+++ b/libewf/libewf_libbfio.h
@@ -2,7 +2,7 @@
  * The libbfio header wrapper
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_libuna.h b/libewf/libewf_libuna.h
index f60c404..3ac0cb4 100644
--- a/libewf/libewf_libuna.h
+++ b/libewf/libewf_libuna.h
@@ -2,7 +2,7 @@
  * The internal libuna header
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_list_type.c b/libewf/libewf_list_type.c
index 36db8ab..639e376 100644
--- a/libewf/libewf_list_type.c
+++ b/libewf/libewf_list_type.c
@@ -2,7 +2,7 @@
  * List type functions
  *
  * Copyright (C) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_list_type.h b/libewf/libewf_list_type.h
index 6b16249..92d1a1a 100644
--- a/libewf/libewf_list_type.h
+++ b/libewf/libewf_list_type.h
@@ -2,7 +2,7 @@
  * List type functions
  *
  * Copyright (C) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_media_values.c b/libewf/libewf_media_values.c
index 31cf9f7..a92dd4d 100644
--- a/libewf/libewf_media_values.c
+++ b/libewf/libewf_media_values.c
@@ -2,7 +2,7 @@
  * Media values functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_media_values.h b/libewf/libewf_media_values.h
index 6c9f24f..c15b4f8 100644
--- a/libewf/libewf_media_values.h
+++ b/libewf/libewf_media_values.h
@@ -2,7 +2,7 @@
  * Media values functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_metadata.c b/libewf/libewf_metadata.c
index 8a381cd..41ce799 100644
--- a/libewf/libewf_metadata.c
+++ b/libewf/libewf_metadata.c
@@ -2,7 +2,7 @@
  * Interface functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -28,6 +28,7 @@
 #include <liberror.h>
 #include <libnotify.h>
 
+#include "libewf_codepage.h"
 #include "libewf_date_time_values.h"
 #include "libewf_definitions.h"
 #include "libewf_handle.h"
@@ -2497,6 +2498,7 @@ int libewf_handle_set_header_codepage(
 		return( -1 );
 	}
 	if( ( header_codepage != LIBEWF_CODEPAGE_ASCII )
+	 && ( header_codepage != LIBEWF_CODEPAGE_WINDOWS_874 )
 	 && ( header_codepage != LIBEWF_CODEPAGE_WINDOWS_1250 )
 	 && ( header_codepage != LIBEWF_CODEPAGE_WINDOWS_1251 )
 	 && ( header_codepage != LIBEWF_CODEPAGE_WINDOWS_1252 )
diff --git a/libewf/libewf_metadata.h b/libewf/libewf_metadata.h
index 7a0ceff..d2652b2 100644
--- a/libewf/libewf_metadata.h
+++ b/libewf/libewf_metadata.h
@@ -2,7 +2,7 @@
  * Meta data functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_notify.c b/libewf/libewf_notify.c
index d71ccf5..219f54b 100644
--- a/libewf/libewf_notify.c
+++ b/libewf/libewf_notify.c
@@ -2,7 +2,7 @@
  * Notification functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_notify.h b/libewf/libewf_notify.h
index b9a9e6c..7b7bc4f 100644
--- a/libewf/libewf_notify.h
+++ b/libewf/libewf_notify.h
@@ -2,7 +2,7 @@
  * Notification function
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_offset_table.c b/libewf/libewf_offset_table.c
index 7b07f8e..fbe08cd 100644
--- a/libewf/libewf_offset_table.c
+++ b/libewf/libewf_offset_table.c
@@ -2,7 +2,7 @@
  * Offset table functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -21,7 +21,7 @@
  */
 
 #include <common.h>
-#include <endian.h>
+#include <byte_stream.h>
 #include <memory.h>
 #include <types.h>
 
@@ -290,7 +290,7 @@ int libewf_offset_table_fill(
 	uint32_t current_offset             = 0;
 	uint32_t next_offset                = 0;
 	uint32_t raw_offset                 = 0;
-	uint32_t iterator                   = 0;
+	uint32_t offset_iterator            = 0;
 	uint8_t compressed                  = 0;
 	uint8_t corrupted                   = 0;
 	uint8_t overflow                    = 0;
@@ -359,13 +359,13 @@ int libewf_offset_table_fill(
 			return( -1 );
 		}
 	}
-	endian_little_convert_32bit(
-	 raw_offset,
-	 offsets[ iterator ].offset );
+	byte_stream_copy_to_uint32_little_endian(
+	 offsets[ offset_iterator ].offset,
+	 raw_offset );
 
 	/* The size of the last chunk must be determined differently
 	 */
-	while( iterator < ( amount_of_chunks - 1 ) )
+	while( offset_iterator < ( amount_of_chunks - 1 ) )
 	{
 		if( overflow == 0 )
 		{
@@ -376,9 +376,9 @@ int libewf_offset_table_fill(
 		{
 			current_offset = raw_offset;
 		}
-		endian_little_convert_32bit(
-		 raw_offset,
-		 offsets[ iterator + 1 ].offset );
+		byte_stream_copy_to_uint32_little_endian(
+		 offsets[ offset_iterator + 1 ].offset,
+		 raw_offset );
 
 		if( overflow == 0 )
 		{
@@ -504,11 +504,11 @@ int libewf_offset_table_fill(
 			overflow   = 1;
 			compressed = 0;
 		}
-		iterator++;
+		offset_iterator++;
 	}
-	endian_little_convert_32bit(
-	 raw_offset,
-	 offsets[ iterator ].offset );
+	byte_stream_copy_to_uint32_little_endian(
+	 offsets[ offset_iterator ].offset,
+	 raw_offset );
 
 	if( overflow == 0 )
 	{
@@ -750,7 +750,7 @@ int libewf_offset_table_fill_offsets(
 	static char *function               = "libewf_offset_table_fill_offsets";
 	off64_t offset64_value              = 0;
 	uint32_t offset32_value             = 0;
-	uint32_t iterator                   = 0;
+	uint32_t offset_iterator            = 0;
 
 	if( offset_table == NULL )
 	{
@@ -807,9 +807,11 @@ int libewf_offset_table_fill_offsets(
 
 		return( -1 );
 	}
-	for( iterator = 0; iterator < amount_of_chunk_offsets; iterator++ )
+	for( offset_iterator = 0;
+	     offset_iterator < amount_of_chunk_offsets;
+	     offset_iterator++ )
 	{
-		chunk_offset   = &( offset_table->chunk_offset[ offset_table_index + iterator ] );
+		chunk_offset   = &( offset_table->chunk_offset[ offset_table_index + offset_iterator ] );
 		offset64_value = chunk_offset->file_offset - base_offset;
 
 		if( ( offset64_value < 0 )
@@ -830,8 +832,8 @@ int libewf_offset_table_fill_offsets(
 		{
 			offset32_value |= EWF_OFFSET_COMPRESSED_WRITE_MASK;
 		}
-		endian_little_revert_32bit(
-		 offsets[ iterator ].offset,
+		byte_stream_copy_from_uint32_little_endian(
+		 offsets[ offset_iterator ].offset,
 		 offset32_value );
 	}
 	return( 1 );
@@ -860,7 +862,7 @@ int libewf_offset_table_compare(
 	uint32_t current_offset             = 0;
 	uint32_t next_offset                = 0;
 	uint32_t raw_offset                 = 0;
-	uint32_t iterator                   = 0;
+	uint32_t offset_iterator            = 0;
 	uint8_t compressed                  = 0;
 	uint8_t corrupted                   = 0;
 	uint8_t mismatch                    = 0;
@@ -928,13 +930,13 @@ int libewf_offset_table_compare(
 
 		return( -1 );
 	}
-	endian_little_convert_32bit(
-	 raw_offset,
-	 offsets[ iterator ].offset );
+	byte_stream_copy_to_uint32_little_endian(
+	 offsets[ offset_iterator ].offset,
+	 raw_offset );
 
 	/* The size of the last chunk must be determined differently
 	 */
-	while( iterator < ( amount_of_chunks - 1 ) )
+	while( offset_iterator < ( amount_of_chunks - 1 ) )
 	{
 		if( overflow == 0 )
 		{
@@ -945,9 +947,9 @@ int libewf_offset_table_compare(
 		{
 			current_offset = raw_offset;
 		}
-		endian_little_convert_32bit(
-		 raw_offset,
-		 offsets[ iterator + 1 ].offset );
+		byte_stream_copy_to_uint32_little_endian(
+		 offsets[ offset_iterator + 1 ].offset,
+		 raw_offset );
 
 		if( overflow == 0 )
 		{
@@ -1117,11 +1119,11 @@ int libewf_offset_table_compare(
 			overflow   = 1;
 			compressed = 0;
 		}
-		iterator++;
+		offset_iterator++;
 	}
-	endian_little_convert_32bit(
-	 raw_offset,
-	 offsets[ iterator ].offset );
+	byte_stream_copy_to_uint32_little_endian(
+	 offsets[ offset_iterator ].offset,
+	 raw_offset );
 
 	if( overflow == 0 )
 	{
diff --git a/libewf/libewf_offset_table.h b/libewf/libewf_offset_table.h
index 73a62f8..03f9c6d 100644
--- a/libewf/libewf_offset_table.h
+++ b/libewf/libewf_offset_table.h
@@ -2,7 +2,7 @@
  * Offset table functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_read_io_handle.c b/libewf/libewf_read_io_handle.c
index f348efb..fada34a 100644
--- a/libewf/libewf_read_io_handle.c
+++ b/libewf/libewf_read_io_handle.c
@@ -2,7 +2,7 @@
  * Low level reading functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -21,7 +21,7 @@
  */
 
 #include <common.h>
-#include <endian.h>
+#include <byte_stream.h>
 #include <types.h>
 
 #include <liberror.h>
@@ -227,9 +227,9 @@ ssize_t libewf_read_io_handle_process_chunk(
 			chunk_buffer_size -= sizeof( ewf_crc_t );
 			crc_buffer         = &( chunk_buffer[ chunk_buffer_size ] );
 
-			endian_little_convert_32bit(
-			 chunk_crc,
-			 crc_buffer );
+			byte_stream_copy_to_uint32_little_endian(
+			 crc_buffer,
+			 chunk_crc );
 		}
 		calculated_crc = ewf_crc_calculate(
 		                  chunk_buffer,
@@ -583,9 +583,9 @@ ssize_t libewf_read_io_handle_read_chunk(
 			}
 			total_read_count += read_count;
 		}
-		endian_little_convert_32bit(
-		 *chunk_crc,
-		 crc_buffer );
+		byte_stream_copy_to_uint32_little_endian(
+		 crc_buffer,
+		 *chunk_crc );
 	}
 	return( total_read_count );
 }
diff --git a/libewf/libewf_read_io_handle.h b/libewf/libewf_read_io_handle.h
index 137a668..c3817d1 100644
--- a/libewf/libewf_read_io_handle.h
+++ b/libewf/libewf_read_io_handle.h
@@ -2,7 +2,7 @@
  * Low level reading functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_section.c b/libewf/libewf_section.c
index 7198304..c33891b 100644
--- a/libewf/libewf_section.c
+++ b/libewf/libewf_section.c
@@ -2,7 +2,7 @@
  * Section reading/writing functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -23,7 +23,7 @@
  */
 
 #include <common.h>
-#include <endian.h>
+#include <byte_stream.h>
 #include <memory.h>
 #include <narrow_string.h>
 #include <types.h>
@@ -176,9 +176,9 @@ ssize_t libewf_section_start_read(
 	                  sizeof( ewf_section_t ) - sizeof( ewf_crc_t ),
 	                  1 );
 
-	endian_little_convert_32bit(
-	 stored_crc,
-	 section->crc );
+	byte_stream_copy_to_uint32_little_endian(
+	 section->crc,
+	 stored_crc );
 
 	if( stored_crc != calculated_crc )
 	{
@@ -218,9 +218,9 @@ ssize_t libewf_section_start_read(
 	 40 );
 #endif
 
-	endian_little_convert_64bit(
-	 *section_size,
-	 section->size );
+	byte_stream_copy_to_uint64_little_endian(
+	 section->size,
+	 *section_size );
 
 	if( *section_size > (uint64_t) INT64_MAX )
 	{
@@ -233,9 +233,9 @@ ssize_t libewf_section_start_read(
 
 		return( -1 );
 	}
-	endian_little_convert_64bit(
-	 *section_next,
-	 section->next );
+	byte_stream_copy_to_uint64_little_endian(
+	 section->next,
+	 *section_next );
 
 	if( *section_next > (uint64_t) INT64_MAX )
 	{
@@ -369,11 +369,11 @@ ssize_t libewf_section_start_write(
 
 		return( -1 );
 	}
-	endian_little_revert_64bit(
+	byte_stream_copy_from_uint64_little_endian(
 	 section.size,
 	 section_size );
 
-	endian_little_revert_64bit(
+	byte_stream_copy_from_uint64_little_endian(
 	 section.next,
 	 section_offset );
 
@@ -382,7 +382,7 @@ ssize_t libewf_section_start_write(
 	                  ( sizeof( ewf_section_t ) - sizeof( ewf_crc_t ) ),
 	                  1 );
 
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 section.crc,
 	 calculated_crc );
 
@@ -1328,9 +1328,9 @@ ssize_t libewf_section_volume_s01_read(
 	                  ( sizeof( ewf_volume_smart_t ) - sizeof( ewf_crc_t ) ),
 	                  1 );
 
-	endian_little_convert_32bit(
-	 stored_crc,
-	 volume->crc );
+	byte_stream_copy_to_uint32_little_endian(
+	 volume->crc,
+	 stored_crc );
 
 	if( stored_crc != calculated_crc )
 	{
@@ -1366,21 +1366,21 @@ ssize_t libewf_section_volume_s01_read(
 	 45 );
 #endif
 
-	endian_little_convert_32bit(
-	 media_values->amount_of_chunks,
-	 volume->amount_of_chunks );
+	byte_stream_copy_to_uint32_little_endian(
+	 volume->amount_of_chunks,
+	 media_values->amount_of_chunks );
 
-	endian_little_convert_32bit(
-	 media_values->sectors_per_chunk,
-	 volume->sectors_per_chunk );
+	byte_stream_copy_to_uint32_little_endian(
+	 volume->sectors_per_chunk,
+	 media_values->sectors_per_chunk );
 
-	endian_little_convert_32bit(
-	 media_values->bytes_per_sector,
-	 volume->bytes_per_sector );
+	byte_stream_copy_to_uint32_little_endian(
+	 volume->bytes_per_sector,
+	 media_values->bytes_per_sector );
 
-	endian_little_convert_32bit(
-	 media_values->amount_of_sectors,
-	 volume->amount_of_sectors );
+	byte_stream_copy_to_uint32_little_endian(
+	 volume->amount_of_sectors,
+	 media_values->amount_of_sectors );
 
 	if( memory_compare(
 	     (void *) volume->signature,
@@ -1489,19 +1489,19 @@ ssize_t libewf_section_volume_s01_write(
 	}
 	volume->unknown1[ 0 ] = 1;
 
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 volume->amount_of_chunks,
 	 media_values->amount_of_chunks );
 
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 volume->sectors_per_chunk,
 	 media_values->sectors_per_chunk );
 
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 volume->bytes_per_sector,
 	 media_values->bytes_per_sector );
 
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 volume->amount_of_sectors,
 	 media_values->amount_of_sectors );
 
@@ -1518,7 +1518,7 @@ ssize_t libewf_section_volume_s01_write(
 	                  ( sizeof( ewf_volume_smart_t ) - sizeof( ewf_crc_t ) ),
 	                  1 );
 
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 volume->crc,
 	 calculated_crc );
 
@@ -1694,9 +1694,9 @@ ssize_t libewf_section_volume_e01_read(
 	                  sizeof( ewf_volume_t ) - sizeof( ewf_crc_t ),
 	                  1 );
 
-	endian_little_convert_32bit(
-	 stored_crc,
-	 volume->crc );
+	byte_stream_copy_to_uint32_little_endian(
+	 volume->crc,
+	 stored_crc );
 
 	if( stored_crc != calculated_crc )
 	{
@@ -1771,25 +1771,25 @@ ssize_t libewf_section_volume_e01_read(
 	 5 );
 #endif
 
-	endian_little_convert_32bit(
-	 media_values->amount_of_chunks,
-	 volume->amount_of_chunks );
+	byte_stream_copy_to_uint32_little_endian(
+	 volume->amount_of_chunks,
+	 media_values->amount_of_chunks );
 
-	endian_little_convert_32bit(
-	 media_values->sectors_per_chunk,
-	 volume->sectors_per_chunk );
+	byte_stream_copy_to_uint32_little_endian(
+	 volume->sectors_per_chunk,
+	 media_values->sectors_per_chunk );
 
-	endian_little_convert_32bit(
-	 media_values->bytes_per_sector,
-	 volume->bytes_per_sector );
+	byte_stream_copy_to_uint32_little_endian(
+	 volume->bytes_per_sector,
+	 media_values->bytes_per_sector );
 
-	endian_little_convert_64bit(
-	 media_values->amount_of_sectors,
-	 volume->amount_of_sectors );
+	byte_stream_copy_to_uint64_little_endian(
+	 volume->amount_of_sectors,
+	 media_values->amount_of_sectors );
 
-	endian_little_convert_32bit(
-	 media_values->error_granularity,
-	 volume->error_granularity );
+	byte_stream_copy_to_uint32_little_endian(
+	 volume->error_granularity,
+	 media_values->error_granularity );
 
 	media_values->media_type  = volume->media_type;
 	media_values->media_flags = volume->media_flags;
@@ -1917,19 +1917,19 @@ ssize_t libewf_section_volume_e01_write(
 	}
 	volume->media_flags = media_values->media_flags;
 
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 volume->amount_of_chunks,
 	 media_values->amount_of_chunks );
 
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 volume->sectors_per_chunk,
 	 media_values->sectors_per_chunk );
 
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 volume->bytes_per_sector,
 	 media_values->bytes_per_sector );
 
-	endian_little_revert_64bit(
+	byte_stream_copy_from_uint64_little_endian(
 	 volume->amount_of_sectors,
 	 media_values->amount_of_sectors );
 
@@ -1958,7 +1958,7 @@ ssize_t libewf_section_volume_e01_write(
 
 			return( -1 );
 		}
-		endian_little_revert_32bit(
+		byte_stream_copy_from_uint32_little_endian(
 		 volume->error_granularity,
 		 media_values->error_granularity );
 	}
@@ -1967,7 +1967,7 @@ ssize_t libewf_section_volume_e01_write(
 	                  sizeof( ewf_volume_t ) - sizeof( ewf_crc_t ),
 	                  1 );
 
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 volume->crc,
 	 calculated_crc );
 
@@ -2320,9 +2320,9 @@ ssize_t libewf_section_table_read(
 	                  ( sizeof( ewf_table_t ) - sizeof( ewf_crc_t ) ),
 	                  1 );
 
-	endian_little_convert_32bit(
-	 stored_crc,
-	 table.crc );
+	byte_stream_copy_to_uint32_little_endian(
+	 table.crc,
+	 stored_crc );
 
 	if( stored_crc != calculated_crc )
 	{
@@ -2337,13 +2337,13 @@ ssize_t libewf_section_table_read(
 
 		return( -1 );
 	}
-	endian_little_convert_32bit(
-	 amount_of_chunks,
-	 table.amount_of_chunks );
+	byte_stream_copy_to_uint32_little_endian(
+	 table.amount_of_chunks,
+	 amount_of_chunks );
 
-	endian_little_convert_64bit(
-	 base_offset,
-	 table.base_offset );
+	byte_stream_copy_to_uint64_little_endian(
+	 table.base_offset,
+	 base_offset );
 
 #if defined( HAVE_DEBUG_OUTPUT )
 	libnotify_verbose_printf(
@@ -2464,9 +2464,9 @@ ssize_t libewf_section_table_read(
 			}
 			section_read_count += read_count;
 
-			endian_little_convert_32bit(
-			 stored_crc,
-			 stored_crc_buffer );
+			byte_stream_copy_to_uint32_little_endian(
+			 stored_crc_buffer,
+			 stored_crc );
 
 			if( stored_crc != calculated_crc )
 			{
@@ -2673,9 +2673,9 @@ ssize_t libewf_section_table2_read(
 	                  ( sizeof( ewf_table_t ) - sizeof( ewf_crc_t ) ),
 	                  1 );
 
-	endian_little_convert_32bit(
-	 stored_crc,
-	 table.crc );
+	byte_stream_copy_to_uint32_little_endian(
+	 table.crc,
+	 stored_crc );
 
 	if( stored_crc != calculated_crc )
 	{
@@ -2690,13 +2690,13 @@ ssize_t libewf_section_table2_read(
 
 		return( -1 );
 	}
-	endian_little_convert_32bit(
-	 amount_of_chunks,
-	 table.amount_of_chunks );
+	byte_stream_copy_to_uint32_little_endian(
+	 table.amount_of_chunks,
+	 amount_of_chunks );
 
-	endian_little_convert_64bit(
-	 base_offset,
-	 table.base_offset );
+	byte_stream_copy_to_uint64_little_endian(
+	 table.base_offset,
+	 base_offset );
 
 #if defined( HAVE_DEBUG_OUTPUT )
 	libnotify_verbose_printf(
@@ -2817,9 +2817,9 @@ ssize_t libewf_section_table2_read(
 			}
 			section_read_count += read_count;
 
-			endian_little_convert_32bit(
-			 stored_crc,
-			 stored_crc_buffer );
+			byte_stream_copy_to_uint32_little_endian(
+			 stored_crc_buffer,
+			 stored_crc );
 
 			if( stored_crc != calculated_crc )
 			{
@@ -3022,11 +3022,11 @@ ssize_t libewf_section_table_write(
 
 		return( -1 );
 	}
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 table.amount_of_chunks,
 	 amount_of_offsets );
 
-	endian_little_revert_64bit(
+	byte_stream_copy_from_uint64_little_endian(
 	 table.base_offset,
 	 base_offset );
 
@@ -3035,7 +3035,7 @@ ssize_t libewf_section_table_write(
 	                  ( sizeof( ewf_table_t ) - sizeof( ewf_crc_t ) ),
 	                  1 );
 
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 table.crc,
 	 calculated_crc );
 
@@ -3109,7 +3109,7 @@ ssize_t libewf_section_table_write(
 
 	if( write_crc != 0 )
 	{
-		endian_little_revert_32bit(
+		byte_stream_copy_from_uint32_little_endian(
 		 calculated_crc_buffer,
 		 calculated_crc );
 
@@ -3599,9 +3599,9 @@ ssize_t libewf_section_session_read(
 	                  ( sizeof( ewf_session_t ) - sizeof( ewf_crc_t ) ),
 	                  1 );
 
-	endian_little_convert_32bit(
-	 stored_crc,
-	 ewf_session.crc );
+	byte_stream_copy_to_uint32_little_endian(
+	 ewf_session.crc,
+	 stored_crc );
 
 	if( stored_crc != calculated_crc )
 	{
@@ -3625,9 +3625,9 @@ ssize_t libewf_section_session_read(
 	 28 );
 #endif
 
-	endian_little_convert_32bit(
-	 amount_of_ewf_sessions,
-	 ewf_session.amount_of_sessions );
+	byte_stream_copy_to_uint32_little_endian(
+	 ewf_session.amount_of_sessions,
+	 amount_of_ewf_sessions );
 
 #if defined( HAVE_DEBUG_OUTPUT )
 	libnotify_verbose_printf(
@@ -3705,9 +3705,9 @@ ssize_t libewf_section_session_read(
 		}
 		section_read_count += read_count;
 
-		endian_little_convert_32bit(
-		 stored_crc,
-		 stored_crc_buffer );
+		byte_stream_copy_to_uint32_little_endian(
+		 stored_crc_buffer,
+		 stored_crc );
 
 		if( stored_crc != calculated_crc )
 		{
@@ -3764,9 +3764,9 @@ ssize_t libewf_section_session_read(
 
 		for( iterator = 0; iterator < amount_of_ewf_sessions; iterator++ )
 		{
-			endian_little_convert_32bit(
-			 first_sector,
-			 ewf_sessions[ iterator ].first_sector );
+			byte_stream_copy_to_uint32_little_endian(
+			 ewf_sessions[ iterator ].first_sector,
+			 first_sector );
 
 #if defined( HAVE_DEBUG_OUTPUT )
 			libnotify_verbose_printf(
@@ -3882,7 +3882,7 @@ ssize_t libewf_section_session_write(
 
 		return( -1 );
 	}
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 ewf_session.amount_of_sessions,
 	 sessions->amount );
 
@@ -3891,7 +3891,7 @@ ssize_t libewf_section_session_write(
 	                  ( sizeof( ewf_session_t ) - sizeof( ewf_crc_t ) ),
 	                  1 );
 
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 ewf_session.crc,
 	 calculated_crc );
 
@@ -3911,7 +3911,7 @@ ssize_t libewf_section_session_write(
 	}
 	for( iterator = 0; iterator < sessions->amount; iterator++ )
 	{
-		endian_little_revert_32bit(
+		byte_stream_copy_from_uint32_little_endian(
 		 ewf_sessions[ iterator ].first_sector,
 		 (uint32_t) sessions->sector[ iterator ].first_sector );
 	}
@@ -3990,7 +3990,7 @@ ssize_t libewf_section_session_write(
 	}
 	section_write_count += write_count;
 
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 calculated_crc_buffer,
 	 calculated_crc );
 
@@ -4136,9 +4136,9 @@ ssize_t libewf_section_data_read(
 	                  sizeof( ewf_data_t ) - sizeof( ewf_crc_t ),
 	                  1 );
 
-	endian_little_convert_32bit(
-	 stored_crc,
-	 data->crc );
+	byte_stream_copy_to_uint32_little_endian(
+	 data->crc,
+	 stored_crc );
 
 	if( stored_crc != calculated_crc )
 	{
@@ -4224,9 +4224,9 @@ ssize_t libewf_section_data_read(
 
 		return( -1 );
 	}
-	endian_little_convert_32bit(
-	 amount_of_chunks,
-	 data->amount_of_chunks );
+	byte_stream_copy_to_uint32_little_endian(
+	 data->amount_of_chunks,
+	 amount_of_chunks );
 
 	if( ( amount_of_chunks != 0 )
 	 && ( amount_of_chunks != media_values->amount_of_chunks ) )
@@ -4245,9 +4245,9 @@ ssize_t libewf_section_data_read(
 
 		return( -1 );
 	}
-	endian_little_convert_32bit(
-	 sectors_per_chunk,
-	 data->sectors_per_chunk );
+	byte_stream_copy_to_uint32_little_endian(
+	 data->sectors_per_chunk,
+	 sectors_per_chunk );
 
 	if( ( sectors_per_chunk != 0 )
 	 && ( sectors_per_chunk != media_values->sectors_per_chunk ) )
@@ -4264,9 +4264,9 @@ ssize_t libewf_section_data_read(
 
 		return( -1 );
 	}
-	endian_little_convert_32bit(
-	 bytes_per_sector,
-	 data->bytes_per_sector );
+	byte_stream_copy_to_uint32_little_endian(
+	 data->bytes_per_sector,
+	 bytes_per_sector );
 
 	if( ( bytes_per_sector != 0 )
 	 && ( bytes_per_sector != media_values->bytes_per_sector ) )
@@ -4283,9 +4283,9 @@ ssize_t libewf_section_data_read(
 
 		return( -1 );
 	}
-	endian_little_convert_64bit(
-	 amount_of_sectors,
-	 data->amount_of_sectors );
+	byte_stream_copy_to_uint64_little_endian(
+	 data->amount_of_sectors,
+	 amount_of_sectors );
 
 	if( ( amount_of_sectors != 0 )
 	 && ( amount_of_sectors != media_values->amount_of_sectors ) )
@@ -4302,9 +4302,9 @@ ssize_t libewf_section_data_read(
 
 		return( -1 );
 	}
-	endian_little_convert_32bit(
-	 error_granularity,
-	 data->error_granularity );
+	byte_stream_copy_to_uint32_little_endian(
+	 data->error_granularity,
+	 error_granularity );
 
 	if( ( error_granularity != 0 )
 	 && ( error_granularity != media_values->error_granularity ) )
@@ -4488,19 +4488,19 @@ ssize_t libewf_section_data_write(
 		}
 		( *cached_data_section )->media_flags = media_values->media_flags;
 
-		endian_little_revert_32bit(
+		byte_stream_copy_from_uint32_little_endian(
 		 ( *cached_data_section )->amount_of_chunks,
 		 media_values->amount_of_chunks );
 
-		endian_little_revert_32bit(
+		byte_stream_copy_from_uint32_little_endian(
 		 ( *cached_data_section )->sectors_per_chunk,
 		 media_values->sectors_per_chunk );
 
-		endian_little_revert_32bit(
+		byte_stream_copy_from_uint32_little_endian(
 		 ( *cached_data_section )->bytes_per_sector,
 		 media_values->bytes_per_sector );
 
-		endian_little_revert_64bit(
+		byte_stream_copy_from_uint64_little_endian(
 		 ( *cached_data_section )->amount_of_sectors,
 		 media_values->amount_of_sectors );
 
@@ -4510,7 +4510,7 @@ ssize_t libewf_section_data_write(
 		 || ( format == LIBEWF_FORMAT_LINEN6 )
 		 || ( format == LIBEWF_FORMAT_EWFX ) )
 		{
-			endian_little_revert_32bit(
+			byte_stream_copy_from_uint32_little_endian(
 			 ( *cached_data_section )->error_granularity,
 			 media_values->error_granularity );
 
@@ -4536,7 +4536,7 @@ ssize_t libewf_section_data_write(
 		                  ( sizeof( ewf_data_t ) - sizeof( ewf_crc_t ) ),
 		                  1 );
 
-		endian_little_revert_32bit(
+		byte_stream_copy_from_uint32_little_endian(
 		 ( *cached_data_section )->crc,
 		 calculated_crc );
 	}
@@ -4690,13 +4690,13 @@ ssize_t libewf_section_error2_read(
 	                  ( sizeof( ewf_error2_t ) - sizeof( ewf_crc_t ) ),
 	                  1 );
 
-	endian_little_convert_32bit(
-	 stored_crc,
-	 error2.crc );
+	byte_stream_copy_to_uint32_little_endian(
+	 error2.crc,
+	 stored_crc );
 
-	endian_little_convert_32bit(
-	 amount_of_errors,
-	 error2.amount_of_errors );
+	byte_stream_copy_to_uint32_little_endian(
+	 error2.amount_of_errors,
+	 amount_of_errors );
 
 	if( stored_crc != calculated_crc )
 	{
@@ -4789,9 +4789,9 @@ ssize_t libewf_section_error2_read(
 		}
 		section_read_count += read_count;
 
-		endian_little_convert_32bit(
-		 stored_crc,
-		 stored_crc_buffer );
+		byte_stream_copy_to_uint32_little_endian(
+		 stored_crc_buffer,
+		 stored_crc );
 
 		if( stored_crc != calculated_crc )
 		{
@@ -4851,15 +4851,15 @@ ssize_t libewf_section_error2_read(
 
 		for( iterator = 0; iterator < amount_of_errors; iterator++ )
 		{
-			endian_little_convert_32bit(
-			 first_sector,
-			 error2_sectors[ iterator ].first_sector );
+			byte_stream_copy_to_uint32_little_endian(
+			 error2_sectors[ iterator ].first_sector,
+			 first_sector );
 
 			acquiry_errors->sector[ iterator ].first_sector = (uint64_t) first_sector;
 
-			endian_little_convert_32bit(
-			 acquiry_errors->sector[ iterator ].amount_of_sectors,
-			 error2_sectors[ iterator ].amount_of_sectors );
+			byte_stream_copy_to_uint32_little_endian(
+			 error2_sectors[ iterator ].amount_of_sectors,
+			 acquiry_errors->sector[ iterator ].amount_of_sectors );
 		}
 		memory_free(
 		 error2_sectors );
@@ -4951,7 +4951,7 @@ ssize_t libewf_section_error2_write(
 
 		return( -1 );
 	}
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 error2.amount_of_errors,
 	 acquiry_errors->amount );
 
@@ -4960,7 +4960,7 @@ ssize_t libewf_section_error2_write(
 	                  ( sizeof( ewf_error2_t ) - sizeof( ewf_crc_t ) ),
 	                  1 );
 
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 error2.crc,
 	 calculated_crc );
 
@@ -4982,11 +4982,11 @@ ssize_t libewf_section_error2_write(
 	}
 	for( iterator = 0; iterator < acquiry_errors->amount; iterator++ )
 	{
-		endian_little_revert_32bit(
+		byte_stream_copy_from_uint32_little_endian(
 		 error2_sectors[ iterator ].first_sector,
 		 (uint32_t) acquiry_errors->sector[ iterator ].first_sector );
 
-		endian_little_revert_32bit(
+		byte_stream_copy_from_uint32_little_endian(
 		 error2_sectors[ iterator ].amount_of_sectors,
 		 acquiry_errors->sector[ iterator ].amount_of_sectors );
 	}
@@ -5065,7 +5065,7 @@ ssize_t libewf_section_error2_write(
 	}
 	section_write_count += write_count;
 
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 calculated_crc_buffer,
 	 calculated_crc );
 
@@ -5183,9 +5183,9 @@ ssize_t libewf_section_digest_read(
 	                  ( sizeof( ewf_digest_t ) - sizeof( ewf_crc_t ) ),
 	                  1 );
 
-	endian_little_convert_32bit(
-	 stored_crc,
-	 digest.crc );
+	byte_stream_copy_to_uint32_little_endian(
+	 digest.crc,
+	 stored_crc );
 
 	if( stored_crc != calculated_crc )
 	{
@@ -5381,7 +5381,7 @@ ssize_t libewf_section_digest_write(
 	                  ( sizeof( ewf_digest_t ) - sizeof( ewf_crc_t ) ),
 	                  1 );
 
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 digest.crc,
 	 calculated_crc );
 
@@ -5509,9 +5509,9 @@ ssize_t libewf_section_hash_read(
 	                  ( sizeof( ewf_hash_t ) - sizeof( ewf_crc_t ) ),
 	                  1 );
 
-	endian_little_convert_32bit(
-	 stored_crc,
-	 hash.crc );
+	byte_stream_copy_to_uint32_little_endian(
+	 hash.crc,
+	 stored_crc );
 
 	if( stored_crc != calculated_crc )
 	{
@@ -5655,7 +5655,7 @@ ssize_t libewf_section_hash_write(
 	                  ( sizeof( ewf_hash_t ) - sizeof( ewf_crc_t ) ),
 	                  1 );
 
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 hash.crc,
 	 calculated_crc );
 
@@ -5827,11 +5827,11 @@ ssize_t libewf_section_last_write(
 
 		return( -1 );
 	}
-	endian_little_revert_64bit(
+	byte_stream_copy_from_uint64_little_endian(
 	 section.size,
 	 section_size );
 
-	endian_little_revert_64bit(
+	byte_stream_copy_from_uint64_little_endian(
 	 section.next,
 	 section_offset );
 
@@ -5840,7 +5840,7 @@ ssize_t libewf_section_last_write(
 	                  ( sizeof( ewf_section_t ) - sizeof( ewf_crc_t ) ),
 	                  1 );
 
-	endian_little_revert_32bit(	
+	byte_stream_copy_from_uint32_little_endian(	
 	 section.crc,
 	 calculated_crc );
 
@@ -6375,9 +6375,9 @@ ssize_t libewf_section_delta_chunk_read(
 	                  ( sizeof( ewfx_delta_chunk_header_t ) - sizeof( ewf_crc_t ) ),
 	                  1 );
 
-	endian_little_convert_32bit(
-	 stored_crc,
-	 delta_chunk_header.crc );
+	byte_stream_copy_to_uint32_little_endian(
+	 delta_chunk_header.crc,
+	 stored_crc );
 
 	if( stored_crc != calculated_crc )
 	{
@@ -6394,9 +6394,9 @@ ssize_t libewf_section_delta_chunk_read(
 	}
 	/* The chunk value is stored + 1 count in the file
 	 */
-	endian_little_convert_32bit(
-	 chunk,
-	 delta_chunk_header.chunk );
+	byte_stream_copy_to_uint32_little_endian(
+	 delta_chunk_header.chunk,
+	 chunk );
 
 	chunk -= 1;
 
@@ -6412,9 +6412,9 @@ ssize_t libewf_section_delta_chunk_read(
 
 		return( -1 );
 	}
-	endian_little_convert_32bit(
-	 chunk_size,
-	 delta_chunk_header.chunk_size );
+	byte_stream_copy_to_uint32_little_endian(
+	 delta_chunk_header.chunk_size,
+	 chunk_size );
 
 	if( chunk_size != ( section_size - sizeof( ewfx_delta_chunk_header_t ) ) )
 	{
@@ -6565,11 +6565,11 @@ ssize_t libewf_section_delta_chunk_write(
 	}
 	/* The chunk value is stored + 1 count in the file
 	 */
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 delta_chunk_header.chunk,
 	 ( chunk + 1 ) );
 
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 delta_chunk_header.chunk_size,
 	 (uint32_t) write_size );
 
@@ -6584,7 +6584,7 @@ ssize_t libewf_section_delta_chunk_write(
 	                  ( sizeof( ewfx_delta_chunk_header_t ) - sizeof( ewf_crc_t ) ),
 	                  1 );
 
-	endian_little_revert_32bit(
+	byte_stream_copy_from_uint32_little_endian(
 	 delta_chunk_header.crc,
 	 calculated_crc );
 
@@ -6646,7 +6646,7 @@ ssize_t libewf_section_delta_chunk_write(
 
 			return( -1 );
 		}
-		endian_little_revert_32bit(
+		byte_stream_copy_from_uint32_little_endian(
 		 crc_buffer,
 		 *chunk_crc );
 
diff --git a/libewf/libewf_section.h b/libewf/libewf_section.h
index c6d520d..630905e 100644
--- a/libewf/libewf_section.h
+++ b/libewf/libewf_section.h
@@ -2,7 +2,7 @@
  * Section reading/writing functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_section_list.c b/libewf/libewf_section_list.c
index 267322b..24d6990 100644
--- a/libewf/libewf_section_list.c
+++ b/libewf/libewf_section_list.c
@@ -2,7 +2,7 @@
  * Section list functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_section_list.h b/libewf/libewf_section_list.h
index 60da3b6..a27e104 100644
--- a/libewf/libewf_section_list.h
+++ b/libewf/libewf_section_list.h
@@ -2,7 +2,7 @@
  * Section list functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_sector_table.c b/libewf/libewf_sector_table.c
index a7b4310..b0d7e85 100644
--- a/libewf/libewf_sector_table.c
+++ b/libewf/libewf_sector_table.c
@@ -2,7 +2,7 @@
  * Error sector table functions, for CRC and acquiry read errrors
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_sector_table.h b/libewf/libewf_sector_table.h
index afe6259..9483c0f 100644
--- a/libewf/libewf_sector_table.h
+++ b/libewf/libewf_sector_table.h
@@ -2,7 +2,7 @@
  * Error sector table functions, for CRC and acquiry read errrors
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_segment_file.c b/libewf/libewf_segment_file.c
index ae9bd1a..a370d8f 100644
--- a/libewf/libewf_segment_file.c
+++ b/libewf/libewf_segment_file.c
@@ -2,7 +2,7 @@
  * Segment file reading/writing functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -21,7 +21,7 @@
  */
 
 #include <common.h>
-#include <endian.h>
+#include <byte_stream.h>
 #include <memory.h>
 #include <types.h>
 
@@ -159,9 +159,9 @@ ssize_t libewf_segment_file_read_file_header(
 
 		return( -1 );
 	}
-	endian_little_convert_16bit(
-	 *segment_number,
-	 file_header.fields_segment );
+	byte_stream_copy_to_uint16_little_endian(
+	 file_header.fields_segment,
+	 *segment_number );
 
 	return( read_count );
 }
@@ -810,7 +810,7 @@ ssize_t libewf_segment_file_write_start(
 
 		return( -1 );
 	}
-	endian_little_revert_16bit(
+	byte_stream_copy_from_uint16_little_endian(
 	 file_header.fields_segment,
 	 segment_number );
 
@@ -1544,7 +1544,7 @@ ssize_t libewf_segment_file_write_chunk(
 
 			return( -1 );
 		}
-		endian_little_revert_32bit(
+		byte_stream_copy_from_uint32_little_endian(
 		 crc_buffer,
 		 *chunk_crc );
 
diff --git a/libewf/libewf_segment_file.h b/libewf/libewf_segment_file.h
index 3153015..923ae1c 100644
--- a/libewf/libewf_segment_file.h
+++ b/libewf/libewf_segment_file.h
@@ -2,7 +2,7 @@
  * Segment file reading/writing functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_segment_file_handle.c b/libewf/libewf_segment_file_handle.c
index 0050d35..1691716 100644
--- a/libewf/libewf_segment_file_handle.c
+++ b/libewf/libewf_segment_file_handle.c
@@ -2,7 +2,7 @@
  * Segment file handle
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_segment_file_handle.h b/libewf/libewf_segment_file_handle.h
index e59bd84..7a26cc0 100644
--- a/libewf/libewf_segment_file_handle.h
+++ b/libewf/libewf_segment_file_handle.h
@@ -2,7 +2,7 @@
  * Segment file handle
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_segment_table.c b/libewf/libewf_segment_table.c
index 4acc8a1..8da921d 100644
--- a/libewf/libewf_segment_table.c
+++ b/libewf/libewf_segment_table.c
@@ -2,7 +2,7 @@
  * Segment table functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_segment_table.h b/libewf/libewf_segment_table.h
index c044317..d2deaf7 100644
--- a/libewf/libewf_segment_table.h
+++ b/libewf/libewf_segment_table.h
@@ -2,7 +2,7 @@
  * Segment table functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_string.c b/libewf/libewf_string.c
index ce1a034..632ce49 100644
--- a/libewf/libewf_string.c
+++ b/libewf/libewf_string.c
@@ -2,7 +2,7 @@
  * Character type string functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_string.h b/libewf/libewf_string.h
index 8108365..956f967 100644
--- a/libewf/libewf_string.h
+++ b/libewf/libewf_string.h
@@ -2,7 +2,7 @@
  * Character type string functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_support.c b/libewf/libewf_support.c
index bdc79c8..e88679e 100644
--- a/libewf/libewf_support.c
+++ b/libewf/libewf_support.c
@@ -2,7 +2,7 @@
  * Support functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -562,29 +562,31 @@ int libewf_check_file_signature_wide(
  * Returns 1 if true, 0 if not or -1 on error
  */
 int libewf_check_file_signature_file_io_handle(
-     libbfio_handle_t *bfio_handle,
+     libbfio_handle_t *file_io_handle,
      liberror_error_t **error )
 {
 	uint8_t signature[ 8 ];
 
-	static char *function = "libewf_check_file_signature_file_io_handle";
-	ssize_t read_count    = 0;
+	static char *function      = "libewf_check_file_signature_file_io_handle";
+	ssize_t read_count         = 0;
+	int file_io_handle_is_open = 0;
 
-	if( bfio_handle == NULL )
+	if( file_io_handle == NULL )
 	{
 		liberror_error_set(
 		 error,
 		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
 		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid bfio handle.",
+		 "%s: invalid file io handle.",
 		 function );
 
 		return( -1 );
 	}
-	if( libbfio_handle_open(
-	     bfio_handle,
-	     LIBBFIO_OPEN_READ,
-	     error ) != 1 )
+	file_io_handle_is_open = libbfio_handle_is_open(
+	                          file_io_handle,
+	                          error );
+
+	if( file_io_handle_is_open == -1 )
 	{
 		liberror_error_set(
 		 error,
@@ -595,8 +597,46 @@ int libewf_check_file_signature_file_io_handle(
 
 		return( -1 );
 	}
+	else if( file_io_handle_is_open == 0 )
+	{
+		if( libbfio_handle_open(
+		     file_io_handle,
+		     LIBBFIO_OPEN_READ,
+		     error ) != 1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_IO,
+			 LIBERROR_IO_ERROR_OPEN_FAILED,
+			 "%s: unable to open file.",
+			 function );
+
+			return( -1 );
+		}
+	}
+	if( libbfio_handle_seek_offset(
+	     file_io_handle,
+	     0,
+	     SEEK_SET,
+	     error ) == -1 )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_IO,
+		 LIBERROR_IO_ERROR_SEEK_FAILED,
+		 "%s: unable to seek file header offset: 0.",
+		 function );
+
+		if( file_io_handle_is_open == 0 )
+		{
+			libbfio_handle_close(
+			 file_io_handle,
+			 error );
+		}
+		return( -1 );
+	}
 	read_count = libbfio_handle_read(
-	              bfio_handle,
+	              file_io_handle,
 	              signature,
 	              8,
 	              error );
@@ -611,23 +651,26 @@ int libewf_check_file_signature_file_io_handle(
 		 function );
 
 		libbfio_handle_close(
-		 bfio_handle,
+		 file_io_handle,
 		 NULL );
 
 		return( -1 );
 	}
-	if( libbfio_handle_close(
-	     bfio_handle,
-	     error ) != 0 )
+	if( file_io_handle_is_open == 0 )
 	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_IO,
-		 LIBERROR_IO_ERROR_CLOSE_FAILED,
-		 "%s: unable to close file.",
-		 function );
+		if( libbfio_handle_close(
+		     file_io_handle,
+		     error ) != 0 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_IO,
+			 LIBERROR_IO_ERROR_CLOSE_FAILED,
+			 "%s: unable to close file.",
+			 function );
 
-		return( -1 );
+			return( -1 );
+		}
 	}
 	/* The amount of EWF segment files will be the largest
 	 */
diff --git a/libewf/libewf_support.h b/libewf/libewf_support.h
index bb12816..27f036a 100644
--- a/libewf/libewf_support.h
+++ b/libewf/libewf_support.h
@@ -2,7 +2,7 @@
  * Support functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -75,7 +75,7 @@ LIBEWF_EXTERN int libewf_check_file_signature_wide(
 #endif
 
 LIBEWF_EXTERN int libewf_check_file_signature_file_io_handle(
-                   libbfio_handle_t *bfio_handle,
+                   libbfio_handle_t *file_io_handle,
                    liberror_error_t **error );
 
 #if defined( HAVE_V2_API )
diff --git a/libewf/libewf_system_string.h b/libewf/libewf_system_string.h
index fccd694..72f2b5e 100644
--- a/libewf/libewf_system_string.h
+++ b/libewf/libewf_system_string.h
@@ -2,7 +2,7 @@
  * System character type string functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_types.h b/libewf/libewf_types.h
index 7c5e653..718f883 100644
--- a/libewf/libewf_types.h
+++ b/libewf/libewf_types.h
@@ -2,7 +2,7 @@
  * The internal type definitions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_values_table.c b/libewf/libewf_values_table.c
index cb1587d..97cc515 100644
--- a/libewf/libewf_values_table.c
+++ b/libewf/libewf_values_table.c
@@ -2,7 +2,7 @@
  * Values table functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_values_table.h b/libewf/libewf_values_table.h
index a8cec18..6205412 100644
--- a/libewf/libewf_values_table.h
+++ b/libewf/libewf_values_table.h
@@ -2,7 +2,7 @@
  * Values table functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libewf/libewf_write_io_handle.c b/libewf/libewf_write_io_handle.c
index 661b373..6f87734 100644
--- a/libewf/libewf_write_io_handle.c
+++ b/libewf/libewf_write_io_handle.c
@@ -2,7 +2,7 @@
  * Low level writing functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -21,7 +21,7 @@
  */
 
 #include <common.h>
-#include <endian.h>
+#include <byte_stream.h>
 #include <memory.h>
 #include <types.h>
 
@@ -31,6 +31,7 @@
 #include "libewf_chunk_cache.h"
 #include "libewf_compression.h"
 #include "libewf_definitions.h"
+#include "libewf_empty_block.h"
 #include "libewf_header_values.h"
 #include "libewf_libbfio.h"
 #include "libewf_media_values.h"
@@ -742,49 +743,6 @@ int libewf_write_io_handle_initialize_resume(
 	return( 1 );
 }
 
-/* Check for empty block, a block that contains the same value for every byte
- * Returns 1 if block is empty, 0 if not or -1 on error
- */
-int libewf_write_io_handle_test_empty_block(
-     uint8_t *buffer,
-     size_t size,
-     liberror_error_t **error )
-{
-	static char *function = "libewf_write_io_handle_test_empty_block";
-	size_t iterator       = 0;
-
-	if( buffer == NULL )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
-		 "%s: invalid buffer.",
-		 function );
-
-		return( -1 );
-	}
-	if( size > (size_t) SSIZE_MAX )
-	{
-		liberror_error_set(
-		 error,
-		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
-		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
-		 "%s: invalid size value exceeds maximum.",
-		 function );
-
-		return( -1 );
-	}
-	for( iterator = 1; iterator < size; iterator++ )
-	{
-		if( buffer[ 0 ] != buffer[ iterator ] )
-		{
-			return( 0 );
-		}
-	}
-	return( 1 );
-}
-
 /* Calculates an estimate of the amount of chunks that fit within a segment file
  * Returns 1 if successful or -1 on error
  */
@@ -952,7 +910,7 @@ int libewf_write_io_handle_calculate_chunks_per_chunks_section(
      uint32_t *chunks_per_chunks_section,
      uint32_t maximum_section_amount_of_chunks,
      uint32_t chunks_per_segment,
-     uint8_t chunks_section_number,
+     uint32_t chunks_section_number,
      uint8_t unrestrict_offset_amount,
      liberror_error_t **error )
 {
@@ -1299,6 +1257,7 @@ ssize_t libewf_write_io_handle_process_chunk(
 	size_t data_write_size         = 0;
 	int8_t chunk_compression_level = 0;
 	int chunk_cache_data_used      = 0;
+	int is_empty_block             = 0;
 	int result                     = 0;
 
 	if( chunk_cache == NULL )
@@ -1412,12 +1371,12 @@ ssize_t libewf_write_io_handle_process_chunk(
 	 */
 	if( ( compression_flags & LIBEWF_FLAG_COMPRESS_EMPTY_BLOCK ) == LIBEWF_FLAG_COMPRESS_EMPTY_BLOCK )
 	{
-		result = libewf_write_io_handle_test_empty_block(
-		          chunk_data,
-		          chunk_data_size,
-		          error );
+		is_empty_block = libewf_empty_block_test(
+		                  chunk_data,
+		                  chunk_data_size,
+		                  error );
 
-		if( result == -1 )
+		if( is_empty_block == -1 )
 		{
 			liberror_error_set(
 			 error,
@@ -1428,7 +1387,7 @@ ssize_t libewf_write_io_handle_process_chunk(
 
 			return( -1 );
 		}
-		else if( result == 1 )
+		else if( is_empty_block == 1 )
 		{
 			if( chunk_compression_level == EWF_COMPRESSION_NONE )
 			{
@@ -1489,68 +1448,132 @@ ssize_t libewf_write_io_handle_process_chunk(
 
 			return( -1 );
 		}
-		result = libewf_compress(
-			  (uint8_t *) compressed_chunk_data,
-			  compressed_chunk_data_size,
-			  (uint8_t *) chunk_data,
-			  chunk_data_size,
-			  chunk_compression_level,
-		          error );
-
-		/* Check if the compressed buffer was too small
-		 * and the chunk cache is used to store the compressed chunk
-		 * and a new compressed data size buffer was passed back
+		/* Use the cached version of the zero byte empty block data if available
 		 */
-		if( ( result == -1 )
-		 && ( compressed_chunk_data == chunk_cache->compressed )
-		 && ( *compressed_chunk_data_size > 0 ) )
-		{
-			liberror_error_free(
-			 error );
-
-			chunk_cache_data_used = (int) ( chunk_data == chunk_cache->data );
-
-			if( libewf_chunk_cache_resize(
-			     chunk_cache,
-			     *compressed_chunk_data_size,
-			     error ) != 1 )
+		if( ( is_empty_block != 0 )
+		 && ( chunk_data[ 0 ] == 0 )
+		 && ( chunk_cache->zero_byte_empty_block_uncompressed_size == chunk_data_size )
+		 && ( chunk_cache->zero_byte_empty_block_compressed != NULL ) )
+		{
+			if( memory_copy(
+			     compressed_chunk_data,
+			     chunk_cache->zero_byte_empty_block_compressed,
+			     chunk_cache->zero_byte_empty_block_compressed_size ) == NULL )
 			{
 				liberror_error_set(
 				 error,
-				 LIBERROR_ERROR_DOMAIN_RUNTIME,
-				 LIBERROR_RUNTIME_ERROR_RESIZE_FAILED,
-				 "%s: unable to resize chunk cache.",
+				 LIBERROR_ERROR_DOMAIN_MEMORY,
+				 LIBERROR_MEMORY_ERROR_COPY_FAILED,
+				 "%s: unable to set compressed data.",
 				 function );
 
 				return( -1 );
 			}
-			/* Make sure the pointer refers to the reallocated buffer
-			 */
-			compressed_chunk_data = chunk_cache->compressed;
-
-			if( ( chunk_cache_data_used == 1 )
-			 && ( chunk_data != chunk_cache->data ) )
-			{
-				chunk_data = chunk_cache->data;
-			}
+			*compressed_chunk_data_size = chunk_cache->zero_byte_empty_block_compressed_size;
+		}
+		else
+		{
 			result = libewf_compress(
 				  (uint8_t *) compressed_chunk_data,
 				  compressed_chunk_data_size,
 				  (uint8_t *) chunk_data,
 				  chunk_data_size,
 				  chunk_compression_level,
-			          error );
-		}
-		if( result != 1 )
-		{
-			liberror_error_set(
-			 error,
-			 LIBERROR_ERROR_DOMAIN_COMPRESSION,
-			 LIBERROR_COMPRESSION_ERROR_COMPRESS_FAILED,
-			 "%s: unable to compress chunk.",
-			 function );
+				  error );
 
-			return( -1 );
+			/* Check if the compressed buffer was too small
+			 * and the chunk cache is used to store the compressed chunk
+			 * and a new compressed data size buffer was passed back
+			 */
+			if( ( result == -1 )
+			 && ( compressed_chunk_data == chunk_cache->compressed )
+			 && ( *compressed_chunk_data_size > 0 ) )
+			{
+				liberror_error_free(
+				 error );
+
+				chunk_cache_data_used = (int) ( chunk_data == chunk_cache->data );
+
+				if( libewf_chunk_cache_resize(
+				     chunk_cache,
+				     *compressed_chunk_data_size,
+				     error ) != 1 )
+				{
+					liberror_error_set(
+					 error,
+					 LIBERROR_ERROR_DOMAIN_RUNTIME,
+					 LIBERROR_RUNTIME_ERROR_RESIZE_FAILED,
+					 "%s: unable to resize chunk cache.",
+					 function );
+
+					return( -1 );
+				}
+				/* Make sure the pointer refers to the reallocated buffer
+				 */
+				compressed_chunk_data = chunk_cache->compressed;
+
+				if( ( chunk_cache_data_used == 1 )
+				 && ( chunk_data != chunk_cache->data ) )
+				{
+					chunk_data = chunk_cache->data;
+				}
+				result = libewf_compress(
+					  (uint8_t *) compressed_chunk_data,
+					  compressed_chunk_data_size,
+					  (uint8_t *) chunk_data,
+					  chunk_data_size,
+					  chunk_compression_level,
+					  error );
+			}
+			if( result != 1 )
+			{
+				liberror_error_set(
+				 error,
+				 LIBERROR_ERROR_DOMAIN_COMPRESSION,
+				 LIBERROR_COMPRESSION_ERROR_COMPRESS_FAILED,
+				 "%s: unable to compress chunk.",
+				 function );
+
+				return( -1 );
+			}
+			/* Cache a compressed zero byte empty block
+			 */
+			if( ( is_empty_block != 0 )
+			 && ( chunk_data[ 0 ] == 0 )
+			 && ( chunk_cache->zero_byte_empty_block_compressed == NULL ) )
+			{
+				chunk_cache->zero_byte_empty_block_compressed = (uint8_t *) memory_allocate(
+											     *compressed_chunk_data_size );
+
+				if( chunk_cache->zero_byte_empty_block_compressed == NULL )
+				{	
+					liberror_error_set(
+					 error,
+					 LIBERROR_ERROR_DOMAIN_MEMORY,
+					 LIBERROR_MEMORY_ERROR_INSUFFICIENT,
+					 "%s: unable to create zero byte empty block compressed data cache.",
+					 function );
+
+					return( -1 );
+				}
+				chunk_cache->zero_byte_empty_block_compressed_size = *compressed_chunk_data_size;
+
+				if( memory_copy(
+				     chunk_cache->zero_byte_empty_block_compressed,
+				     compressed_chunk_data,
+				     *compressed_chunk_data_size ) == NULL )
+				{
+					liberror_error_set(
+					 error,
+					 LIBERROR_ERROR_DOMAIN_MEMORY,
+					 LIBERROR_MEMORY_ERROR_COPY_FAILED,
+					 "%s: unable to set zero byte empty block compressed data cache.",
+					 function );
+
+					return( -1 );
+				}
+				chunk_cache->zero_byte_empty_block_uncompressed_size = chunk_data_size;
+			}
 		}
 	}
 	if( ( chunk_exists == 0 )
@@ -1595,7 +1618,7 @@ ssize_t libewf_write_io_handle_process_chunk(
 		{
 			chunk_data_crc = &( chunk_data[ chunk_data_size ] );
 
-			endian_little_revert_32bit(
+			byte_stream_copy_from_uint32_little_endian(
 			 chunk_data_crc,
 			 *chunk_crc );
 
diff --git a/libewf/libewf_write_io_handle.h b/libewf/libewf_write_io_handle.h
index d6b8dea..cf5a6cd 100644
--- a/libewf/libewf_write_io_handle.h
+++ b/libewf/libewf_write_io_handle.h
@@ -2,7 +2,7 @@
  * Low level writing functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -113,7 +113,7 @@ struct libewf_write_io_handle
 
 	/* The current chunks section number
 	 */
-	uint8_t chunks_section_number;
+	uint32_t chunks_section_number;
 
 	/* Value to indicate if the offset table should not be restricted
 	 * to the maximum amount of offsets
@@ -181,7 +181,7 @@ int libewf_write_io_handle_calculate_chunks_per_chunks_section(
      uint32_t *chunks_per_chunks_section,
      uint32_t maximum_section_amount_of_chunks,
      uint32_t chunks_per_segment,
-     uint8_t chunks_section_number,
+     uint32_t chunks_section_number,
      uint8_t unrestrict_offset_amount,
      liberror_error_t **error );
 
diff --git a/libnotify/libnotify.c b/libnotify/libnotify.c
index 7a1cf29..a9c4838 100644
--- a/libnotify/libnotify.c
+++ b/libnotify/libnotify.c
@@ -2,7 +2,7 @@
  * Notification library
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libnotify/libnotify.h b/libnotify/libnotify.h
index bf8071f..e3042fc 100644
--- a/libnotify/libnotify.h
+++ b/libnotify/libnotify.h
@@ -2,7 +2,7 @@
  * Notification library
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem.h b/libsystem/libsystem.h
index 78c2f05..3e37029 100644
--- a/libsystem/libsystem.h
+++ b/libsystem/libsystem.h
@@ -3,7 +3,7 @@
  * required for tooling
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_date_time.c b/libsystem/libsystem_date_time.c
index d424c13..f5b12c4 100644
--- a/libsystem/libsystem_date_time.c
+++ b/libsystem/libsystem_date_time.c
@@ -2,7 +2,7 @@
  * Date and time functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_date_time.h b/libsystem/libsystem_date_time.h
index 953d8eb..20bff9f 100644
--- a/libsystem/libsystem_date_time.h
+++ b/libsystem/libsystem_date_time.h
@@ -2,7 +2,7 @@
  * Date and time functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_directory.h b/libsystem/libsystem_directory.h
index b61c08c..333aeb7 100644
--- a/libsystem/libsystem_directory.h
+++ b/libsystem/libsystem_directory.h
@@ -2,7 +2,7 @@
  * Directory functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_directory_io.h b/libsystem/libsystem_directory_io.h
index 087d16a..affd301 100644
--- a/libsystem/libsystem_directory_io.h
+++ b/libsystem/libsystem_directory_io.h
@@ -2,7 +2,7 @@
  * Directory IO functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_error.c b/libsystem/libsystem_error.c
index d5fdf58..3a32de5 100644
--- a/libsystem/libsystem_error.c
+++ b/libsystem/libsystem_error.c
@@ -2,7 +2,7 @@
  * Error string functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_error.h b/libsystem/libsystem_error.h
index adccf6b..2e304d0 100644
--- a/libsystem/libsystem_error.h
+++ b/libsystem/libsystem_error.h
@@ -2,7 +2,7 @@
  * Error functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_file.c b/libsystem/libsystem_file.c
index f26da48..4a96496 100644
--- a/libsystem/libsystem_file.c
+++ b/libsystem/libsystem_file.c
@@ -2,7 +2,7 @@
  * File functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_file.h b/libsystem/libsystem_file.h
index e724eae..c82a7c9 100644
--- a/libsystem/libsystem_file.h
+++ b/libsystem/libsystem_file.h
@@ -2,7 +2,7 @@
  * File functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_file_io.h b/libsystem/libsystem_file_io.h
index 7f9826a..259ac39 100644
--- a/libsystem/libsystem_file_io.h
+++ b/libsystem/libsystem_file_io.h
@@ -2,7 +2,7 @@
  * File IO functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_file_stream.h b/libsystem/libsystem_file_stream.h
index 89c8963..2ac69a3 100644
--- a/libsystem/libsystem_file_stream.h
+++ b/libsystem/libsystem_file_stream.h
@@ -2,7 +2,7 @@
  * File stream functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_getopt.c b/libsystem/libsystem_getopt.c
index 3b30e04..96372d4 100644
--- a/libsystem/libsystem_getopt.c
+++ b/libsystem/libsystem_getopt.c
@@ -2,7 +2,7 @@
  * GetOpt functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_getopt.h b/libsystem/libsystem_getopt.h
index 7969475..8bbbf11 100644
--- a/libsystem/libsystem_getopt.h
+++ b/libsystem/libsystem_getopt.h
@@ -2,7 +2,7 @@
  * GetOpt functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_glob.c b/libsystem/libsystem_glob.c
index fd90877..a52d4a3 100644
--- a/libsystem/libsystem_glob.c
+++ b/libsystem/libsystem_glob.c
@@ -2,7 +2,7 @@
  * Globbing functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -333,7 +333,9 @@ int libsystem_glob_resolve(
 
 		return( -1 );
 	}
-	for( iterator = 0; iterator < amount_of_patterns; iterator++ )
+	for( iterator = 0;
+	     iterator < amount_of_patterns;
+	     iterator++ )
 	{
 		if( patterns[ iterator ] == NULL )
 		{
@@ -521,7 +523,7 @@ int libsystem_glob_resolve(
 			return( -1 );
 		}
 	}
-	return( globs_found );
+	return( 1 );
 }
 
 #endif
diff --git a/libsystem/libsystem_glob.h b/libsystem/libsystem_glob.h
index 8ea6be7..e24a2f2 100644
--- a/libsystem/libsystem_glob.h
+++ b/libsystem/libsystem_glob.h
@@ -2,7 +2,7 @@
  * Globbing functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_libuna.h b/libsystem/libsystem_libuna.h
index a14a681..4f2f3db 100644
--- a/libsystem/libsystem_libuna.h
+++ b/libsystem/libsystem_libuna.h
@@ -2,7 +2,7 @@
  * The internal libuna header
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_notify.c b/libsystem/libsystem_notify.c
index 121962f..56a1fa7 100644
--- a/libsystem/libsystem_notify.c
+++ b/libsystem/libsystem_notify.c
@@ -2,7 +2,7 @@
  * Notification functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_notify.h b/libsystem/libsystem_notify.h
index 6d4d5c8..218fd70 100644
--- a/libsystem/libsystem_notify.h
+++ b/libsystem/libsystem_notify.h
@@ -2,7 +2,7 @@
  * Notification functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_signal.c b/libsystem/libsystem_signal.c
index 17c7aa3..c62f3a4 100644
--- a/libsystem/libsystem_signal.c
+++ b/libsystem/libsystem_signal.c
@@ -2,7 +2,7 @@
  * Signal handling functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_signal.h b/libsystem/libsystem_signal.h
index 1ffee40..42c7b1a 100644
--- a/libsystem/libsystem_signal.h
+++ b/libsystem/libsystem_signal.h
@@ -2,7 +2,7 @@
  * Signal handling functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_string.c b/libsystem/libsystem_string.c
index f39bf96..d02c89b 100644
--- a/libsystem/libsystem_string.c
+++ b/libsystem/libsystem_string.c
@@ -2,7 +2,7 @@
  * Character string functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_string.h b/libsystem/libsystem_string.h
index 7932976..f0e5518 100644
--- a/libsystem/libsystem_string.h
+++ b/libsystem/libsystem_string.h
@@ -2,7 +2,7 @@
  * System character string functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_support.c b/libsystem/libsystem_support.c
index 10ec474..fd698e3 100644
--- a/libsystem/libsystem_support.c
+++ b/libsystem/libsystem_support.c
@@ -2,7 +2,7 @@
  * Support functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libsystem/libsystem_support.h b/libsystem/libsystem_support.h
index 2d05cef..486f77a 100644
--- a/libsystem/libsystem_support.h
+++ b/libsystem/libsystem_support.h
@@ -2,7 +2,7 @@
  * Support functions
  *
  * Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/Makefile.am b/libuna/Makefile.am
index 3aaab3f..2234cef 100644
--- a/libuna/Makefile.am
+++ b/libuna/Makefile.am
@@ -8,6 +8,8 @@ AM_CPPFLAGS = \
 noinst_LTLIBRARIES = libuna.la
 
 libuna_la_SOURCES = \
+	libuna_base64_stream.c libuna_base64_stream.h \
+	libuna_base64url_stream.c libuna_base64url_stream.h \
 	libuna_byte_stream.c libuna_byte_stream.h \
 	libuna_compare.c libuna_compare.h \
 	libuna_codepage_ascii.h \
diff --git a/libuna/Makefile.in b/libuna/Makefile.in
index cb11edf..efdd3a4 100644
--- a/libuna/Makefile.in
+++ b/libuna/Makefile.in
@@ -49,44 +49,50 @@ CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 LTLIBRARIES = $(noinst_LTLIBRARIES)
 libuna_la_LIBADD =
-am__libuna_la_SOURCES_DIST = libuna_byte_stream.c libuna_byte_stream.h \
-	libuna_compare.c libuna_compare.h libuna_codepage_ascii.h \
-	libuna_codepage_iso_8859_1.h libuna_codepage_iso_8859_2.c \
-	libuna_codepage_iso_8859_2.h libuna_codepage_iso_8859_3.c \
-	libuna_codepage_iso_8859_3.h libuna_codepage_iso_8859_4.c \
-	libuna_codepage_iso_8859_4.h libuna_codepage_iso_8859_5.c \
-	libuna_codepage_iso_8859_5.h libuna_codepage_iso_8859_6.c \
-	libuna_codepage_iso_8859_6.h libuna_codepage_iso_8859_7.c \
-	libuna_codepage_iso_8859_7.h libuna_codepage_iso_8859_8.c \
-	libuna_codepage_iso_8859_8.h libuna_codepage_iso_8859_9.c \
-	libuna_codepage_iso_8859_9.h libuna_codepage_iso_8859_10.c \
-	libuna_codepage_iso_8859_10.h libuna_codepage_iso_8859_11.h \
-	libuna_codepage_iso_8859_13.c libuna_codepage_iso_8859_13.h \
-	libuna_codepage_iso_8859_14.c libuna_codepage_iso_8859_14.h \
-	libuna_codepage_iso_8859_15.c libuna_codepage_iso_8859_15.h \
-	libuna_codepage_iso_8859_16.c libuna_codepage_iso_8859_16.h \
-	libuna_codepage_koi8_r.c libuna_codepage_koi8_r.h \
-	libuna_codepage_koi8_u.c libuna_codepage_koi8_u.h \
-	libuna_codepage_windows_874.c libuna_codepage_windows_874.h \
-	libuna_codepage_windows_1250.c libuna_codepage_windows_1250.h \
-	libuna_codepage_windows_1251.c libuna_codepage_windows_1251.h \
-	libuna_codepage_windows_1252.c libuna_codepage_windows_1252.h \
-	libuna_codepage_windows_1253.c libuna_codepage_windows_1253.h \
-	libuna_codepage_windows_1254.c libuna_codepage_windows_1254.h \
-	libuna_codepage_windows_1255.c libuna_codepage_windows_1255.h \
-	libuna_codepage_windows_1256.c libuna_codepage_windows_1256.h \
-	libuna_codepage_windows_1257.c libuna_codepage_windows_1257.h \
-	libuna_codepage_windows_1258.c libuna_codepage_windows_1258.h \
-	libuna_definitions.h libuna_error.h libuna_extern.h \
-	libuna_inline.h libuna_support.c libuna_support.h \
-	libuna_types.h libuna_unicode_character.c \
-	libuna_unicode_character.h libuna_utf8_stream.c \
-	libuna_utf8_stream.h libuna_utf8_string.c libuna_utf8_string.h \
-	libuna_utf16_stream.c libuna_utf16_stream.h \
-	libuna_utf16_string.c libuna_utf16_string.h \
-	libuna_utf32_stream.c libuna_utf32_stream.h \
-	libuna_utf32_string.c libuna_utf32_string.h
- at HAVE_LOCAL_LIBUNA_TRUE@am_libuna_la_OBJECTS = libuna_byte_stream.lo \
+am__libuna_la_SOURCES_DIST = libuna_base64_stream.c \
+	libuna_base64_stream.h libuna_base64url_stream.c \
+	libuna_base64url_stream.h libuna_byte_stream.c \
+	libuna_byte_stream.h libuna_compare.c libuna_compare.h \
+	libuna_codepage_ascii.h libuna_codepage_iso_8859_1.h \
+	libuna_codepage_iso_8859_2.c libuna_codepage_iso_8859_2.h \
+	libuna_codepage_iso_8859_3.c libuna_codepage_iso_8859_3.h \
+	libuna_codepage_iso_8859_4.c libuna_codepage_iso_8859_4.h \
+	libuna_codepage_iso_8859_5.c libuna_codepage_iso_8859_5.h \
+	libuna_codepage_iso_8859_6.c libuna_codepage_iso_8859_6.h \
+	libuna_codepage_iso_8859_7.c libuna_codepage_iso_8859_7.h \
+	libuna_codepage_iso_8859_8.c libuna_codepage_iso_8859_8.h \
+	libuna_codepage_iso_8859_9.c libuna_codepage_iso_8859_9.h \
+	libuna_codepage_iso_8859_10.c libuna_codepage_iso_8859_10.h \
+	libuna_codepage_iso_8859_11.h libuna_codepage_iso_8859_13.c \
+	libuna_codepage_iso_8859_13.h libuna_codepage_iso_8859_14.c \
+	libuna_codepage_iso_8859_14.h libuna_codepage_iso_8859_15.c \
+	libuna_codepage_iso_8859_15.h libuna_codepage_iso_8859_16.c \
+	libuna_codepage_iso_8859_16.h libuna_codepage_koi8_r.c \
+	libuna_codepage_koi8_r.h libuna_codepage_koi8_u.c \
+	libuna_codepage_koi8_u.h libuna_codepage_windows_874.c \
+	libuna_codepage_windows_874.h libuna_codepage_windows_1250.c \
+	libuna_codepage_windows_1250.h libuna_codepage_windows_1251.c \
+	libuna_codepage_windows_1251.h libuna_codepage_windows_1252.c \
+	libuna_codepage_windows_1252.h libuna_codepage_windows_1253.c \
+	libuna_codepage_windows_1253.h libuna_codepage_windows_1254.c \
+	libuna_codepage_windows_1254.h libuna_codepage_windows_1255.c \
+	libuna_codepage_windows_1255.h libuna_codepage_windows_1256.c \
+	libuna_codepage_windows_1256.h libuna_codepage_windows_1257.c \
+	libuna_codepage_windows_1257.h libuna_codepage_windows_1258.c \
+	libuna_codepage_windows_1258.h libuna_definitions.h \
+	libuna_error.h libuna_extern.h libuna_inline.h \
+	libuna_support.c libuna_support.h libuna_types.h \
+	libuna_unicode_character.c libuna_unicode_character.h \
+	libuna_utf8_stream.c libuna_utf8_stream.h libuna_utf8_string.c \
+	libuna_utf8_string.h libuna_utf16_stream.c \
+	libuna_utf16_stream.h libuna_utf16_string.c \
+	libuna_utf16_string.h libuna_utf32_stream.c \
+	libuna_utf32_stream.h libuna_utf32_string.c \
+	libuna_utf32_string.h
+ at HAVE_LOCAL_LIBUNA_TRUE@am_libuna_la_OBJECTS =  \
+ at HAVE_LOCAL_LIBUNA_TRUE@	libuna_base64_stream.lo \
+ at HAVE_LOCAL_LIBUNA_TRUE@	libuna_base64url_stream.lo \
+ at HAVE_LOCAL_LIBUNA_TRUE@	libuna_byte_stream.lo \
 @HAVE_LOCAL_LIBUNA_TRUE@	libuna_compare.lo \
 @HAVE_LOCAL_LIBUNA_TRUE@	libuna_codepage_iso_8859_2.lo \
 @HAVE_LOCAL_LIBUNA_TRUE@	libuna_codepage_iso_8859_3.lo \
@@ -309,6 +315,8 @@ top_srcdir = @top_srcdir@
 
 @HAVE_LOCAL_LIBUNA_TRUE at noinst_LTLIBRARIES = libuna.la
 @HAVE_LOCAL_LIBUNA_TRUE at libuna_la_SOURCES = \
+ at HAVE_LOCAL_LIBUNA_TRUE@	libuna_base64_stream.c libuna_base64_stream.h \
+ at HAVE_LOCAL_LIBUNA_TRUE@	libuna_base64url_stream.c libuna_base64url_stream.h \
 @HAVE_LOCAL_LIBUNA_TRUE@	libuna_byte_stream.c libuna_byte_stream.h \
 @HAVE_LOCAL_LIBUNA_TRUE@	libuna_compare.c libuna_compare.h \
 @HAVE_LOCAL_LIBUNA_TRUE@	libuna_codepage_ascii.h \
@@ -405,6 +413,8 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libuna_base64_stream.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libuna_base64url_stream.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libuna_byte_stream.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libuna_codepage_iso_8859_10.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libuna_codepage_iso_8859_13.Plo at am__quote@
diff --git a/libuna/libuna_base64_stream.c b/libuna/libuna_base64_stream.c
new file mode 100644
index 0000000..c050350
--- /dev/null
+++ b/libuna/libuna_base64_stream.c
@@ -0,0 +1,1165 @@
+/*
+ * Base64 stream functions
+ *
+ * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
+ * Hoffmann Investigations.
+ *
+ * Refer to AUTHORS for acknowledgements.
+ *
+ * This software is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <common.h>
+#include <types.h>
+
+#include <liberror.h>
+
+#include "libuna_base64_stream.h"
+#include "libuna_definitions.h"
+#include "libuna_inline.h"
+#include "libuna_types.h"
+
+static uint8_t libuna_base64_sixtet_to_character_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+#define libuna_base64_character_from_sixtet( sixtet ) \
+	libuna_base64_sixtet_to_character_table[ sixtet ]
+
+/* Copies a base64 character to a base64 sixtet
+ * Returns 1 if successful or -1 on error
+ */
+LIBUNA_INLINE int libuna_base64_character_copy_to_sixtet(
+                   uint8_t base64_character,
+                   uint8_t *base64_sixtet,
+                   liberror_error_t **error )
+{
+	static char *function = "libuna_base64_character_copy_to_sixtet";
+
+	if( base64_sixtet == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid base64 sixtet.",
+		 function );
+
+		return( -1 );
+	}
+	/* A-Z is not a continous range on a EBCDIC based system
+	 * it consists of the ranges: A-I, J-R, S-Z
+	 */
+	if( ( base64_character >= (uint8_t) 'A' )
+	 && ( base64_character <= (uint8_t) 'I' ) )
+	{
+		*base64_sixtet = base64_character - (uint8_t) 'A';
+	}
+	else if( ( base64_character >= (uint8_t) 'J' )
+	      && ( base64_character <= (uint8_t) 'R' ) )
+	{
+		*base64_sixtet = base64_character - (uint8_t) 'J' + 9;
+	}
+	else if( ( base64_character >= (uint8_t) 'S' )
+	      && ( base64_character <= (uint8_t) 'Z' ) )
+	{
+		*base64_sixtet = base64_character - (uint8_t) 'S' + 18;
+	}
+	/* a-z is not a continous range on a EBCDIC based system
+	 * it consists of the ranges: a-i, j-r, s-z
+	 */
+	else if( ( base64_character >= (uint8_t) 'a' )
+	      && ( base64_character <= (uint8_t) 'i' ) )
+	{
+		*base64_sixtet = base64_character - (uint8_t) 'a' + 26;
+	}
+	else if( ( base64_character >= (uint8_t) 'j' )
+	      && ( base64_character <= (uint8_t) 'r' ) )
+	{
+		*base64_sixtet = base64_character - (uint8_t) 'j' + 35;
+	}
+	else if( ( base64_character >= (uint8_t) 's' )
+	      && ( base64_character <= (uint8_t) 'z' ) )
+	{
+		*base64_sixtet = base64_character - (uint8_t) 's' + 44;
+	}
+	else if( ( base64_character >= (uint8_t) '0' )
+	      && ( base64_character <= (uint8_t) '9' ) )
+	{
+		*base64_sixtet = base64_character - (uint8_t) '0' + 52;
+	}
+	else if( base64_character == (uint8_t) '+' )
+	{
+		*base64_sixtet = 62;
+	}
+	else if( base64_character == (uint8_t) '/' )
+	{
+		*base64_sixtet = 63;
+	}
+	else
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
+		 "%s: invalid base64 character.",
+		 function );
+
+		return( -1 );
+	}
+	return( 1 );
+}
+
+/* Copies a base64 triplet from a base64 stream
+ * A padding character value of 0 indicates the lack of padding characters
+ * Note that the padding size will still be set to indicate the amount of
+ * sixtets in the triplet
+ * Returns 1 if successful or -1 on error
+ */
+LIBUNA_INLINE int libuna_base64_triplet_copy_from_base64_stream(
+                   uint32_t *base64_triplet,
+                   const uint8_t *base64_stream,
+                   size_t base64_stream_size,
+                   size_t *base64_stream_index,
+                   uint8_t padding_character,
+                   uint8_t *padding_size,
+                   liberror_error_t **error )
+{
+	static char *function               = "libuna_base64_triplet_copy_from_base64_stream";
+	uint8_t amount_of_base64_characters = 0;
+	uint8_t sixtet1                     = 0;
+	uint8_t sixtet2                     = 0;
+	uint8_t sixtet3                     = 0;
+	uint8_t sixtet4                     = 0;
+
+	if( base64_triplet == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid base64 triplet.",
+		 function );
+
+		return( -1 );
+	}
+	if( base64_stream == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid base64 stream.",
+		 function );
+
+		return( -1 );
+	}
+	if( base64_stream_size > (size_t) SSIZE_MAX )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
+		 "%s: invalid base64 stream size value exceeds maximum.",
+		 function );
+
+		return( -1 );
+	}
+	if( base64_stream_index == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid base64 stream index.",
+		 function );
+
+		return( -1 );
+	}
+	if( *base64_stream_index >= base64_stream_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: base64 stream string too small.",
+		 function );
+
+		return( -1 );
+	}
+	if( padding_size == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid padding size.",
+		 function );
+
+		return( -1 );
+	}
+	*padding_size = 0;
+
+	if( libuna_base64_character_copy_to_sixtet(
+	     base64_stream[ *base64_stream_index ],
+	     &sixtet1,
+	     error ) != 1 )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_CONVERSION,
+		 LIBERROR_CONVERSION_ERROR_INPUT_FAILED,
+		 "%s: unable to copy base64 character to 1st sixtet.",
+		 function );
+
+		return( -1 );
+	}
+	if( ( *base64_stream_index + 1 ) < base64_stream_size )
+	{
+		if( libuna_base64_character_copy_to_sixtet(
+		     base64_stream[ *base64_stream_index + 1 ],
+		     &sixtet2,
+		     error ) != 1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_CONVERSION,
+			 LIBERROR_CONVERSION_ERROR_INPUT_FAILED,
+			 "%s: unable to copy base64 character to 2nd sixtet.",
+			 function );
+
+			return( -1 );
+		}
+	}
+	else
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: missing 2nd base64 character.",
+		 function );
+
+		return( -1 );
+	}
+	amount_of_base64_characters = 2;
+
+	if( ( *base64_stream_index + 2 ) < base64_stream_size )
+	{
+		if( ( padding_character != 0 )
+		 && ( base64_stream[ *base64_stream_index + 2 ] == padding_character ) )
+		{
+			sixtet3                      = 0;
+			*padding_size               += 1;
+			amount_of_base64_characters += 1;
+		}
+		else
+		{
+			if( libuna_base64_character_copy_to_sixtet(
+			     base64_stream[ *base64_stream_index + 2 ],
+			     &sixtet3,
+			     error ) != 1 )
+			{
+				if( padding_character != 0 )
+				{
+					liberror_error_set(
+					 error,
+					 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+					 LIBERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
+					 "%s: invalid 3rd base64 sixtet.",
+					 function );
+
+					return( -1 );
+				}
+				liberror_error_free(
+				 error );
+
+				*padding_size += 1;
+			}
+			else
+			{
+				amount_of_base64_characters += 1;
+			}
+		}
+	}
+	else
+	{
+		if( padding_character != 0 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+			 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+			 "%s: missing 3rd base64 character.",
+			 function );
+
+			return( -1 );
+		}
+		*padding_size += 1;
+	}
+	if( ( *base64_stream_index + 3 ) < base64_stream_size )
+	{
+		if( ( padding_character != 0 )
+		 && ( base64_stream[ *base64_stream_index + 3 ] == padding_character ) )
+		{
+			sixtet4                      = 0;
+			*padding_size               += 1;
+			amount_of_base64_characters += 1;
+		}
+		else
+		{
+			if( ( padding_character != 0 )
+			 && ( *padding_size > 0 ) )
+			{
+				liberror_error_set(
+				 error,
+				 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+				 LIBERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
+				 "%s: invalid 4th base64 sixtet.",
+				 function );
+
+				return( -1 );
+			}
+			if( libuna_base64_character_copy_to_sixtet(
+			     base64_stream[ *base64_stream_index + 3 ],
+			     &sixtet4,
+			     error ) != 1 )
+			{
+				if( padding_character != 0 )
+				{
+					liberror_error_set(
+					 error,
+					 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+					 LIBERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
+					 "%s: invalid 4rd base64 sixtet.",
+					 function );
+
+					return( -1 );
+				}
+				liberror_error_free(
+				 error );
+
+				*padding_size += 1;
+			}
+			else
+			{
+				amount_of_base64_characters += 1;
+			}
+		}
+	}
+	else
+	{
+		if( padding_character != 0 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+			 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+			 "%s: missing 4th base64 character.",
+			 function );
+
+			return( -1 );
+		}
+		*padding_size += 1;
+	}
+	*base64_triplet   = sixtet1;
+	*base64_triplet <<= 6;
+	*base64_triplet  += sixtet2;
+	*base64_triplet <<= 6;
+	*base64_triplet  += sixtet3;
+	*base64_triplet <<= 6;
+	*base64_triplet  += sixtet4;
+
+	*base64_stream_index += amount_of_base64_characters;
+
+	return( 1 );
+}
+
+/* Copies a base64 triplet to a base64 stream
+ * A padding character value of 0 indicates the lack of padding characters
+ * Returns 1 if successful or -1 on error
+ */
+LIBUNA_INLINE int libuna_base64_triplet_copy_to_base64_stream(
+                   uint32_t base64_triplet,
+                   uint8_t *base64_stream,
+                   size_t base64_stream_size,
+                   size_t *base64_stream_index,
+                   uint8_t padding_character,
+                   uint8_t padding_size,
+                   liberror_error_t **error )
+{
+	static char *function = "libuna_base64_triplet_copy_to_byte_stream";
+	uint8_t sixtet1       = 0;
+	uint8_t sixtet2       = 0;
+	uint8_t sixtet3       = 0;
+	uint8_t sixtet4       = 0;
+
+	if( base64_stream == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid base64 stream.",
+		 function );
+
+		return( -1 );
+	}
+	if( base64_stream_size > (size_t) SSIZE_MAX )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
+		 "%s: invalid base64 stream size value exceeds maximum.",
+		 function );
+
+		return( -1 );
+	}
+	if( base64_stream_index == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid base64 stream index.",
+		 function );
+
+		return( -1 );
+	}
+	if( *base64_stream_index >= base64_stream_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: base64 stream string too small.",
+		 function );
+
+		return( -1 );
+	}
+	/* Separate the 3 bytes value into 4 x 6 bit values
+	 */
+	sixtet4          = (uint8_t) ( base64_triplet & 0x3f );
+	base64_triplet >>= 6;
+	sixtet3          = (uint8_t) ( base64_triplet & 0x3f );
+	base64_triplet >>= 6;
+	sixtet2          = (uint8_t) ( base64_triplet & 0x3f );
+	base64_triplet >>= 6;
+	sixtet1          = (uint8_t) ( base64_triplet & 0x3f );
+
+	/* Spread the encoding over 2 characters if 1 byte is available
+	 */
+	if( *base64_stream_index >= base64_stream_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: base64 stream is too small.",
+		 function );
+
+		return( -1 );
+	}
+	base64_stream[ *base64_stream_index ] = libuna_base64_character_from_sixtet(
+	                                         sixtet1 );
+
+	*base64_stream_index += 1;
+
+	if( *base64_stream_index >= base64_stream_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: base64 stream is too small.",
+		 function );
+
+		return( -1 );
+	}
+	base64_stream[ *base64_stream_index ] = libuna_base64_character_from_sixtet(
+	                                         sixtet2 );
+
+	*base64_stream_index += 1;
+
+	if( *base64_stream_index >= base64_stream_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: base64 stream is too small.",
+		 function );
+
+		return( -1 );
+	}
+	/* Spread the encoding over 3 characters if 2 bytes are available
+	 * Otherwise pad the remaining bytes if required
+	 */
+	if( padding_size < 2 )
+	{
+		base64_stream[ *base64_stream_index ] = libuna_base64_character_from_sixtet(
+		                                         sixtet3 );
+
+		*base64_stream_index += 1;
+	}
+	else if( padding_character != 0 )
+	{
+		base64_stream[ *base64_stream_index ] = padding_character;
+
+		*base64_stream_index += 1;
+	}
+	if( *base64_stream_index >= base64_stream_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: base64 stream is too small.",
+		 function );
+
+		return( -1 );
+	}
+	/* Spread the encoding over 4 characters if 3 bytes are available
+	 * Otherwise pad the remaining bytes if required
+	 */
+	if( padding_size >= 1 )
+	{
+		base64_stream[ *base64_stream_index ] = libuna_base64_character_from_sixtet(
+		                                         sixtet4 );
+
+		*base64_stream_index += 1;
+	}
+	else if( padding_character != 0 )
+	{
+		base64_stream[ *base64_stream_index ] = padding_character;
+
+		*base64_stream_index += 1;
+	}
+	return( 1 );
+}
+
+/* Copies a base64 triplet from a byte stream
+ * Returns 1 if successful or -1 on error
+ */
+LIBUNA_INLINE int libuna_base64_triplet_copy_from_byte_stream(
+                   uint32_t *base64_triplet,
+                   const uint8_t *byte_stream,
+                   size_t byte_stream_size,
+                   size_t *byte_stream_index,
+                   uint8_t *padding_size,
+                   liberror_error_t **error )
+{
+	static char *function = "libuna_base64_triplet_copy_to_byte_stream";
+
+	if( base64_triplet == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid base64 triplet.",
+		 function );
+
+		return( -1 );
+	}
+
+	if( byte_stream == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid byte stream.",
+		 function );
+
+		return( -1 );
+	}
+	if( byte_stream_size > (size_t) SSIZE_MAX )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
+		 "%s: invalid byte stream size value exceeds maximum.",
+		 function );
+
+		return( -1 );
+	}
+	if( byte_stream_index == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid byte stream index.",
+		 function );
+
+		return( -1 );
+	}
+	if( *byte_stream_index >= byte_stream_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: byte stream string too small.",
+		 function );
+
+		return( -1 );
+	}
+	/* Determine the value of 3 bytes (24 bits)
+	 */
+	*base64_triplet      = byte_stream[ *byte_stream_index ] << 16;
+	*byte_stream_index += 1;
+	*padding_size       = 0;
+
+	if( *byte_stream_index <= byte_stream_size )
+	{
+		*base64_triplet    += byte_stream[ *byte_stream_index ] << 8;
+		*byte_stream_index += 1;
+	}
+	else
+	{
+		*padding_size += 1;
+	}
+	if( *byte_stream_index <= byte_stream_size )
+	{
+		*base64_triplet    += byte_stream[ *byte_stream_index ];
+		*byte_stream_index += 1;
+	}
+	else
+	{
+		*padding_size += 1;
+	}
+	return( 1 );
+}
+
+/* Copies a base64 triplet to a byte stream
+ * Returns 1 if successful or -1 on error
+ */
+LIBUNA_INLINE int libuna_base64_triplet_copy_to_byte_stream(
+                   uint32_t base64_triplet,
+                   uint8_t *byte_stream,
+                   size_t byte_stream_size,
+                   size_t *byte_stream_index,
+                   uint8_t padding_size,
+                   liberror_error_t **error )
+{
+	static char *function = "libuna_base64_triplet_copy_to_byte_stream";
+
+	if( byte_stream == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid byte stream.",
+		 function );
+
+		return( -1 );
+	}
+	if( byte_stream_size > (size_t) SSIZE_MAX )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
+		 "%s: invalid byte stream size value exceeds maximum.",
+		 function );
+
+		return( -1 );
+	}
+	if( byte_stream_index == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid byte stream index.",
+		 function );
+
+		return( -1 );
+	}
+	if( *byte_stream_index >= byte_stream_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: byte stream string too small.",
+		 function );
+
+		return( -1 );
+	}
+	byte_stream[ *byte_stream_index ] = (uint8_t) ( ( base64_triplet >> 16 ) & 0xff );
+
+	*byte_stream_index += 1;
+
+	if( padding_size <= 1 )
+	{
+		if( *byte_stream_index >= byte_stream_size )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+			 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+			 "%s: byte stream string too small.",
+			 function );
+
+			return( -1 );
+		}
+		byte_stream[ *byte_stream_index ] = (uint8_t) ( ( base64_triplet >> 8 ) & 0xff );
+
+		*byte_stream_index += 1;
+	}
+	if( padding_size == 0 )
+	{
+		if( *byte_stream_index >= byte_stream_size )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+			 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+			 "%s: byte stream is too small.",
+			 function );
+
+			return( -1 );
+		}
+		byte_stream[ *byte_stream_index ] = (uint8_t) ( base64_triplet & 0xff );
+
+		*byte_stream_index += 1;
+	}
+	return( 1 );
+}
+
+/* Determines the size of a byte stream from a base64 stream
+ * Returns 1 if successful or -1 on error
+ */
+int libuna_base64_stream_decode_size(
+     uint8_t *base64_stream,
+     size_t base64_stream_size,
+     size_t *byte_stream_size,
+     liberror_error_t **error )
+{
+	static char *function = "libuna_base64_stream_decode_size";
+
+	if( base64_stream == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid base64 stream.",
+		 function );
+
+		return( -1 );
+	}
+	if( base64_stream_size > (size_t) SSIZE_MAX )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
+		 "%s: invalid base64 stream size value exceeds maximum.",
+		 function );
+
+		return( -1 );
+	}
+	if( byte_stream_size == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid byte stream size.",
+		 function );
+
+		return( -1 );
+	}
+	/* Make sure the base64 stream is able to hold
+	 * at least 3 bytes for each 4 bytes
+	 */
+	*byte_stream_size = base64_stream_size / 4;
+
+	if( ( base64_stream_size % 4 ) != 0 )
+	{
+		*byte_stream_size += 1;
+	}
+	*byte_stream_size *= 3;
+
+	if( base64_stream[ base64_stream_size - 1 ] == (uint8_t) '=' )
+	{
+		*byte_stream_size -= 1;
+	}
+	if( base64_stream[ base64_stream_size - 2 ] == (uint8_t) '=' )
+	{
+		*byte_stream_size -= 1;
+	}
+	if( base64_stream[ base64_stream_size - 3 ] == (uint8_t) '=' )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_CONVERSION,
+		 LIBERROR_CONVERSION_ERROR_INPUT_FAILED,
+		 "%s: invalid amount of padding.",
+		 function );
+
+		return( -1 );
+	}
+	return( 1 );
+}
+
+/* Copies a byte stream from a base64 stream
+ * Returns 1 if successful or -1 on error
+ */
+int libuna_base64_stream_decode(
+     uint8_t *base64_stream,
+     size_t base64_stream_size,
+     uint8_t *byte_stream,
+     size_t byte_stream_size,
+     liberror_error_t **error )
+{
+	static char *function              = "libuna_base64_stream_decode";
+	size_t base64_stream_index         = 0;
+	size_t byte_stream_index           = 0;
+	size_t calculated_byte_stream_size = 0;
+	uint32_t base64_triplet            = 0;
+	uint8_t padding_size               = 0;
+
+	if( base64_stream == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid base64 stream.",
+		 function );
+
+		return( -1 );
+	}
+	if( base64_stream_size > (size_t) SSIZE_MAX )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
+		 "%s: invalid base64 stream size value exceeds maximum.",
+		 function );
+
+		return( -1 );
+	}
+	if( byte_stream == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid byte stream.",
+		 function );
+
+		return( -1 );
+	}
+	if( byte_stream_size > (size_t) SSIZE_MAX )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
+		 "%s: invalid byte stream size value exceeds maximum.",
+		 function );
+
+		return( -1 );
+	}
+	/* Make sure the byte stream is able to hold
+	 * at least 3 bytes for each 4 bytes
+	 */
+	calculated_byte_stream_size = ( base64_stream_size / 4 ) * 3;
+
+	if( ( base64_stream_size % 4 ) != 0 )
+	{
+		calculated_byte_stream_size += 1;
+	}
+	calculated_byte_stream_size *= 3;
+
+	if( base64_stream[ base64_stream_size - 1 ] == (uint8_t) '=' )
+	{
+		calculated_byte_stream_size -= 1;
+	}
+	if( base64_stream[ base64_stream_size - 2 ] == (uint8_t) '=' )
+	{
+		calculated_byte_stream_size -= 1;
+	}
+	if( base64_stream[ base64_stream_size - 3 ] == (uint8_t) '=' )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_CONVERSION,
+		 LIBERROR_CONVERSION_ERROR_INPUT_FAILED,
+		 "%s: invalid amount of padding.",
+		 function );
+
+		return( -1 );
+	}
+	if( byte_stream_size < calculated_byte_stream_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: byte stream is too small.",
+		 function );
+
+		return( -1 );
+	}
+	while( base64_stream_index < base64_stream_size )
+	{
+		if( padding_size > 0 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+			 LIBERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
+			 "%s: invalid 1st base64 sixtet.",
+			 function );
+
+			return( -1 );
+		}
+		/* Convert the base64 stream into a base64 triplet
+		 */
+		if( libuna_base64_triplet_copy_from_base64_stream(
+		     &base64_triplet,
+		     base64_stream,
+		     base64_stream_size,
+		     &base64_stream_index,
+		     (uint8_t ) '=',
+		     &padding_size,
+		     error ) != 1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_CONVERSION,
+			 LIBERROR_CONVERSION_ERROR_INPUT_FAILED,
+			 "%s: unable to copy base64 triplet from base64 stream.",
+			 function );
+
+			return( -1 );
+		}
+		/* Convert the base64 triplet into a byte stream
+		 */
+		if( libuna_base64_triplet_copy_to_byte_stream(
+		     base64_triplet,
+		     byte_stream,
+		     byte_stream_size,
+		     &byte_stream_index,
+		     padding_size,
+		     error ) != 1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_CONVERSION,
+			 LIBERROR_CONVERSION_ERROR_INPUT_FAILED,
+			 "%s: unable to copy base64 triplet to byte stream.",
+			 function );
+
+			return( -1 );
+		}
+	}
+	return( 1 );
+}
+
+/* Determines the size of a base64 stream from a byte stream
+ * Returns 1 if successful or -1 on error
+ */
+int libuna_base64_stream_encode_size(
+     uint8_t *byte_stream,
+     size_t byte_stream_size,
+     size_t *base64_stream_size,
+     liberror_error_t **error )
+{
+	static char *function = "libuna_base64_stream_encode_size";
+
+	if( byte_stream == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid byte stream.",
+		 function );
+
+		return( -1 );
+	}
+	if( byte_stream_size > (size_t) SSIZE_MAX )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
+		 "%s: invalid byte stream size value exceeds maximum.",
+		 function );
+
+		return( -1 );
+	}
+	if( base64_stream_size == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid base64 stream size.",
+		 function );
+
+		return( -1 );
+	}
+	/* Make sure the base64 stream is able to hold
+	 * at least 4 bytes for each 3 bytes
+	 */
+	*base64_stream_size = byte_stream_size / 3;
+
+	if( ( byte_stream_size % 3 ) != 0 )
+	{
+		*base64_stream_size += 1;
+	}
+	*base64_stream_size *= 4;
+
+	return( 1 );
+}
+
+/* Copies a base64 stream from a byte stream
+ * Returns 1 if successful or -1 on error
+ */
+int libuna_base64_stream_encode(
+     uint8_t *base64_stream,
+     size_t base64_stream_size,
+     uint8_t *byte_stream,
+     size_t byte_stream_size,
+     liberror_error_t **error )
+{
+	static char *function                = "libuna_base64_stream_encode";
+	size_t calculated_base64_stream_size = 0;
+	size_t base64_stream_index           = 0;
+	size_t byte_stream_index             = 0;
+	uint32_t base64_triplet              = 0;
+	uint8_t padding_size                 = 0;
+
+	if( base64_stream == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid base64 stream.",
+		 function );
+
+		return( -1 );
+	}
+	if( base64_stream_size > (size_t) SSIZE_MAX )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
+		 "%s: invalid base64 stream size value exceeds maximum.",
+		 function );
+
+		return( -1 );
+	}
+	if( byte_stream == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid byte stream.",
+		 function );
+
+		return( -1 );
+	}
+	if( byte_stream_size > (size_t) SSIZE_MAX )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
+		 "%s: invalid byte stream size value exceeds maximum.",
+		 function );
+
+		return( -1 );
+	}
+	/* Make sure the base64 stream is able to hold
+	 * at least 4 bytes for each 3 bytes
+	 */
+	calculated_base64_stream_size = byte_stream_size / 3;
+
+	if( ( byte_stream_size % 3 ) != 0 )
+	{
+		calculated_base64_stream_size += 1;
+	}
+	calculated_base64_stream_size *= 4;
+
+	if( base64_stream_size < calculated_base64_stream_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: base64 stream is too small.",
+		 function );
+
+		return( -1 );
+	}
+	while( byte_stream_index < byte_stream_size )
+	{
+		/* Convert the byte stream into a base64 triplet
+		 */
+		if( libuna_base64_triplet_copy_from_byte_stream(
+		     &base64_triplet,
+		     byte_stream,
+		     byte_stream_size,
+		     &byte_stream_index,
+		     &padding_size,
+		     error ) != 1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_CONVERSION,
+			 LIBERROR_CONVERSION_ERROR_INPUT_FAILED,
+			 "%s: unable to copy base64 triplet from byte stream.",
+			 function );
+
+			return( -1 );
+		}
+		/* Convert the base64 triplet into a base64 stream
+		 */
+		if( libuna_base64_triplet_copy_to_base64_stream(
+		     base64_triplet,
+		     base64_stream,
+		     base64_stream_size,
+		     &base64_stream_index,
+		     (uint8_t) '=',
+		     padding_size,
+		     error ) != 1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_CONVERSION,
+			 LIBERROR_CONVERSION_ERROR_INPUT_FAILED,
+			 "%s: unable to copy base64 triplet to base64 stream.",
+			 function );
+
+			return( -1 );
+		}
+	}
+	return( 1 );
+}
+
diff --git a/libuna/libuna_base64_stream.h b/libuna/libuna_base64_stream.h
new file mode 100644
index 0000000..f165d22
--- /dev/null
+++ b/libuna/libuna_base64_stream.h
@@ -0,0 +1,109 @@
+/*
+ * Base64 stream functions
+ *
+ * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
+ * Hoffmann Investigations.
+ *
+ * Refer to AUTHORS for acknowledgements.
+ *
+ * This software is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#if !defined( _LIBUNA_BASE64_STREAM_H )
+#define _LIBUNA_BASE64_STREAM_H
+
+#include <common.h>
+#include <types.h>
+
+#include <liberror.h>
+
+#include "libuna_extern.h"
+#include "libuna_inline.h"
+#include "libuna_types.h"
+
+#if defined( __cplusplus )
+extern "C" {
+#endif
+
+LIBUNA_INLINE int libuna_base64_character_copy_to_sixtet(
+                   uint8_t base64_character,
+                   uint8_t *base64_sixtet,
+                   liberror_error_t **error );
+
+LIBUNA_EXTERN LIBUNA_INLINE int libuna_base64_triplet_copy_from_base64_stream(
+                                 uint32_t *base64_triplet,
+                                 const uint8_t *base64_stream,
+                                 size_t base64_stream_size,
+                                 size_t *base64_stream_index,
+                                 uint8_t padding_character,
+                                 uint8_t *padding_size,
+                                 liberror_error_t **error );
+
+LIBUNA_EXTERN LIBUNA_INLINE int libuna_base64_triplet_copy_to_base64_stream(
+                                 uint32_t base64_triplet,
+                                 uint8_t *base64_stream,
+                                 size_t base64_stream_size,
+                                 size_t *base64_stream_index,
+                                 uint8_t padding_character,
+                                 uint8_t padding_size,
+                                 liberror_error_t **error );
+
+LIBUNA_EXTERN LIBUNA_INLINE int libuna_base64_triplet_copy_from_byte_stream(
+                                 uint32_t *base64_triplet,
+                                 const uint8_t *byte_stream,
+                                 size_t byte_stream_size,
+                                 size_t *byte_stream_index,
+                                 uint8_t *padding_size,
+                                 liberror_error_t **error );
+
+LIBUNA_EXTERN LIBUNA_INLINE int libuna_base64_triplet_copy_to_byte_stream(
+                                 uint32_t base64_triplet,
+                                 uint8_t *byte_stream,
+                                 size_t byte_stream_size,
+                                 size_t *byte_stream_index,
+                                 uint8_t padding_size,
+                                 liberror_error_t **error );
+
+LIBUNA_EXTERN int libuna_base64_stream_decode_size(
+                   uint8_t *base64_stream,
+                   size_t base64_stream_size,
+                   size_t *byte_stream_size,
+                   liberror_error_t **error );
+
+LIBUNA_EXTERN int libuna_base64_stream_decode(
+                   uint8_t *base64_stream,
+                   size_t base64_stream_size,
+                   uint8_t *byte_stream,
+                   size_t byte_stream_size,
+                   liberror_error_t **error );
+
+LIBUNA_EXTERN int libuna_base64_stream_encode_size(
+                   uint8_t *byte_stream,
+                   size_t byte_stream_size,
+                   size_t *base64_stream_size,
+                   liberror_error_t **error );
+
+LIBUNA_EXTERN int libuna_base64_stream_encode(
+                   uint8_t *base64_stream,
+                   size_t base64_stream_size,
+                   uint8_t *byte_stream,
+                   size_t byte_stream_size,
+                   liberror_error_t **error );
+
+#if defined( __cplusplus )
+}
+#endif
+
+#endif
+
diff --git a/libuna/libuna_base64url_stream.c b/libuna/libuna_base64url_stream.c
new file mode 100644
index 0000000..e9b1964
--- /dev/null
+++ b/libuna/libuna_base64url_stream.c
@@ -0,0 +1,919 @@
+/*
+ * Base64 URL stream functions
+ *
+ * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
+ * Hoffmann Investigations.
+ *
+ * Refer to AUTHORS for acknowledgements.
+ *
+ * This software is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <common.h>
+#include <types.h>
+
+#include <liberror.h>
+
+#include "libuna_base64url_stream.h"
+#include "libuna_definitions.h"
+#include "libuna_inline.h"
+#include "libuna_types.h"
+
+#ifdef TODO
+
+static uint8_t libuna_base64url_sixtet_to_character_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
+
+#define libuna_base64url_character_from_sixtet( sixtet ) \
+	libuna_base64url_sixtet_to_character_table[ sixtet ]
+
+/* Copies a base64 character to a base64 sixtet
+ * Returns 1 if successful or -1 on error
+ */
+LIBUNA_INLINE int libuna_base64url_character_copy_to_sixtet(
+                   uint8_t base64url_character,
+                   uint8_t *base64url_sixtet,
+                   liberror_error_t **error )
+{
+	static char *function = "libuna_base64url_character_copy_to_sixtet";
+
+	if( base64url_sixtet == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid base64 sixtet.",
+		 function );
+
+		return( -1 );
+	}
+	/* A-Z is not a continous range on a EBCDIC based system
+	 * it consists of the ranges: A-I, J-R, S-Z
+	 */
+	if( ( base64url_character >= (uint8_t) 'A' )
+	 && ( base64url_character <= (uint8_t) 'I' ) )
+	{
+		*base64url_sixtet = base64url_character - (uint8_t) 'A';
+	}
+	else if( ( base64url_character >= (uint8_t) 'J' )
+	      && ( base64url_character <= (uint8_t) 'R' ) )
+	{
+		*base64url_sixtet = base64url_character - (uint8_t) 'J' + 9;
+	}
+	else if( ( base64url_character >= (uint8_t) 'S' )
+	      && ( base64url_character <= (uint8_t) 'Z' ) )
+	{
+		*base64url_sixtet = base64url_character - (uint8_t) 'S' + 18;
+	}
+	/* a-z is not a continous range on a EBCDIC based system
+	 * it consists of the ranges: a-i, j-r, s-z
+	 */
+	else if( ( base64url_character >= (uint8_t) 'a' )
+	      && ( base64url_character <= (uint8_t) 'i' ) )
+	{
+		*base64url_sixtet = base64url_character - (uint8_t) 'a' + 26;
+	}
+	else if( ( base64url_character >= (uint8_t) 'j' )
+	      && ( base64url_character <= (uint8_t) 'r' ) )
+	{
+		*base64url_sixtet = base64url_character - (uint8_t) 'j' + 32;
+	}
+	else if( ( base64url_character >= (uint8_t) 's' )
+	      && ( base64url_character <= (uint8_t) 'z' ) )
+	{
+		*base64url_sixtet = base64url_character - (uint8_t) 's' + 44;
+	}
+	else if( ( base64url_character >= (uint8_t) '0' )
+	      && ( base64url_character <= (uint8_t) '9' ) )
+	{
+		*base64url_sixtet = base64url_character - (uint8_t) '0' + 52;
+	}
+	else if( base64url_character == (uint8_t) '-' )
+	{
+		*base64url_sixtet = 62;
+	}
+	else if( base64url_character == (uint8_t) '_' )
+	{
+		*base64url_sixtet = 63;
+	}
+	else
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
+		 "%s: invalid base64 character.",
+		 function );
+
+		return( -1 );
+	}
+	return( 1 );
+}
+
+/* Copies a base64 triplet from a base64 URL stream
+ * Returns 1 if successful or -1 on error
+ */
+LIBUNA_INLINE int libuna_base64url_triplet_copy_from_base64url_stream(
+                   uint32_t *base64url_triplet,
+                   const uint8_t *base64url_stream,
+                   size_t base64url_stream_size,
+                   size_t *base64url_stream_index,
+                   liberror_error_t **error )
+{
+	static char *function = "libuna_base64url_triplet_copy_from_base64url_stream";
+	uint8_t sixtet1       = 0;
+	uint8_t sixtet2       = 0;
+	uint8_t sixtet3       = 0;
+	uint8_t sixtet4       = 0;
+
+	if( base64url_triplet == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid base64 triplet.",
+		 function );
+
+		return( -1 );
+	}
+	if( base64url_stream == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid base64 URL stream.",
+		 function );
+
+		return( -1 );
+	}
+	if( base64url_stream_size > (size_t) SSIZE_MAX )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
+		 "%s: invalid base64 URL stream size value exceeds maximum.",
+		 function );
+
+		return( -1 );
+	}
+	if( base64url_stream_index == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid base64 URL stream index.",
+		 function );
+
+		return( -1 );
+	}
+	if( *base64url_stream_index >= base64url_stream_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: base64 URL stream string too small.",
+		 function );
+
+		return( -1 );
+	}
+	if( libuna_base64url_character_copy_to_sixtet(
+	     base64url_stream[ *base64url_stream_index ],
+	     &sixtet1,
+	     error ) != 1 )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_CONVERSION,
+		 LIBERROR_CONVERSION_ERROR_INPUT_FAILED,
+		 "%s: unable to copy base64 character to 1st sixtet.",
+		 function );
+
+		return( -1 );
+	}
+	if( ( *base64url_stream_index + 1 ) < base64url_stream_size )
+	{
+		if( libuna_base64url_character_copy_to_sixtet(
+		     base64url_stream[ *base64url_stream_index + 1 ],
+		     &sixtet2,
+		     error ) != 1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_CONVERSION,
+			 LIBERROR_CONVERSION_ERROR_INPUT_FAILED,
+			 "%s: unable to copy base64 character to 2nd sixtet.",
+			 function );
+
+			return( -1 );
+		}
+	}
+	else
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: missing 2nd base64 character.",
+		 function );
+
+		return( -1 );
+	}
+	if( ( *base64url_stream_index + 2 ) < base64url_stream_size )
+	{
+		if( libuna_base64url_character_copy_to_sixtet(
+		     base64url_stream[ *base64url_stream_index + 2 ],
+		     &sixtet3,
+		     error ) != 1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+			 LIBERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
+			 "%s: invalid 3rd base64 sixtet.",
+			 function );
+
+			return( -1 );
+		}
+	}
+	else
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: missing 3rd base64 character.",
+		 function );
+
+		return( -1 );
+	}
+	if( ( *base64url_stream_index + 3 ) < base64url_stream_size )
+	{
+		if( libuna_base64url_character_copy_to_sixtet(
+		     base64url_stream[ *base64url_stream_index + 3 ],
+		     &sixtet4,
+		     error ) != 1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+			 LIBERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
+			 "%s: invalid 4th base64 sixtet.",
+			 function );
+
+			return( -1 );
+		}
+	}
+	else
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: missing 4th base64 character.",
+		 function );
+
+		return( -1 );
+	}
+	*base64url_triplet   = sixtet1;
+	*base64url_triplet <<= 6;
+	*base64url_triplet  += sixtet2;
+	*base64url_triplet <<= 6;
+	*base64url_triplet  += sixtet3;
+	*base64url_triplet <<= 6;
+	*base64url_triplet  += sixtet4;
+
+	*base64url_stream_index += 4;
+
+	return( 1 );
+}
+
+/* Copies a base64 triplet to a base64 URL stream
+ * Returns 1 if successful or -1 on error
+ */
+LIBUNA_INLINE int libuna_base64url_triplet_copy_to_base64url_stream(
+                   uint32_t base64url_triplet,
+                   uint8_t *base64url_stream,
+                   size_t base64url_stream_size,
+                   size_t *base64url_stream_index,
+                   liberror_error_t **error )
+{
+	static char *function = "libuna_base64url_triplet_copy_to_byte_stream";
+	uint8_t sixtet1       = 0;
+	uint8_t sixtet2       = 0;
+	uint8_t sixtet3       = 0;
+	uint8_t sixtet4       = 0;
+
+	if( base64url_stream == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid base64 URL stream.",
+		 function );
+
+		return( -1 );
+	}
+	if( base64url_stream_size > (size_t) SSIZE_MAX )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
+		 "%s: invalid base64 URL stream size value exceeds maximum.",
+		 function );
+
+		return( -1 );
+	}
+	if( base64url_stream_index == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid base64 URL stream index.",
+		 function );
+
+		return( -1 );
+	}
+	if( *base64url_stream_index >= base64url_stream_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: base64 URL stream string too small.",
+		 function );
+
+		return( -1 );
+	}
+	/* Separate the 3 bytes value into 4 x 6 bit values
+	 */
+	sixtet4          = (uint8_t) ( base64url_triplet & 0x3f );
+	base64url_triplet >>= 6;
+	sixtet3          = (uint8_t) ( base64url_triplet & 0x3f );
+	base64url_triplet >>= 6;
+	sixtet2          = (uint8_t) ( base64url_triplet & 0x3f );
+	base64url_triplet >>= 6;
+	sixtet1          = (uint8_t) ( base64url_triplet & 0x3f );
+
+	/* Spread the encoding over 2 characters if 1 byte is available
+	 */
+	if( *base64url_stream_index >= base64url_stream_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: base64 URL stream is too small.",
+		 function );
+
+		return( -1 );
+	}
+	base64url_stream[ *base64url_stream_index ] = libuna_base64url_character_from_sixtet(
+	                                               sixtet1 );
+
+	*base64url_stream_index += 1;
+
+	if( *base64url_stream_index >= base64url_stream_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: base64 URL stream is too small.",
+		 function );
+
+		return( -1 );
+	}
+	base64url_stream[ *base64url_stream_index ] = libuna_base64url_character_from_sixtet(
+	                                               sixtet2 );
+
+	*base64url_stream_index += 1;
+
+	if( *base64url_stream_index >= base64url_stream_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: base64 URL stream is too small.",
+		 function );
+
+		return( -1 );
+	}
+	/* Spread the encoding over 3 characters if 2 bytes are available
+	 * Otherwise pad the remaining bytes
+	 */
+
+	/* TODO fix */
+	if( padding_size < 2 )
+	{
+		base64url_stream[ *base64url_stream_index ] = libuna_base64url_character_from_sixtet(
+		                                               sixtet3 );
+	}
+	*base64url_stream_index += 1;
+
+	if( *base64url_stream_index >= base64url_stream_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: base64 URL stream is too small.",
+		 function );
+
+		return( -1 );
+	}
+	/* Spread the encoding over 4 characters if 3 bytes are available
+	 * Otherwise pad the remaining bytes
+	 */
+	if( padding_size >= 1 )
+	{
+		base64url_stream[ *base64url_stream_index ] = libuna_base64url_character_from_sixtet(
+		                                               sixtet4 );
+	}
+	*base64url_stream_index += 1;
+
+	return( 1 );
+}
+
+/* Copies a base64 triplet from a byte stream
+ * Returns 1 if successful or -1 on error
+ */
+LIBUNA_INLINE int libuna_base64url_triplet_copy_from_byte_stream(
+                   uint32_t *base64url_triplet,
+                   const uint8_t *byte_stream,
+                   size_t byte_stream_size,
+                   size_t *byte_stream_index,
+                   uint8_t *padding_size,
+                   liberror_error_t **error )
+{
+	static char *function = "libuna_base64url_triplet_copy_to_byte_stream";
+
+	if( base64url_triplet == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid base64 triplet.",
+		 function );
+
+		return( -1 );
+	}
+
+	if( byte_stream == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid byte stream.",
+		 function );
+
+		return( -1 );
+	}
+	if( byte_stream_size > (size_t) SSIZE_MAX )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
+		 "%s: invalid byte stream size value exceeds maximum.",
+		 function );
+
+		return( -1 );
+	}
+	if( byte_stream_index == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid byte stream index.",
+		 function );
+
+		return( -1 );
+	}
+	if( *byte_stream_index >= byte_stream_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: byte stream string too small.",
+		 function );
+
+		return( -1 );
+	}
+	/* Determine the value of 3 bytes (24 bits)
+	 */
+	*base64url_triplet      = byte_stream[ *byte_stream_index ] << 16;
+	*byte_stream_index += 1;
+	*padding_size       = 0;
+
+	if( *byte_stream_index <= byte_stream_size )
+	{
+		*base64url_triplet    += byte_stream[ *byte_stream_index ] << 8;
+		*byte_stream_index += 1;
+	}
+	else
+	{
+		*padding_size += 1;
+	}
+	if( *byte_stream_index <= byte_stream_size )
+	{
+		*base64url_triplet    += byte_stream[ *byte_stream_index ];
+		*byte_stream_index += 1;
+	}
+	else
+	{
+		*padding_size += 1;
+	}
+	return( 1 );
+}
+
+/* Copies a base64 triplet to a byte stream
+ * Returns 1 if successful or -1 on error
+ */
+LIBUNA_INLINE int libuna_base64url_triplet_copy_to_byte_stream(
+                   uint32_t base64url_triplet,
+                   uint8_t *byte_stream,
+                   size_t byte_stream_size,
+                   size_t *byte_stream_index,
+                   uint8_t padding_size,
+                   liberror_error_t **error )
+{
+	static char *function = "libuna_base64url_triplet_copy_to_byte_stream";
+
+	if( byte_stream == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid byte stream.",
+		 function );
+
+		return( -1 );
+	}
+	if( byte_stream_size > (size_t) SSIZE_MAX )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
+		 "%s: invalid byte stream size value exceeds maximum.",
+		 function );
+
+		return( -1 );
+	}
+	if( byte_stream_index == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid byte stream index.",
+		 function );
+
+		return( -1 );
+	}
+	if( *byte_stream_index >= byte_stream_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: byte stream string too small.",
+		 function );
+
+		return( -1 );
+	}
+	byte_stream[ *byte_stream_index ] = (uint8_t) ( ( base64url_triplet >> 16 ) & 0xff );
+
+	*byte_stream_index += 1;
+
+	if( padding_size <= 1 )
+	{
+		if( *byte_stream_index >= byte_stream_size )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+			 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+			 "%s: byte stream string too small.",
+			 function );
+
+			return( -1 );
+		}
+		byte_stream[ *byte_stream_index ] = (uint8_t) ( ( base64url_triplet >> 8 ) & 0xff );
+
+		*byte_stream_index += 1;
+	}
+	if( padding_size == 0 )
+	{
+		if( *byte_stream_index >= byte_stream_size )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+			 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+			 "%s: byte stream is too small.",
+			 function );
+
+			return( -1 );
+		}
+		byte_stream[ *byte_stream_index ] = (uint8_t) ( base64url_triplet & 0xff );
+
+		*byte_stream_index += 1;
+	}
+	return( 1 );
+}
+
+/* Determines the size of a byte stream from a base64 URL stream
+ * Returns 1 if successful or -1 on error
+ */
+int libuna_base64url_stream_decode_size(
+     uint8_t *base64url_stream,
+     size_t base64url_stream_size,
+     size_t *byte_stream_size,
+     liberror_error_t **error );
+
+/* Copies a byte stream from a base64 URL stream
+ * Returns 1 if successful or -1 on error
+ */
+int libuna_base64url_stream_decode(
+     uint8_t *base64url_stream,
+     size_t base64url_stream_size,
+     uint8_t *byte_stream,
+     size_t byte_stream_size,
+     liberror_error_t **error )
+{
+	static char *function      = "libuna_base64url_stream_decode";
+	size_t base64url_stream_index = 0;
+	size_t byte_stream_index   = 0;
+	uint32_t base64url_triplet    = 0;
+	uint8_t padding_size       = 0;
+
+	if( base64url_stream == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid base64 URL stream.",
+		 function );
+
+		return( -1 );
+	}
+	if( base64url_stream_size > (size_t) SSIZE_MAX )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
+		 "%s: invalid base64 URL stream size value exceeds maximum.",
+		 function );
+
+		return( -1 );
+	}
+	if( byte_stream == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid byte stream.",
+		 function );
+
+		return( -1 );
+	}
+	if( byte_stream_size > (size_t) SSIZE_MAX )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
+		 "%s: invalid byte stream size value exceeds maximum.",
+		 function );
+
+		return( -1 );
+	}
+	/* Make sure the byte stream is able to hold
+	 * at least 3 bytes for each 4 bytes
+	 */
+	if( ( ( base64url_stream_size * 3 ) / 4 ) < byte_stream_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: byte stream is too small.",
+		 function );
+
+		return( -1 );
+	}
+	while( base64url_stream_index < base64url_stream_size )
+	{
+		if( padding_size > 0 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+			 LIBERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
+			 "%s: invalid 1st base64 sixtet.",
+			 function );
+
+			return( -1 );
+		}
+		/* Convert the base64 URL stream into a base64 triplet
+		 */
+		if( libuna_base64url_triplet_copy_from_base64url_stream(
+		     &base64url_triplet,
+		     base64url_stream,
+		     base64url_stream_size,
+		     &base64url_stream_index,
+		     (uint8_t ) '=',
+		     &padding_size,
+		     error ) != 1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_CONVERSION,
+			 LIBERROR_CONVERSION_ERROR_INPUT_FAILED,
+			 "%s: unable to copy base64 triplet from base64 URL stream.",
+			 function );
+
+			return( -1 );
+		}
+		/* Convert the base64 triplet into a byte stream
+		 */
+		if( libuna_base64url_triplet_copy_to_byte_stream(
+		     base64url_triplet,
+		     byte_stream,
+		     byte_stream_size,
+		     &byte_stream_index,
+		     padding_size,
+		     error ) != 1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_CONVERSION,
+			 LIBERROR_CONVERSION_ERROR_INPUT_FAILED,
+			 "%s: unable to copy base64 triplet to byte stream.",
+			 function );
+
+			return( -1 );
+		}
+	}
+	return( 1 );
+}
+
+/* Determines the size of a base64 URL stream from a byte stream
+ * Returns 1 if successful or -1 on error
+ */
+int libuna_base64url_stream_encode_size(
+     uint8_t *byte_stream,
+     size_t byte_stream_size,
+     size_t *base64url_stream_size,
+     liberror_error_t **error );
+
+/* Copies a base64 URL stream from a byte stream
+ * Returns 1 if successful or -1 on error
+ */
+int libuna_base64url_stream_encode(
+     uint8_t *base64url_stream,
+     size_t base64url_stream_size,
+     uint8_t *byte_stream,
+     size_t byte_stream_size,
+     liberror_error_t **error )
+{
+	static char *function      = "libuna_base64url_stream_encode";
+	size_t base64url_stream_index = 0;
+	size_t byte_stream_index   = 0;
+	uint32_t base64url_triplet    = 0;
+	uint8_t padding_size       = 0;
+
+	if( base64url_stream == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid base64 URL stream.",
+		 function );
+
+		return( -1 );
+	}
+	if( base64url_stream_size > (size_t) SSIZE_MAX )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
+		 "%s: invalid base64 URL stream size value exceeds maximum.",
+		 function );
+
+		return( -1 );
+	}
+	if( byte_stream == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid byte stream.",
+		 function );
+
+		return( -1 );
+	}
+	if( byte_stream_size > (size_t) SSIZE_MAX )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
+		 "%s: invalid byte stream size value exceeds maximum.",
+		 function );
+
+		return( -1 );
+	}
+	/* Make sure the base64 URL stream is able to hold
+	 * at least 4 bytes for each 3 bytes
+	 */
+	if( ( ( byte_stream_size * 4 ) / 3 ) < base64url_stream_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: base64 URL stream is too small.",
+		 function );
+
+		return( -1 );
+	}
+	while( byte_stream_index < byte_stream_size )
+	{
+		/* Convert the byte stream into a base64 triplet
+		 */
+		if( libuna_base64url_triplet_copy_from_byte_stream(
+		     &base64url_triplet,
+		     byte_stream,
+		     byte_stream_size,
+		     &byte_stream_index,
+		     &padding_size,
+		     error ) != 1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_CONVERSION,
+			 LIBERROR_CONVERSION_ERROR_INPUT_FAILED,
+			 "%s: unable to copy base64 triplet from byte stream.",
+			 function );
+
+			return( -1 );
+		}
+		/* Convert the base64 triplet into a base64 URL stream
+		 */
+		if( libuna_base64url_triplet_copy_to_base64url_stream(
+		     base64url_triplet,
+		     base64url_stream,
+		     base64url_stream_size,
+		     &base64url_stream_index,
+		     (uint8_t) '=',
+		     padding_size,
+		     error ) != 1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_CONVERSION,
+			 LIBERROR_CONVERSION_ERROR_INPUT_FAILED,
+			 "%s: unable to copy base64 triplet to base64 URL stream.",
+			 function );
+
+			return( -1 );
+		}
+	}
+	return( 1 );
+}
+
+#endif /* TODO */
+
diff --git a/libuna/libuna_base64url_stream.h b/libuna/libuna_base64url_stream.h
new file mode 100644
index 0000000..d7dae53
--- /dev/null
+++ b/libuna/libuna_base64url_stream.h
@@ -0,0 +1,107 @@
+/*
+ * Base64 URL stream functions
+ *
+ * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
+ * Hoffmann Investigations.
+ *
+ * Refer to AUTHORS for acknowledgements.
+ *
+ * This software is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#if !defined( _LIBUNA_BASE64URL_STREAM_H )
+#define _LIBUNA_BASE64URL_STREAM_H
+
+#include <common.h>
+#include <types.h>
+
+#include <liberror.h>
+
+#include "libuna_extern.h"
+#include "libuna_inline.h"
+#include "libuna_types.h"
+
+#if defined( __cplusplus )
+extern "C" {
+#endif
+
+#ifdef TODO
+
+LIBUNA_INLINE int libuna_base64url_character_copy_to_sixtet(
+                   uint8_t base64url_character,
+                   uint8_t *base64url_sixtet,
+                   liberror_error_t **error );
+
+LIBUNA_EXTERN LIBUNA_INLINE int libuna_base64url_triplet_copy_from_base64url_stream(
+                                 uint32_t *base64url_triplet,
+                                 const uint8_t *base64url_stream,
+                                 size_t base64url_stream_size,
+                                 size_t *base64url_stream_index,
+                                 liberror_error_t **error );
+
+LIBUNA_EXTERN LIBUNA_INLINE int libuna_base64url_triplet_copy_to_base64url_stream(
+                                 uint32_t base64url_triplet,
+                                 uint8_t *base64url_stream,
+                                 size_t base64url_stream_size,
+                                 size_t *base64url_stream_index,
+                                 liberror_error_t **error );
+
+LIBUNA_EXTERN LIBUNA_INLINE int libuna_base64url_triplet_copy_from_byte_stream(
+                                 uint32_t *base64url_triplet,
+                                 const uint8_t *byte_stream,
+                                 size_t byte_stream_size,
+                                 size_t *byte_stream_index,
+                                 liberror_error_t **error );
+
+LIBUNA_EXTERN LIBUNA_INLINE int libuna_base64url_triplet_copy_to_byte_stream(
+                                 uint32_t base64url_triplet,
+                                 uint8_t *byte_stream,
+                                 size_t byte_stream_size,
+                                 size_t *byte_stream_index,
+                                 liberror_error_t **error );
+
+LIBUNA_EXTERN int libuna_base64url_stream_decode_size(
+                   uint8_t *base64url_stream,
+                   size_t base64url_stream_size,
+                   size_t *byte_stream_size,
+                   liberror_error_t **error );
+
+LIBUNA_EXTERN int libuna_base64url_stream_decode(
+                   uint8_t *base64url_stream,
+                   size_t base64url_stream_size,
+                   uint8_t *byte_stream,
+                   size_t byte_stream_size,
+                   liberror_error_t **error );
+
+LIBUNA_EXTERN int libuna_base64url_stream_encode_size(
+                   uint8_t *byte_stream,
+                   size_t byte_stream_size,
+                   size_t *base64url_stream_size,
+                   liberror_error_t **error );
+
+LIBUNA_EXTERN int libuna_base64url_stream_encode(
+                   uint8_t *base64url_stream,
+                   size_t base64url_stream_size,
+                   uint8_t *byte_stream,
+                   size_t byte_stream_size,
+                   liberror_error_t **error );
+
+#endif /* TODO */
+
+#if defined( __cplusplus )
+}
+#endif
+
+#endif
+
diff --git a/libuna/libuna_byte_stream.c b/libuna/libuna_byte_stream.c
index 84290f5..8380053 100644
--- a/libuna/libuna_byte_stream.c
+++ b/libuna/libuna_byte_stream.c
@@ -2,7 +2,7 @@
  * Byte stream functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_byte_stream.h b/libuna/libuna_byte_stream.h
index 22cb304..31e7f82 100644
--- a/libuna/libuna_byte_stream.h
+++ b/libuna/libuna_byte_stream.h
@@ -2,7 +2,7 @@
  * Byte stream functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_ascii.h b/libuna/libuna_codepage_ascii.h
index 4d52205..dea7112 100644
--- a/libuna/libuna_codepage_ascii.h
+++ b/libuna/libuna_codepage_ascii.h
@@ -2,7 +2,7 @@
  * ASCII codepage functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_1.h b/libuna/libuna_codepage_iso_8859_1.h
index 1142a45..7778567 100644
--- a/libuna/libuna_codepage_iso_8859_1.h
+++ b/libuna/libuna_codepage_iso_8859_1.h
@@ -2,7 +2,7 @@
  * ISO 8859-1 codepage (Western European) functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_10.c b/libuna/libuna_codepage_iso_8859_10.c
index f9a7315..5df2c81 100644
--- a/libuna/libuna_codepage_iso_8859_10.c
+++ b/libuna/libuna_codepage_iso_8859_10.c
@@ -2,7 +2,7 @@
  * ISO 8859-10 codepage (Nordic) function
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_10.h b/libuna/libuna_codepage_iso_8859_10.h
index a38e59b..4b90a5b 100644
--- a/libuna/libuna_codepage_iso_8859_10.h
+++ b/libuna/libuna_codepage_iso_8859_10.h
@@ -2,7 +2,7 @@
  * ISO 8859-10 codepage (Nordic) functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_11.h b/libuna/libuna_codepage_iso_8859_11.h
index 1596cb7..83715ef 100644
--- a/libuna/libuna_codepage_iso_8859_11.h
+++ b/libuna/libuna_codepage_iso_8859_11.h
@@ -2,7 +2,7 @@
  * ISO 8859-11 codepage (Thai) functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_13.c b/libuna/libuna_codepage_iso_8859_13.c
index 4ebfeaa..0c8a656 100644
--- a/libuna/libuna_codepage_iso_8859_13.c
+++ b/libuna/libuna_codepage_iso_8859_13.c
@@ -2,7 +2,7 @@
  * ISO 8859-13 codepage (Baltic) function
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_13.h b/libuna/libuna_codepage_iso_8859_13.h
index ba383ed..5e64e62 100644
--- a/libuna/libuna_codepage_iso_8859_13.h
+++ b/libuna/libuna_codepage_iso_8859_13.h
@@ -2,7 +2,7 @@
  * ISO 8859-13 codepage (Baltic) functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_14.c b/libuna/libuna_codepage_iso_8859_14.c
index dee2fa4..6686ac0 100644
--- a/libuna/libuna_codepage_iso_8859_14.c
+++ b/libuna/libuna_codepage_iso_8859_14.c
@@ -2,7 +2,7 @@
  * ISO 8859-14 codepage (Celtic) function
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_14.h b/libuna/libuna_codepage_iso_8859_14.h
index 6700325..fed6903 100644
--- a/libuna/libuna_codepage_iso_8859_14.h
+++ b/libuna/libuna_codepage_iso_8859_14.h
@@ -2,7 +2,7 @@
  * ISO 8859-14 codepage (Celtic) functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_15.c b/libuna/libuna_codepage_iso_8859_15.c
index 1c17a47..499a26d 100644
--- a/libuna/libuna_codepage_iso_8859_15.c
+++ b/libuna/libuna_codepage_iso_8859_15.c
@@ -2,7 +2,7 @@
  * ISO 8859-15 codepage (Latin 9) function
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_15.h b/libuna/libuna_codepage_iso_8859_15.h
index 20a4e8c..f3dcb2b 100644
--- a/libuna/libuna_codepage_iso_8859_15.h
+++ b/libuna/libuna_codepage_iso_8859_15.h
@@ -2,7 +2,7 @@
  * ISO 8859-15 codepage (Latin 9) functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_16.c b/libuna/libuna_codepage_iso_8859_16.c
index 0d6ddff..6e2a37f 100644
--- a/libuna/libuna_codepage_iso_8859_16.c
+++ b/libuna/libuna_codepage_iso_8859_16.c
@@ -2,7 +2,7 @@
  * ISO 8859-16 codepage (Latin 10) function
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_16.h b/libuna/libuna_codepage_iso_8859_16.h
index 02681c9..8473e9e 100644
--- a/libuna/libuna_codepage_iso_8859_16.h
+++ b/libuna/libuna_codepage_iso_8859_16.h
@@ -2,7 +2,7 @@
  * ISO 8859-16 codepage (Latin 10) functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_2.c b/libuna/libuna_codepage_iso_8859_2.c
index 36fe41f..0105362 100644
--- a/libuna/libuna_codepage_iso_8859_2.c
+++ b/libuna/libuna_codepage_iso_8859_2.c
@@ -2,7 +2,7 @@
  * ISO 8859-2 codepage (Central European) function
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_2.h b/libuna/libuna_codepage_iso_8859_2.h
index df7d6c5..b44f0a8 100644
--- a/libuna/libuna_codepage_iso_8859_2.h
+++ b/libuna/libuna_codepage_iso_8859_2.h
@@ -2,7 +2,7 @@
  * ISO 8859-2 codepage (Central European) functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_3.c b/libuna/libuna_codepage_iso_8859_3.c
index 6c31fe9..5de975d 100644
--- a/libuna/libuna_codepage_iso_8859_3.c
+++ b/libuna/libuna_codepage_iso_8859_3.c
@@ -2,7 +2,7 @@
  * ISO 8859-3 codepage (Latin 3) function
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_3.h b/libuna/libuna_codepage_iso_8859_3.h
index 39e4074..b4d728e 100644
--- a/libuna/libuna_codepage_iso_8859_3.h
+++ b/libuna/libuna_codepage_iso_8859_3.h
@@ -2,7 +2,7 @@
  * ISO 8859-3 codepage (Latin 3) functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_4.c b/libuna/libuna_codepage_iso_8859_4.c
index f2011a3..30bed65 100644
--- a/libuna/libuna_codepage_iso_8859_4.c
+++ b/libuna/libuna_codepage_iso_8859_4.c
@@ -2,7 +2,7 @@
  * ISO 8859-4 codepage (Baltic) function
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_4.h b/libuna/libuna_codepage_iso_8859_4.h
index 62ce75c..9bd7ea2 100644
--- a/libuna/libuna_codepage_iso_8859_4.h
+++ b/libuna/libuna_codepage_iso_8859_4.h
@@ -2,7 +2,7 @@
  * ISO 8859-4 codepage (Baltic) functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_5.c b/libuna/libuna_codepage_iso_8859_5.c
index ebdecc7..bf445ab 100644
--- a/libuna/libuna_codepage_iso_8859_5.c
+++ b/libuna/libuna_codepage_iso_8859_5.c
@@ -2,7 +2,7 @@
  * ISO 8859-5 codepage (Cyrillic) function
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_5.h b/libuna/libuna_codepage_iso_8859_5.h
index f14e3df..adead46 100644
--- a/libuna/libuna_codepage_iso_8859_5.h
+++ b/libuna/libuna_codepage_iso_8859_5.h
@@ -2,7 +2,7 @@
  * ISO 8859-5 codepage (Cyrillic) functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_6.c b/libuna/libuna_codepage_iso_8859_6.c
index 3df5d86..eee372a 100644
--- a/libuna/libuna_codepage_iso_8859_6.c
+++ b/libuna/libuna_codepage_iso_8859_6.c
@@ -2,7 +2,7 @@
  * ISO 8859-6 codepage (Arabic) function
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_6.h b/libuna/libuna_codepage_iso_8859_6.h
index ffe0b21..71f8c0f 100644
--- a/libuna/libuna_codepage_iso_8859_6.h
+++ b/libuna/libuna_codepage_iso_8859_6.h
@@ -2,7 +2,7 @@
  * ISO 8859-6 codepage (Arabic) functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_7.c b/libuna/libuna_codepage_iso_8859_7.c
index f08ec24..18bc41f 100644
--- a/libuna/libuna_codepage_iso_8859_7.c
+++ b/libuna/libuna_codepage_iso_8859_7.c
@@ -2,7 +2,7 @@
  * ISO 8859-7 codepage (Greek) function
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_7.h b/libuna/libuna_codepage_iso_8859_7.h
index 4efe21d..4aec827 100644
--- a/libuna/libuna_codepage_iso_8859_7.h
+++ b/libuna/libuna_codepage_iso_8859_7.h
@@ -2,7 +2,7 @@
  * ISO 8859-7 codepage (Greek) functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_8.c b/libuna/libuna_codepage_iso_8859_8.c
index 571e6e4..5927925 100644
--- a/libuna/libuna_codepage_iso_8859_8.c
+++ b/libuna/libuna_codepage_iso_8859_8.c
@@ -2,7 +2,7 @@
  * ISO 8859-8 codepage (Hebrew) function
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_8.h b/libuna/libuna_codepage_iso_8859_8.h
index 3cb64fb..5716e5b 100644
--- a/libuna/libuna_codepage_iso_8859_8.h
+++ b/libuna/libuna_codepage_iso_8859_8.h
@@ -2,7 +2,7 @@
  * ISO 8859-8 codepage (Hebrew) functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_9.c b/libuna/libuna_codepage_iso_8859_9.c
index 1b7c1c7..408df3b 100644
--- a/libuna/libuna_codepage_iso_8859_9.c
+++ b/libuna/libuna_codepage_iso_8859_9.c
@@ -2,7 +2,7 @@
  * ISO 8859-9 codepage (Turkish) function
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_iso_8859_9.h b/libuna/libuna_codepage_iso_8859_9.h
index b53d612..b76527f 100644
--- a/libuna/libuna_codepage_iso_8859_9.h
+++ b/libuna/libuna_codepage_iso_8859_9.h
@@ -2,7 +2,7 @@
  * ISO 8859-9 codepage (Turkish) functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_koi8_r.c b/libuna/libuna_codepage_koi8_r.c
index 63215d4..372e331 100644
--- a/libuna/libuna_codepage_koi8_r.c
+++ b/libuna/libuna_codepage_koi8_r.c
@@ -2,7 +2,7 @@
  * KOI8-R codepage (Russian Cyrillic) function
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_koi8_r.h b/libuna/libuna_codepage_koi8_r.h
index ba4db71..e7161b6 100644
--- a/libuna/libuna_codepage_koi8_r.h
+++ b/libuna/libuna_codepage_koi8_r.h
@@ -2,7 +2,7 @@
  * KOI8-R codepage (Russian Cyrillic) functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_koi8_u.c b/libuna/libuna_codepage_koi8_u.c
index ec19b23..28cecaa 100644
--- a/libuna/libuna_codepage_koi8_u.c
+++ b/libuna/libuna_codepage_koi8_u.c
@@ -2,7 +2,7 @@
  * KOI8-U codepage (Ukrainian Cyrillic) function
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_koi8_u.h b/libuna/libuna_codepage_koi8_u.h
index 20c26bf..1132d73 100644
--- a/libuna/libuna_codepage_koi8_u.h
+++ b/libuna/libuna_codepage_koi8_u.h
@@ -2,7 +2,7 @@
  * KOI8-U codepage (Ukrainian Cyrillic) functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_windows_1250.c b/libuna/libuna_codepage_windows_1250.c
index 07950fe..0991803 100644
--- a/libuna/libuna_codepage_windows_1250.c
+++ b/libuna/libuna_codepage_windows_1250.c
@@ -2,7 +2,7 @@
  * Windows 1250 codepage (Central European) functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_windows_1250.h b/libuna/libuna_codepage_windows_1250.h
index f586133..31bf13b 100644
--- a/libuna/libuna_codepage_windows_1250.h
+++ b/libuna/libuna_codepage_windows_1250.h
@@ -2,7 +2,7 @@
  * Windows 1250 codepage (Central European) functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_windows_1251.c b/libuna/libuna_codepage_windows_1251.c
index 2d13eb1..45af4ae 100644
--- a/libuna/libuna_codepage_windows_1251.c
+++ b/libuna/libuna_codepage_windows_1251.c
@@ -2,7 +2,7 @@
  * Windows 1251 codepage (Cyrillic) functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_windows_1251.h b/libuna/libuna_codepage_windows_1251.h
index 012edef..927815c 100644
--- a/libuna/libuna_codepage_windows_1251.h
+++ b/libuna/libuna_codepage_windows_1251.h
@@ -2,7 +2,7 @@
  * Windows 1251 codepage (Cyrillic) functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_windows_1252.c b/libuna/libuna_codepage_windows_1252.c
index abbd23e..7a09cbe 100644
--- a/libuna/libuna_codepage_windows_1252.c
+++ b/libuna/libuna_codepage_windows_1252.c
@@ -2,7 +2,7 @@
  * Windows 1252 codepage (Western European/Latin 1) functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_windows_1252.h b/libuna/libuna_codepage_windows_1252.h
index a91e50b..9d7a3c5 100644
--- a/libuna/libuna_codepage_windows_1252.h
+++ b/libuna/libuna_codepage_windows_1252.h
@@ -2,7 +2,7 @@
  * Windows 1252 codepage (Western European/Latin 1) functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_windows_1253.c b/libuna/libuna_codepage_windows_1253.c
index f6d5c3c..be981ab 100644
--- a/libuna/libuna_codepage_windows_1253.c
+++ b/libuna/libuna_codepage_windows_1253.c
@@ -2,7 +2,7 @@
  * Windows 1253 codepage (Greek) functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_windows_1253.h b/libuna/libuna_codepage_windows_1253.h
index 67f8cc3..2419403 100644
--- a/libuna/libuna_codepage_windows_1253.h
+++ b/libuna/libuna_codepage_windows_1253.h
@@ -2,7 +2,7 @@
  * Windows 1253 codepage (Greek) functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_windows_1254.c b/libuna/libuna_codepage_windows_1254.c
index 14921e5..cc742e1 100644
--- a/libuna/libuna_codepage_windows_1254.c
+++ b/libuna/libuna_codepage_windows_1254.c
@@ -2,7 +2,7 @@
  * Windows 1254 codepage (Turkish) functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_windows_1254.h b/libuna/libuna_codepage_windows_1254.h
index 56099c6..0a61859 100644
--- a/libuna/libuna_codepage_windows_1254.h
+++ b/libuna/libuna_codepage_windows_1254.h
@@ -2,7 +2,7 @@
  * Windows 1254 codepage (Turkish) functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_windows_1255.c b/libuna/libuna_codepage_windows_1255.c
index cf9908f..7d2b057 100644
--- a/libuna/libuna_codepage_windows_1255.c
+++ b/libuna/libuna_codepage_windows_1255.c
@@ -2,7 +2,7 @@
  * Windows 1255 codepage (Hebrew) functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_windows_1255.h b/libuna/libuna_codepage_windows_1255.h
index 12a23f5..21607f3 100644
--- a/libuna/libuna_codepage_windows_1255.h
+++ b/libuna/libuna_codepage_windows_1255.h
@@ -2,7 +2,7 @@
  * Windows 1255 codepage (Hebrew) functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_windows_1256.c b/libuna/libuna_codepage_windows_1256.c
index f967f2b..0cd699d 100644
--- a/libuna/libuna_codepage_windows_1256.c
+++ b/libuna/libuna_codepage_windows_1256.c
@@ -2,7 +2,7 @@
  * Windows 1256 codepage (Arabic) functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_windows_1256.h b/libuna/libuna_codepage_windows_1256.h
index e30f7e1..e6137af 100644
--- a/libuna/libuna_codepage_windows_1256.h
+++ b/libuna/libuna_codepage_windows_1256.h
@@ -2,7 +2,7 @@
  * Windows 1256 codepage (Arabic) functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_windows_1257.c b/libuna/libuna_codepage_windows_1257.c
index ba474e8..245ca04 100644
--- a/libuna/libuna_codepage_windows_1257.c
+++ b/libuna/libuna_codepage_windows_1257.c
@@ -2,7 +2,7 @@
  * Windows 1257 codepage (Baltic) functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_windows_1257.h b/libuna/libuna_codepage_windows_1257.h
index ce2c6e4..661c4b0 100644
--- a/libuna/libuna_codepage_windows_1257.h
+++ b/libuna/libuna_codepage_windows_1257.h
@@ -2,7 +2,7 @@
  * Windows 1257 codepage (Baltic) functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_windows_1258.c b/libuna/libuna_codepage_windows_1258.c
index a1baf12..2046d99 100644
--- a/libuna/libuna_codepage_windows_1258.c
+++ b/libuna/libuna_codepage_windows_1258.c
@@ -2,7 +2,7 @@
  * Windows 1258 codepage (Vietnamese) functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_windows_1258.h b/libuna/libuna_codepage_windows_1258.h
index bf13cde..6215141 100644
--- a/libuna/libuna_codepage_windows_1258.h
+++ b/libuna/libuna_codepage_windows_1258.h
@@ -2,7 +2,7 @@
  * Windows 1258 codepage (Vietnamese) functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_windows_874.c b/libuna/libuna_codepage_windows_874.c
index d5c0d19..21788b6 100644
--- a/libuna/libuna_codepage_windows_874.c
+++ b/libuna/libuna_codepage_windows_874.c
@@ -2,7 +2,7 @@
  * Windows 874 codepage (Thai) functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_codepage_windows_874.h b/libuna/libuna_codepage_windows_874.h
index e5da903..dbb2831 100644
--- a/libuna/libuna_codepage_windows_874.h
+++ b/libuna/libuna_codepage_windows_874.h
@@ -2,7 +2,7 @@
  * Windows 874 codepage (Thai) functions
  *
  * Copyright (c) 2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_compare.c b/libuna/libuna_compare.c
index df50b74..87cfd3e 100644
--- a/libuna/libuna_compare.c
+++ b/libuna/libuna_compare.c
@@ -2,7 +2,7 @@
  * Compare functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_compare.h b/libuna/libuna_compare.h
index 0bef40c..369f079 100644
--- a/libuna/libuna_compare.h
+++ b/libuna/libuna_compare.h
@@ -2,7 +2,7 @@
  * Compare functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_definitions.h b/libuna/libuna_definitions.h
index 5e0b148..c4ba269 100644
--- a/libuna/libuna_definitions.h
+++ b/libuna/libuna_definitions.h
@@ -2,7 +2,7 @@
  * The internal definitions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -34,18 +34,18 @@
  * for local use of libuna
  */
 #else
-#include <endian.h>
+#include <byte_stream.h>
 
-#define LIBUNA_VERSION					20090928
+#define LIBUNA_VERSION					20091031
 
 /* The libuna version string
  */
-#define LIBUNA_VERSION_STRING				"20090928"
+#define LIBUNA_VERSION_STRING				"20091031"
 
 /* The endian definitions
  */
-#define	LIBUNA_ENDIAN_BIG                               _ENDIAN_BIG
-#define	LIBUNA_ENDIAN_LITTLE                            _ENDIAN_LITTLE
+#define	LIBUNA_ENDIAN_BIG                               _BYTE_STREAM_ENDIAN_BIG
+#define	LIBUNA_ENDIAN_LITTLE                            _BYTE_STREAM_ENDIAN_LITTLE
 
 /* The codepage definitions
  */
@@ -129,18 +129,22 @@ enum LIBUNA_CODEPAGE
 
 /* Character definitions
  */
-#define LIBUNA_UNICODE_REPLACEMENT_CHARACTER		0x0000fffd
-#define LIBUNA_UNICODE_BASIC_MULTILINGUAL_PLANE_MAX	0x0000ffff
-#define LIBUNA_UNICODE_SURROGATE_LOW_RANGE_START	0x0000dc00
-#define LIBUNA_UNICODE_SURROGATE_LOW_RANGE_END		0x0000dfff
-#define LIBUNA_UNICODE_SURROGATE_HIGH_RANGE_START	0x0000d800
-#define LIBUNA_UNICODE_SURROGATE_HIGH_RANGE_END		0x0000dbff
-#define LIBUNA_UNICODE_CHARACTER_MAX			0x0010ffff
+#define LIBUNA_UNICODE_REPLACEMENT_CHARACTER		0x0000fffdUL
+#define LIBUNA_UNICODE_BASIC_MULTILINGUAL_PLANE_MAX	0x0000ffffUL
+#define LIBUNA_UNICODE_SURROGATE_LOW_RANGE_START	0x0000dc00UL
+#define LIBUNA_UNICODE_SURROGATE_LOW_RANGE_END		0x0000dfffUL
+#define LIBUNA_UNICODE_SURROGATE_HIGH_RANGE_START	0x0000d800UL
+#define LIBUNA_UNICODE_SURROGATE_HIGH_RANGE_END		0x0000dbffUL
+#define LIBUNA_UNICODE_CHARACTER_MAX			0x0010ffffUL
 
-#define LIBUNA_UTF16_CHARACTER_MAX			0x0010ffff
-#define LIBUNA_UTF32_CHARACTER_MAX			0x7fffffff
+#define LIBUNA_UTF16_CHARACTER_MAX			0x0010ffffUL
+#define LIBUNA_UTF32_CHARACTER_MAX			0x7fffffffUL
 
 #define LIBUNA_ASCII_REPLACEMENT_CHARACTER		0x1a
 
+/* UTF-7 definitions
+ */
+#define	LIBUNA_UTF7_IS_BASE64_ENCODED			0x80000000UL
+
 #endif
 
diff --git a/libuna/libuna_error.h b/libuna/libuna_error.h
index 4fba8e4..f6cc0c8 100644
--- a/libuna/libuna_error.h
+++ b/libuna/libuna_error.h
@@ -2,7 +2,7 @@
  * Error functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_extern.h b/libuna/libuna_extern.h
index 3f4580f..d671beb 100644
--- a/libuna/libuna_extern.h
+++ b/libuna/libuna_extern.h
@@ -2,7 +2,7 @@
  * The internal extern definition
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_inline.h b/libuna/libuna_inline.h
index f28af71..e305595 100644
--- a/libuna/libuna_inline.h
+++ b/libuna/libuna_inline.h
@@ -2,7 +2,7 @@
  * The internal inline definition
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_support.c b/libuna/libuna_support.c
index 3010f26..5c3fff8 100644
--- a/libuna/libuna_support.c
+++ b/libuna/libuna_support.c
@@ -2,7 +2,7 @@
  * Support functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_support.h b/libuna/libuna_support.h
index d2f9b95..f305f39 100644
--- a/libuna/libuna_support.h
+++ b/libuna/libuna_support.h
@@ -2,7 +2,7 @@
  * Support functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_types.h b/libuna/libuna_types.h
index b84217a..8902329 100644
--- a/libuna/libuna_types.h
+++ b/libuna/libuna_types.h
@@ -2,7 +2,7 @@
  * The internal type definitions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -36,6 +36,10 @@
  */
 typedef uint32_t libuna_unicode_character_t;
 
+/* UTF-7 character definitions
+ */
+typedef uint8_t libuna_utf7_character_t;
+
 /* UTF-8 character definitions
  */
 typedef uint8_t libuna_utf8_character_t;
diff --git a/libuna/libuna_unicode_character.c b/libuna/libuna_unicode_character.c
index a08cdca..4572b73 100644
--- a/libuna/libuna_unicode_character.c
+++ b/libuna/libuna_unicode_character.c
@@ -2,7 +2,7 @@
  * Unicode character functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -25,6 +25,7 @@
 
 #include <liberror.h>
 
+#include "libuna_base64_stream.h"
 #include "libuna_codepage_ascii.h"
 #include "libuna_codepage_iso_8859_1.h"
 #include "libuna_codepage_iso_8859_2.h"
@@ -58,7 +59,7 @@
 #include "libuna_types.h"
 #include "libuna_unicode_character.h"
 
-/* Determines the size of a byte stream character to from a Unicode character
+/* Determines the size of a byte stream character from a Unicode character
  * Adds the size to the byte stream character size value
  * Returns 1 if successful or -1 on error
  */
@@ -573,7 +574,461 @@ LIBUNA_INLINE int libuna_unicode_character_copy_to_byte_stream(
 	return( 1 );
 }
 
-/* Determines the size of a UTF-8 character to from a Unicode character
+/* Determines the size of a UTF-7 character from a Unicode character
+ * Adds the size to the UTF-7 character size value
+ * Returns 1 if successful or -1 on error
+ */
+LIBUNA_INLINE int libuna_unicode_character_size_to_utf7(
+                   libuna_unicode_character_t unicode_character,
+                   size_t *utf7_character_size,
+                   liberror_error_t **error )
+{
+	static char *function = "libuna_unicode_character_size_to_utf7";
+
+	if( utf7_character_size == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid UTF-7 character size.",
+		 function );
+
+		return( -1 );
+	}
+	/* TODO */
+	return( -1 );
+}
+
+/* Copies a Unicode character from a UTF-7 string
+ * The bits of the base64 data contain:
+ *   0 - 23 the base64 triplet
+ *  24 - 25 the amount of sixtets in the triplet
+ *  26 - 27 unused
+ *  28 - 29 the current sixtet
+ *       30 unused
+ *       31 flag to indicate the current UTF-7 characters are (modified) base64 encoded
+ * Returns 1 if successful or -1 on error
+ */
+LIBUNA_INLINE int libuna_unicode_character_copy_from_utf7(
+                   libuna_unicode_character_t *unicode_character,
+                   const libuna_utf7_character_t *utf7_string,
+                   size_t utf7_string_size,
+                   size_t *utf7_string_index,
+                   uint32_t *utf7_base64_data,
+                   liberror_error_t **error )
+{
+	static char *function     = "libuna_unicode_character_copy_from_utf7";
+	uint32_t base64_triplet   = 0;
+	uint8_t amount_of_sixtets = 0;
+	uint8_t current_sixtet    = 0;
+	uint8_t padding_size      = 0;
+	uint8_t sixtet_bit_shift  = 0;
+
+	if( unicode_character == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid Unicode character.",
+		 function );
+
+		return( -1 );
+	}
+	if( utf7_string == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid UTF-7 string.",
+		 function );
+
+		return( -1 );
+	}
+	if( utf7_string_size > (size_t) SSIZE_MAX )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
+		 "%s: invalid UTF-7 string size value exceeds maximum.",
+		 function );
+
+		return( -1 );
+	}
+	if( utf7_string_index == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid UTF-7 string index.",
+		 function );
+
+		return( -1 );
+	}
+	if( *utf7_string_index >= utf7_string_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: UTF-7 string too small.",
+		 function );
+
+		return( -1 );
+	}
+	if( utf7_base64_data == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid UTF-7 base64 data.",
+		 function );
+
+		return( -1 );
+	}
+	if( ( *utf7_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) == LIBUNA_UTF7_IS_BASE64_ENCODED )
+	{
+		base64_triplet    = *utf7_base64_data & 0x00ffffff;
+		amount_of_sixtets = ( *utf7_base64_data >> 24 ) & 0x03;
+		current_sixtet    = ( *utf7_base64_data >> 28 ) & 0x03;
+
+		if( current_sixtet >= amount_of_sixtets )
+		{
+			if( utf7_string[ *utf7_string_index ] == (uint8_t) '-' )
+			{
+				*utf7_base64_data   = 0;
+				*utf7_string_index += 1;
+			}
+			/* A-Z is not a continous range on a EBCDIC based system
+			 * it consists of the ranges: A-I, J-R, S-Z
+			 */
+			else if( ( utf7_string[ *utf7_string_index ] >= (uint8_t) 'A' )
+			      && ( utf7_string[ *utf7_string_index ] <= (uint8_t) 'I' ) )
+			{
+			}
+			else if( ( utf7_string[ *utf7_string_index ] >= (uint8_t) 'J' )
+			      && ( utf7_string[ *utf7_string_index ] <= (uint8_t) 'R' ) )
+			{
+			}
+			else if( ( utf7_string[ *utf7_string_index ] >= (uint8_t) 'S' )
+			      && ( utf7_string[ *utf7_string_index ] <= (uint8_t) 'Z' ) )
+			{
+			}
+			/* a-z is not a continous range on a EBCDIC based system
+			 * it consists of the ranges: a-i, j-r, s-z
+			 */
+			else if( ( utf7_string[ *utf7_string_index ] >= (uint8_t) 'a' )
+			      && ( utf7_string[ *utf7_string_index ] <= (uint8_t) 'i' ) )
+			{
+			}
+			else if( ( utf7_string[ *utf7_string_index ] >= (uint8_t) 'j' )
+			      && ( utf7_string[ *utf7_string_index ] <= (uint8_t) 'r' ) )
+			{
+			}
+			else if( ( utf7_string[ *utf7_string_index ] >= (uint8_t) 's' )
+			      && ( utf7_string[ *utf7_string_index ] <= (uint8_t) 'z' ) )
+			{
+			}
+			else if( ( utf7_string[ *utf7_string_index ] >= (uint8_t) '0' )
+			      && ( utf7_string[ *utf7_string_index ] <= (uint8_t) '9' ) )
+			{
+			}
+			else if( ( utf7_string[ *utf7_string_index ] == (uint8_t) '+' )
+			      || ( utf7_string[ *utf7_string_index ] == (uint8_t) '/' ) )
+			{
+			}
+			/* Any character not in the modified base64 alphabet
+			 * terminates the base64 encoded sequence
+			 */
+			else
+			{
+				*utf7_base64_data = 0;
+			}
+		}
+	}
+	if( ( *utf7_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) == 0 )
+	{
+		/* Determine if the character is modified base64 encoded
+		 * or a + character
+		 */
+		if( utf7_string[ *utf7_string_index ] == (uint8_t) '+' )
+		{
+			if( utf7_string[ *utf7_string_index + 1 ] != (uint8_t) '-' )
+			{
+				*utf7_base64_data = LIBUNA_UTF7_IS_BASE64_ENCODED;
+			}
+			*utf7_string_index += 1;
+		}
+		/* Determine if the character is valid directly encoded character
+		 */
+		else
+		{
+			/* A-Z is not a continous range on a EBCDIC based system
+			 * it consists of the ranges: A-I, J-R, S-Z
+			 */
+			if( ( utf7_string[ *utf7_string_index ] >= (uint8_t) 'A' )
+			 && ( utf7_string[ *utf7_string_index ] <= (uint8_t) 'I' ) )
+			{
+			}
+			else if( ( utf7_string[ *utf7_string_index ] >= (uint8_t) 'J' )
+			      && ( utf7_string[ *utf7_string_index ] <= (uint8_t) 'R' ) )
+			{
+			}
+			else if( ( utf7_string[ *utf7_string_index ] >= (uint8_t) 'S' )
+			      && ( utf7_string[ *utf7_string_index ] <= (uint8_t) 'Z' ) )
+			{
+			}
+			/* a-z is not a continous range on a EBCDIC based system
+			 * it consists of the ranges: a-i, j-r, s-z
+			 */
+			else if( ( utf7_string[ *utf7_string_index ] >= (uint8_t) 'a' )
+			      && ( utf7_string[ *utf7_string_index ] <= (uint8_t) 'i' ) )
+			{
+			}
+			else if( ( utf7_string[ *utf7_string_index ] >= (uint8_t) 'j' )
+			      && ( utf7_string[ *utf7_string_index ] <= (uint8_t) 'r' ) )
+			{
+			}
+			else if( ( utf7_string[ *utf7_string_index ] >= (uint8_t) 's' )
+			      && ( utf7_string[ *utf7_string_index ] <= (uint8_t) 'z' ) )
+			{
+			}
+			else if( ( utf7_string[ *utf7_string_index ] >= (uint8_t) '0' )
+			      && ( utf7_string[ *utf7_string_index ] <= (uint8_t) '9' ) )
+			{
+			}
+			else switch( utf7_string[ *utf7_string_index ] )
+			{
+				/* Valid directly encoded whitespace
+				 */
+				case '\t':
+				case '\n':
+				case '\r':
+				case ' ':
+				/* Valid directly encoded characters
+				 */
+				case '\'':
+				case '(':
+				case ')':
+				case ',':
+				case '-':
+				case '.':
+				case '/':
+				case ':':
+				case '?':
+
+				/* Valid optional directly encoded characters
+				 */
+				case '!':
+				case '"':
+				case '#':
+				case '$':
+				case '%':
+				case '&':
+				case '*':
+				case ';':
+				case '<':
+				case '=':
+				case '>':
+				case '@':
+				case '[':
+				case ']':
+				case '^':
+				case '_':
+				case '`':
+				case '{':
+				case '|':
+				case '}':
+					break;
+
+				default:
+					liberror_error_set(
+					 error,
+					 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+					 LIBERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
+					 "%s: invalid directly encoded UTF-7 character byte: 0x%02" PRIx8 ".",
+					 function,
+					 utf7_string[ *utf7_string_index ] );
+
+					return( -1 );
+			}
+		}
+	}
+	if( ( *utf7_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) == 0 )
+	{
+		*unicode_character  = utf7_string[ *utf7_string_index ];
+		*utf7_string_index += 1;
+	}
+	else if( ( amount_of_sixtets == 0 )
+	      || ( current_sixtet >= amount_of_sixtets ) )
+	{
+		if( libuna_base64_triplet_copy_from_base64_stream(
+		     &base64_triplet,
+		     utf7_string,
+		     utf7_string_size,
+		     utf7_string_index,
+		     0,
+		     &padding_size,
+		     error ) != 1 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_CONVERSION,
+			 LIBERROR_CONVERSION_ERROR_OUTPUT_FAILED,
+			 "%s: unable to copy base64 encoded UTF-7 characters.",
+			 function );
+
+			return( -1 );
+		}
+		if( padding_size > 2 )
+		{
+			liberror_error_set(
+			 error,
+			 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+			 LIBERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
+			 "%s: unsupported padding in base64 encoded UTF-7 characters.",
+			 function );
+
+			return( -1 );
+		}
+		amount_of_sixtets = 3 - padding_size;
+		current_sixtet    = 0;
+	}
+	if( ( *utf7_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) == LIBUNA_UTF7_IS_BASE64_ENCODED )
+	{
+		sixtet_bit_shift   = 16 - ( current_sixtet * 8 );
+		*unicode_character = ( ( base64_triplet >> sixtet_bit_shift ) & 0x000000ffUL ) << 8;
+		current_sixtet    += 1;
+
+		if( current_sixtet >= amount_of_sixtets )
+		{
+			if( libuna_base64_triplet_copy_from_base64_stream(
+			     &base64_triplet,
+			     utf7_string,
+			     utf7_string_size,
+			     utf7_string_index,
+			     0,
+			     &padding_size,
+			     error ) != 1 )
+			{
+				liberror_error_set(
+				 error,
+				 LIBERROR_ERROR_DOMAIN_CONVERSION,
+				 LIBERROR_CONVERSION_ERROR_OUTPUT_FAILED,
+				 "%s: unable to copy base64 encoded UTF-7 characters.",
+				 function );
+
+				return( -1 );
+			}
+			if( padding_size > 2 )
+			{
+				liberror_error_set(
+				 error,
+				 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+				 LIBERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
+				 "%s: unsupported padding in base64 encoded UTF-7 characters.",
+				 function );
+
+				return( -1 );
+			}
+			amount_of_sixtets = 3 - padding_size;
+			current_sixtet    = 0;
+		}
+		sixtet_bit_shift    = 16 - ( current_sixtet * 8 );
+		*unicode_character += ( base64_triplet >> sixtet_bit_shift ) & 0x000000ffUL;
+		current_sixtet     += 1;
+
+		if( ( *unicode_character >= LIBUNA_UNICODE_SURROGATE_HIGH_RANGE_START )
+		 && ( *unicode_character <= LIBUNA_UNICODE_SURROGATE_HIGH_RANGE_END ) )
+		{
+			return( -1 );
+		}
+	}
+	if( ( *utf7_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) == LIBUNA_UTF7_IS_BASE64_ENCODED )
+	{
+		*utf7_base64_data  = LIBUNA_UTF7_IS_BASE64_ENCODED;
+		*utf7_base64_data |= (uint32_t) current_sixtet << 28;
+		*utf7_base64_data |= (uint32_t) amount_of_sixtets << 24;
+		*utf7_base64_data |= base64_triplet & 0x00ffffff;
+	}
+	return( 1 );
+}
+
+/* Copies a Unicode character into a UTF-7 string
+ * Returns 1 if successful or -1 on error
+ */
+LIBUNA_INLINE int libuna_unicode_character_copy_to_utf7(
+                   libuna_unicode_character_t unicode_character,
+                   libuna_utf7_character_t *utf7_string,
+                   size_t utf7_string_size,
+                   size_t *utf7_string_index,
+                   uint32_t *utf7_base64_data,
+                   liberror_error_t **error )
+{
+	static char *function = "libuna_unicode_character_copy_to_utf7";
+
+	if( utf7_string == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid UTF-7 string.",
+		 function );
+
+		return( -1 );
+	}
+	if( utf7_string_size > (size_t) SSIZE_MAX )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
+		 "%s: invalid UTF-7 string size value exceeds maximum.",
+		 function );
+
+		return( -1 );
+	}
+	if( utf7_string_index == NULL )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_INVALID_VALUE,
+		 "%s: invalid UTF-7 string index.",
+		 function );
+
+		return( -1 );
+	}
+	if( *utf7_string_index >= utf7_string_size )
+	{
+		liberror_error_set(
+		 error,
+		 LIBERROR_ERROR_DOMAIN_ARGUMENTS,
+		 LIBERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL,
+		 "%s: UTF-7 string too small.",
+		 function );
+
+		return( -1 );
+	}
+	/* Determine if the Unicode character is valid
+	 */
+	if( unicode_character > LIBUNA_UNICODE_CHARACTER_MAX )
+	{
+		unicode_character = LIBUNA_UNICODE_REPLACEMENT_CHARACTER;
+	}
+	/* Determine how many UTF-7 character bytes are required
+	 */
+	/* TODO */
+	return( -1 );
+}
+
+/* Determines the size of a UTF-8 character from a Unicode character
  * Adds the size to the UTF-8 character size value
  * Returns 1 if successful or -1 on error
  */
@@ -1026,7 +1481,7 @@ LIBUNA_INLINE int libuna_unicode_character_copy_to_utf8(
 
 		return( -1 );
 	}
-	/* Determine if the UTF-8 character is valid
+	/* Determine if the Unicode character is valid
 	 */
 	if( unicode_character > LIBUNA_UNICODE_CHARACTER_MAX )
 	{
@@ -1090,7 +1545,7 @@ LIBUNA_INLINE int libuna_unicode_character_copy_to_utf8(
 	return( 1 );
 }
 
-/* Determines the size of a UTF-16 character to from a Unicode character
+/* Determines the size of a UTF-16 character from a Unicode character
  * Adds the size to the UTF-16 character size value
  * Returns 1 if successful or -1 on error
  */
@@ -1295,7 +1750,7 @@ LIBUNA_INLINE int libuna_unicode_character_copy_to_utf16(
 
 		return( -1 );
 	}
-	/* Determine if the UTF-16 character is valid
+	/* Determine if the Unicode character is valid
 	 */
 	if( ( ( unicode_character >= LIBUNA_UNICODE_SURROGATE_HIGH_RANGE_START )
 	  && ( unicode_character <= LIBUNA_UNICODE_SURROGATE_LOW_RANGE_END ) )
@@ -1551,7 +2006,7 @@ LIBUNA_INLINE int libuna_unicode_character_copy_to_utf16_stream(
 
 		return( -1 );
 	}
-	/* Determine if the UTF-16 character is valid
+	/* Determine if the Unicode character is valid
 	 */
 	if( ( ( unicode_character >= LIBUNA_UNICODE_SURROGATE_HIGH_RANGE_START )
 	  && ( unicode_character <= LIBUNA_UNICODE_SURROGATE_LOW_RANGE_END ) )
@@ -1625,7 +2080,7 @@ LIBUNA_INLINE int libuna_unicode_character_copy_to_utf16_stream(
 	return( 1 );
 }
 
-/* Determines the size of a UTF-32 character to from a Unicode character
+/* Determines the size of a UTF-32 character from a Unicode character
  * Adds the size to the UTF-32 character size value
  * Returns 1 if successful or -1 on error
  */
@@ -1791,7 +2246,7 @@ LIBUNA_INLINE int libuna_unicode_character_copy_to_utf32(
 
 		return( -1 );
 	}
-	/* Determine if the UTF-32 character is valid
+	/* Determine if the Unicode character is valid
 	 */
 	if( ( ( unicode_character >= LIBUNA_UNICODE_SURROGATE_HIGH_RANGE_START )
 	  && ( unicode_character <= LIBUNA_UNICODE_SURROGATE_LOW_RANGE_END ) )
@@ -1989,7 +2444,7 @@ LIBUNA_INLINE int libuna_unicode_character_copy_to_utf32_stream(
 
 		return( -1 );
 	}
-	/* Determine if the UTF-32 character is valid
+	/* Determine if the Unicode character is valid
 	 */
 	if( ( ( unicode_character >= LIBUNA_UNICODE_SURROGATE_HIGH_RANGE_START )
 	  && ( unicode_character <= LIBUNA_UNICODE_SURROGATE_LOW_RANGE_END ) )
diff --git a/libuna/libuna_unicode_character.h b/libuna/libuna_unicode_character.h
index 2e84e2d..38961ba 100644
--- a/libuna/libuna_unicode_character.h
+++ b/libuna/libuna_unicode_character.h
@@ -2,7 +2,7 @@
  * Unicode character functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
@@ -59,15 +59,26 @@ LIBUNA_EXTERN LIBUNA_INLINE int libuna_unicode_character_copy_to_byte_stream(
                                  int codepage,
                                  liberror_error_t **error );
 
-/* TODO
+LIBUNA_EXTERN LIBUNA_INLINE int libuna_unicode_character_size_to_utf7(
+                                 libuna_unicode_character_t unicode_character,
+                                 size_t *utf7_character_size,
+                                 liberror_error_t **error );
+
 LIBUNA_EXTERN LIBUNA_INLINE int libuna_unicode_character_copy_from_utf7_stream(
                                  libuna_unicode_character_t *unicode_character,
                                  const uint8_t *utf7_stream,
                                  size_t utf7_stream_size,
                                  size_t *utf7_stream_index,
-                                 uint8_t *inside_base64_encoding,
+                                 uint32_t *utf7_base64_data,
+                                 liberror_error_t **error );
+
+LIBUNA_EXTERN LIBUNA_INLINE int libuna_unicode_character_copy_to_utf7(
+                                 libuna_unicode_character_t unicode_character,
+                                 libuna_utf7_character_t *utf7_string,
+                                 size_t utf7_string_size,
+                                 size_t *utf7_string_index,
+                                 uint32_t *utf7_base64_data,
                                  liberror_error_t **error );
-*/
 
 LIBUNA_EXTERN LIBUNA_INLINE int libuna_unicode_character_size_to_utf8(
                                  libuna_unicode_character_t unicode_character,
diff --git a/libuna/libuna_utf16_stream.c b/libuna/libuna_utf16_stream.c
index 5db08dd..cfc039a 100644
--- a/libuna/libuna_utf16_stream.c
+++ b/libuna/libuna_utf16_stream.c
@@ -2,7 +2,7 @@
  * UTF-16 stream functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_utf16_stream.h b/libuna/libuna_utf16_stream.h
index f3d4045..01dc94a 100644
--- a/libuna/libuna_utf16_stream.h
+++ b/libuna/libuna_utf16_stream.h
@@ -2,7 +2,7 @@
  * UTF-16 stream functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_utf16_string.c b/libuna/libuna_utf16_string.c
index 281e429..8a88cb4 100644
--- a/libuna/libuna_utf16_string.c
+++ b/libuna/libuna_utf16_string.c
@@ -2,7 +2,7 @@
  * UTF-16 string functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_utf16_string.h b/libuna/libuna_utf16_string.h
index cbe2137..d222ef7 100644
--- a/libuna/libuna_utf16_string.h
+++ b/libuna/libuna_utf16_string.h
@@ -2,7 +2,7 @@
  * UTF-16 string functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_utf32_stream.c b/libuna/libuna_utf32_stream.c
index 50c61e9..0a7f2ce 100644
--- a/libuna/libuna_utf32_stream.c
+++ b/libuna/libuna_utf32_stream.c
@@ -2,7 +2,7 @@
  * UTF-32 stream functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_utf32_stream.h b/libuna/libuna_utf32_stream.h
index 70adb16..0834caa 100644
--- a/libuna/libuna_utf32_stream.h
+++ b/libuna/libuna_utf32_stream.h
@@ -2,7 +2,7 @@
  * UTF-32 stream functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_utf32_string.c b/libuna/libuna_utf32_string.c
index 0a08342..8891b2f 100644
--- a/libuna/libuna_utf32_string.c
+++ b/libuna/libuna_utf32_string.c
@@ -2,7 +2,7 @@
  * UTF-32 string functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_utf32_string.h b/libuna/libuna_utf32_string.h
index 2b41ecc..0a5bec1 100644
--- a/libuna/libuna_utf32_string.h
+++ b/libuna/libuna_utf32_string.h
@@ -2,7 +2,7 @@
  * UTF-32 string functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_utf8_stream.c b/libuna/libuna_utf8_stream.c
index 98a22d1..1165b37 100644
--- a/libuna/libuna_utf8_stream.c
+++ b/libuna/libuna_utf8_stream.c
@@ -2,7 +2,7 @@
  * UTF-8 stream functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_utf8_stream.h b/libuna/libuna_utf8_stream.h
index 28e93b1..70e7699 100644
--- a/libuna/libuna_utf8_stream.h
+++ b/libuna/libuna_utf8_stream.h
@@ -2,7 +2,7 @@
  * UTF-8 stream functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_utf8_string.c b/libuna/libuna_utf8_string.c
index 6930d7f..e3fc21f 100644
--- a/libuna/libuna_utf8_string.c
+++ b/libuna/libuna_utf8_string.c
@@ -2,7 +2,7 @@
  * UTF-8 string functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/libuna/libuna_utf8_string.h b/libuna/libuna_utf8_string.h
index 07637c6..fbb295b 100644
--- a/libuna/libuna_utf8_string.h
+++ b/libuna/libuna_utf8_string.h
@@ -2,7 +2,7 @@
  * UTF-8 string functions
  *
  * Copyright (c) 2008-2009, Joachim Metz <forensics at hoffmannbv.nl>,
- * Hoffmann Investigations. All rights reserved.
+ * Hoffmann Investigations.
  *
  * Refer to AUTHORS for acknowledgements.
  *
diff --git a/macosx/Introduction.rtf b/macosx/Introduction.rtf
index 2158712..bb0cbfd 100644
--- a/macosx/Introduction.rtf
+++ b/macosx/Introduction.rtf
@@ -4,4 +4,4 @@
 \margl1440\margr1440\vieww9880\viewh13400\viewkind0
 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
 
-\f0\fs24 \cf0 This will install a universal build of libewf 20091003 and the ewftools.}
+\f0\fs24 \cf0 This will install a universal build of libewf 20091114 and the ewftools.}
diff --git a/macosx/License.rtf b/macosx/License.rtf
index 23d697f..741a801 100644
--- a/macosx/License.rtf
+++ b/macosx/License.rtf
@@ -14,7 +14,7 @@
 {\*\pgdsctbl
 {\pgdsc0\pgdscuse195\pgwsxn12240\pghsxn15840\marglsxn1440\margrsxn1440\margtsxn1440\margbsxn1440\pgdscnxt0 Standard;}}
 {\*\pgdscno0}\paperh15840\paperw12240\margl1440\margr1440\margt1440\margb1440\sectd\sbknone\pgwsxn12240\pghsxn15840\marglsxn1440\margrsxn1440\margtsxn1440\margbsxn1440\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
-\pard\plain \ltrpar\s1\cf0\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs24\lang255\ltrch\dbch\af1\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 Copyright (c) 2006-2008, Joachim Metz <forensics at hoffmannbv.nl>, Hoffmann Investigations. All rights reserved.}
+\pard\plain \ltrpar\s1\cf0\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs24\lang255\ltrch\dbch\af1\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 Copyright (c) 2006-2009, Joachim Metz <forensics at hoffmannbv.nl>, Hoffmann Investigations. }
 \par \pard\plain \ltrpar\s1\cf0\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs24\lang255\ltrch\dbch\af1\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 
 \par \pard\plain \ltrpar\s1\cf0\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs24\lang255\ltrch\dbch\af1\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 Refer to AUTHORS for acknowledgements.}
 \par \pard\plain \ltrpar\s1\cf0\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs24\lang255\ltrch\dbch\af1\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 
@@ -30,4 +30,4 @@
 \par \pard\plain \ltrpar\s1\cf0\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs24\lang255\ltrch\dbch\af1\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 \'0d}
 \par \pard\plain \ltrpar\s1\cf0\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs24\lang255\ltrch\dbch\af1\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 You should have received a copy of the GNU Lesser General Public License\'0d}
 \par \pard\plain \ltrpar\s1\cf0\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs24\lang255\ltrch\dbch\af1\langfe255\hich\f1\fs24\lang1033\loch\f1\fs24\lang1033 {\rtlch \ltrch\loch\f1\fs24\lang1033\i0\b0 along with this software.  If not, see <http://www.gnu.org/licenses/>.\'0d}
-\par }
\ No newline at end of file
+\par }
diff --git a/macosx/libewf.pmproj b/macosx/libewf.pmproj
index 4003b28..cc5cbae 100644
Binary files a/macosx/libewf.pmproj and b/macosx/libewf.pmproj differ
diff --git a/manuals/ewfacquire.1 b/manuals/ewfacquire.1
index 86ffea7..dcf53c9 100644
--- a/manuals/ewfacquire.1
+++ b/manuals/ewfacquire.1
@@ -1,4 +1,4 @@
-.Dd October 3, 2009
+.Dd October 17, 2009
 .Dt ewfacquire
 .Os libewf
 .Sh NAME
@@ -61,7 +61,7 @@ the source file or device
 The options are as follows:
 .Bl -tag -width Ds
 .It Fl A Ar codepage
-the codepage of header section, options: ascii (default), windows-1250, windows-1251, windows-1252, windows-1253, windows-1254, windows-1255, windows-1256, windows-1257, windows-1258
+the codepage of header section, options: ascii (default), windows-874, windows-1250, windows-1251, windows-1252, windows-1253, windows-1254, windows-1255, windows-1256, windows-1257, windows-1258
 .It Fl b Ar amount_of_sectors
 the amount of sectors to read at once (per chunk), options: 64 (default), 128, 256, 512, 1024, 2048, 4096, 8192, 16384 or 32768
 .It Fl B Ar amount_of_bytes
diff --git a/manuals/ewfacquirestream.1 b/manuals/ewfacquirestream.1
index 3eefe1b..7d81134 100644
--- a/manuals/ewfacquirestream.1
+++ b/manuals/ewfacquirestream.1
@@ -1,4 +1,4 @@
-.Dd October 3, 2009
+.Dd October 17, 2009
 .Dt ewfacquirestream
 .Os libewf
 .Sh NAME
@@ -48,7 +48,7 @@ allows you to read and write media data in the EWF format.
 The options are as follows:
 .Bl -tag -width Ds
 .It Fl A Ar codepage
-the codepage of header section, options: ascii (default), windows-1250, windows-1251, windows-1252, windows-1253, windows-1254, windows-1255, windows-1256, windows-1257, windows-1258
+the codepage of header section, options: ascii (default), windows-874, windows-1250, windows-1251, windows-1252, windows-1253, windows-1254, windows-1255, windows-1256, windows-1257, windows-1258
 .It Fl b Ar amount_of_sectors
 the amount of sectors to read at once (per chunk), options: 64 (default), 128, 256, 512, 1024, 2048, 4096, 8192, 16384 or 32768
 .It Fl B Ar amount_of_bytes
diff --git a/manuals/ewfexport.1 b/manuals/ewfexport.1
index 4773165..fc056ba 100644
--- a/manuals/ewfexport.1
+++ b/manuals/ewfexport.1
@@ -1,4 +1,4 @@
-.Dd October 3, 2009
+.Dd October 17, 2009
 .Dt ewfexport
 .Os libewf
 .Sh NAME
@@ -41,7 +41,7 @@ the first or the entire set of EWF segment files
 The options are as follows:
 .Bl -tag -width Ds
 .It Fl A Ar codepage
-the codepage of header section, options: ascii (default), windows-1250, windows-1251, windows-1252, windows-1253, windows-1254, windows-1255, windows-1256, windows-1257, windows-1258
+the codepage of header section, options: ascii (default), windows-874, windows-1250, windows-1251, windows-1252, windows-1253, windows-1254, windows-1255, windows-1256, windows-1257, windows-1258
 .It Fl B Ar amount_of_bytes
 the amount of bytes to export
 .It Fl c Ar compression_type
diff --git a/manuals/ewfinfo.1 b/manuals/ewfinfo.1
index 5a1748b..fb6c191 100644
--- a/manuals/ewfinfo.1
+++ b/manuals/ewfinfo.1
@@ -1,4 +1,4 @@
-.Dd October 3, 2009
+.Dd October 17, 2009
 .Dt ewfinfo
 .Os libewf
 .Sh NAME
@@ -33,7 +33,7 @@ the first or the entire set of EWF segment files
 The options are as follows:
 .Bl -tag -width Ds
 .It Fl A Ar codepage
-the codepage of header section, options: ascii (default), windows-1250, windows-1251, windows-1252, windows-1253, windows-1254, windows-1255, windows-1256, windows-1257, windows-1258
+the codepage of header section, options: ascii (default), windows-874, windows-1250, windows-1251, windows-1252, windows-1253, windows-1254, windows-1255, windows-1256, windows-1257, windows-1258
 .It Fl d Ar date_format
 the date format, options: ctime (default), dm (day/month), md (month/day), iso8601
 .It Fl e
diff --git a/manuals/ewfverify.1 b/manuals/ewfverify.1
index 5a1459f..3b43c02 100644
--- a/manuals/ewfverify.1
+++ b/manuals/ewfverify.1
@@ -1,4 +1,4 @@
-.Dd October 3, 2009
+.Dd October 17, 2009
 .Dt ewfverify
 .Os libewf
 .Sh NAME
@@ -35,7 +35,7 @@ the first or the entire set of EWF segment files
 The options are as follows:
 .Bl -tag -width Ds
 .It Fl A Ar codepage
-the codepage of header section, options: ascii (default), windows-1250, windows-1251, windows-1252, windows-1253, windows-1254, windows-1255, windows-1256, windows-1257, windows-1258
+the codepage of header section, options: ascii (default), windows-874, windows-1250, windows-1251, windows-1252, windows-1253, windows-1254, windows-1255, windows-1256, windows-1257, windows-1258
 .It Fl d Ar digest_type
 calculate additional digest (hash) types besides md5, options: sha1
 .It Fl h
diff --git a/manuals/libewf.3 b/manuals/libewf.3
index 67a7f6e..fd513e2 100644
--- a/manuals/libewf.3
+++ b/manuals/libewf.3
@@ -1,4 +1,4 @@
-.Dd October 3, 2009
+.Dd October 30, 2009
 .Dt libewf 3
 .Os libewf
 .Sh NAME
@@ -49,7 +49,7 @@ Available when compiled with wide character string support:
 .Pp
 Available when compiled with libbfio support:
 .Ft int
-.Fn libewf_check_file_signature_file_io_handle "libbfio_handle_t *bfio_handle, libewf_error_t **error"
+.Fn libewf_check_file_signature_file_io_handle "libbfio_handle_t *file_io_handle, libewf_error_t **error"
 .Pp
 Notify functions (APIv1)
 .Ft void
diff --git a/msvscpp/Makefile.am b/msvscpp/Makefile.am
index 76a516f..7455d32 100644
--- a/msvscpp/Makefile.am
+++ b/msvscpp/Makefile.am
@@ -1,7 +1,6 @@
 EXTRA_DIST = \
 	ewfacquire/ewfacquire.vcproj \
 	ewfacquirestream/ewfacquirestream.vcproj \
-	ewfalter/ewfalter.vcproj \
 	ewfexport/ewfexport.vcproj \
 	ewfinfo/ewfinfo.vcproj \
 	ewfverify/ewfverify.vcproj \
diff --git a/msvscpp/Makefile.in b/msvscpp/Makefile.in
index 991c11a..cd8caf3 100644
--- a/msvscpp/Makefile.in
+++ b/msvscpp/Makefile.in
@@ -212,7 +212,6 @@ top_srcdir = @top_srcdir@
 EXTRA_DIST = \
 	ewfacquire/ewfacquire.vcproj \
 	ewfacquirestream/ewfacquirestream.vcproj \
-	ewfalter/ewfalter.vcproj \
 	ewfexport/ewfexport.vcproj \
 	ewfinfo/ewfinfo.vcproj \
 	ewfverify/ewfverify.vcproj \
diff --git a/msvscpp/ewfalter/ewfalter.vcproj b/msvscpp/ewfalter/ewfalter.vcproj
deleted file mode 100644
index 94bc0d6..0000000
--- a/msvscpp/ewfalter/ewfalter.vcproj
+++ /dev/null
@@ -1,170 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="9,00"
-	Name="ewfalter"
-	ProjectGUID="{DB9753F2-57F5-4C1A-8A40-06D32359562D}"
-	RootNamespace="ewfacquire"
-	Keyword="Win32Proj"
-	TargetFrameworkVersion="131072"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="1"
-			CharacterSet="1"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\include;..\..\common;..\..\liberror;..\..\libuna;..\..\libbfio;..\..\libsystem;..\zlib\include"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;HAVE_LOCAL_LIBUNA;HAVE_LOCAL_LIBBFIO;LIBEWF_DLL_IMPORT"
-				RuntimeLibrary="2"
-				UsePrecompiledHeader="0"
-				WarningLevel="4"
-				Detect64BitPortabilityProblems="false"
-				DebugInformationFormat="3"
-				CompileAs="1"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="advapi32.lib"
-				LinkIncremental="1"
-				AdditionalLibraryDirectories=""$(OutDir)""
-				GenerateDebugInformation="true"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<File
-				RelativePath="..\..\ewftools\alteration_handle.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\ewftools\byte_size_string.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\ewftools\ewfalter.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\ewftools\ewfinput.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\ewftools\ewfoutput.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\ewftools\storage_media_buffer.c"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-			<File
-				RelativePath="..\..\ewftools\alteration_handle.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\ewftools\byte_size_string.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\ewftools\ewfcommon.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\ewftools\ewfinput.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\ewftools\ewfoutput.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\ewftools\storage_media_buffer.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-			>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
diff --git a/msvscpp/libewf.sln b/msvscpp/libewf.sln
index 730d3ea..49da427 100644
--- a/msvscpp/libewf.sln
+++ b/msvscpp/libewf.sln
@@ -49,14 +49,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ewfacquirestream", "ewfacqu
 		{BD3A95FA-A3DE-4B79-A889-A7E5ECA4B69C} = {BD3A95FA-A3DE-4B79-A889-A7E5ECA4B69C}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ewfalter", "ewfalter\ewfalter.vcproj", "{DB9753F2-57F5-4C1A-8A40-06D32359562D}"
-	ProjectSection(ProjectDependencies) = postProject
-		{B5225323-AC67-411D-8FBA-199E9467FAB5} = {B5225323-AC67-411D-8FBA-199E9467FAB5}
-		{BC27FF34-C859-4A1A-95D6-FC89952E1910} = {BC27FF34-C859-4A1A-95D6-FC89952E1910}
-		{A2B861D5-6751-43A9-B085-8D48F8754AC5} = {A2B861D5-6751-43A9-B085-8D48F8754AC5}
-		{BD3A95FA-A3DE-4B79-A889-A7E5ECA4B69C} = {BD3A95FA-A3DE-4B79-A889-A7E5ECA4B69C}
-	EndProjectSection
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbfio", "libbfio\libbfio.vcproj", "{41CFAFBF-A1C8-4704-AFEF-31979E6452B9}"
 	ProjectSection(ProjectDependencies) = postProject
 		{BC27FF34-C859-4A1A-95D6-FC89952E1910} = {BC27FF34-C859-4A1A-95D6-FC89952E1910}
@@ -98,8 +90,6 @@ Global
 		{7D57918B-6B13-4F5D-BA51-04BB6047A91C}.Release|Win32.Build.0 = Release|Win32
 		{A7DD27F1-73B6-447B-ADF4-424518923A98}.Release|Win32.ActiveCfg = Release|Win32
 		{A7DD27F1-73B6-447B-ADF4-424518923A98}.Release|Win32.Build.0 = Release|Win32
-		{DB9753F2-57F5-4C1A-8A40-06D32359562D}.Release|Win32.ActiveCfg = Release|Win32
-		{DB9753F2-57F5-4C1A-8A40-06D32359562D}.Release|Win32.Build.0 = Release|Win32
 		{41CFAFBF-A1C8-4704-AFEF-31979E6452B9}.Release|Win32.ActiveCfg = Release|Win32
 		{41CFAFBF-A1C8-4704-AFEF-31979E6452B9}.Release|Win32.Build.0 = Release|Win32
 		{BC27FF34-C859-4A1A-95D6-FC89952E1910}.Release|Win32.ActiveCfg = Release|Win32
diff --git a/msvscpp/libewf_dll/libewf_dll.vcproj b/msvscpp/libewf_dll/libewf_dll.vcproj
index 9a30113..7ee101c 100644
--- a/msvscpp/libewf_dll/libewf_dll.vcproj
+++ b/msvscpp/libewf_dll/libewf_dll.vcproj
@@ -118,6 +118,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\libewf\libewf_empty_block.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\libewf\libewf_error.c"
 				>
 			</File>
@@ -288,6 +292,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\libewf\libewf_codepage.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\libewf\libewf_compression.h"
 				>
 			</File>
@@ -308,6 +316,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\libewf\libewf_empty_block.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\libewf\libewf_error.h"
 				>
 			</File>
diff --git a/msvscpp/libuna/libuna.vcproj b/msvscpp/libuna/libuna.vcproj
index 2071486..91a8967 100644
--- a/msvscpp/libuna/libuna.vcproj
+++ b/msvscpp/libuna/libuna.vcproj
@@ -85,6 +85,14 @@
 			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
 			>
 			<File
+				RelativePath="..\..\libuna\libuna_base64_stream.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\libuna\libuna_base64url_stream.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\libuna\libuna_byte_stream.c"
 				>
 			</File>
@@ -231,6 +239,14 @@
 			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
 			>
 			<File
+				RelativePath="..\..\libuna\libuna_base64_stream.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\libuna\libuna_base64url_stream.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\libuna\libuna_byte_stream.h"
 				>
 			</File>

-- 
debian-forensics/libewf



More information about the forensics-changes mailing list