On 09/03/2011 07:35 PM, Richard W.M. Jones wrote:
On Sat, Sep 03, 2011 at 04:45:28PM +0200, Gillen Daniel wrote:
Hi
I'm just posting this here in case someone is interested in building hivex on Windows (mingw32). The attached patch allows building the lib but not the tools (hivexsh etc..) as there are some more problems to solve.
In short terms, this patch replaces file i/o functions and mmap(), munmap() with their win32api pendants.
NACK ... This patch is too invasive.
We are already linking with gnulib, which ought to provide a degree of platform independence. By adding the right gnulib modules (see the file 'bootstrap' in the toplevel directory) it should be possible to make hivex compile directly on Windows, while requiring fewer source code changes.
gnulib can almost certainly do all the file things. I don't see a gnulib module for mmap, which could be a problem, but a less invasive change should still be possible for that.
Rich.
mmap is exactly the problem. I didn't find it in gnulib or somewhere else. I did some more research on how it could be done and I came up with the following. Definitely less invasive :) and full_read and full_write can be used again. What do you think about that one? Oh, and there is another problem which I encountered while building on Windows and on Osx 10.7. In Linux, "include/bits/byteswap.h" define __bswap_* functions and "include/byteswap.h" define those as bswap_*. Your "lib/byte_conversions.h" file uses the __bswap_* functions but when compiling on a system where byteswap.h does not exist and the gnulib byteswap.h file is used, there are no __bswap_* functions defined anymore resulting in the lib not being able to link. Is there a special reason the __bswap_* functions were used and not the bswap_* ones? -- Unix _IS_ user friendly - it's just selective about who its friends are!