Re: [sleuthkit-developers] win32 live bugs?
Brought to you by:
carrier
From: David C. <dav...@gm...> - 2008-07-29 05:02:18
|
Sorry, accidentally sent that early. mingw has gethostname AFAIK, this sample compiles for me: #include <winsock2.h> int main(void) { char name[255]; gethostname(name, 1); return 0; } compile with: i586-mingw32msvc-gcc -o test.exe test.c -lws2_32 Dave > > > On Wed, Jul 23, 2008 at 9:02 PM, Michael Cohen <scu...@gm...> wrote: >> Forgot to reply to list first, so here is a retransmission: >> >> Hi Brian, >> Its already there since you are using autoconf it can cross compile >> for free. There are some tweaks you need to do to make sk itself >> compile cleanly. I will summarise these here: >> >> 1) Have mingw installed on your linux box (apt-get install mingw32) >> 2) Give configure the x compile flags: >> >> ./configure --host=i586-mingw32msvc >> >> 3) tsk_base.h specifically removes autoconf support on windows - which >> defeats the whole purpose of having autoconf - so you need to make it >> use it: >> >> #if defined(__MINGW32__) || (!defined(_WIN32) && !defined (__WIN32__)) >> #include "tsk/tsk_incs.h" >> #endif >> >> 4) In tsk_os.h you need to tweak some things specific to mingw: >> >> The section in >> #if defined(_WIN32) || defined (__WIN32__) >> should be inserted into #ifndef __MINGW32__ >> should not be included because most of that stuff is msvc hacks. >> Instead add the defines for mingw: >> >> #ifdef __MINGW32__ >> #define roundup(x, y) \ >> ( ( ((x)+((y) - 1)) / (y)) * (y) ) >> >> #define HAVE_GETHOSTNAME >> #include <windows.h> >> int gethostname_mingw (char *, size_t); >> >> #define gethostname gethostname_mingw >> #define strtok_r(a,b,c) strtok(a,b) >> #define fseeko fseek >> #define daddr_t int >> >> #endif >> >> The biggest problem is that windows does not have a gethostname >> function, instead you need to put an implementation of it like: >> >> #ifdef __MINGW32__ >> int >> gethostname_mingw (char *name, size_t len) >> { >> DWORD dlen = len; >> return (GetComputerName (name, &dlen) ? 0 : -1); >> } >> #endif >> >> Into one of the .c files (maybe you can think of a better place to put it). >> >> 5) make -j2 will build everything >> >> Let me know if you have any problems >> >> Michael. >> >> On Wed, Jul 23, 2008 at 12:53 AM, Brian Carrier <ca...@sl...> wrote: >>> Hi Michael, >>> >>> I received at least one inquery about mingw-gcc support. I haven't had a >>> chance to look into it though. What would be required to add support for it >>> into TSK? >>> >>> brian >>> >>> On Jul 21, 2008, at 8:47 PM, Michael Cohen wrote: >>> >>>> Brian, >>>> Would there be any interest in sharing the gcc produced binaries >>>> which can be easily cross compiled form the main source distribution. >>>> These are static and dont use MFC at all and are very small - they use >>>> mingw-gcc and run natively with no dlls required. >>>> >>>> Michael. >>>> >>>> On Tue, Jul 22, 2008 at 6:37 AM, Brian Carrier <ca...@sl...> >>>> wrote: >>>>> >>>>> On Jul 21, 2008, at 4:20 PM, Darren Bilby wrote: >>>>> >>>>>> Thanks for taking a look at this, replies inline. >>>>>> >>>>>> Darren. >>>>>> >>>>>> On Mon, Jul 21, 2008 at 6:37 PM, Brian Carrier >>>>>> <ca...@sl...> wrote: >>>>>>> >>>>>>> Ok, I'll add a variation of this in, but only if the path has the >>>>>>> form of >>>>>>> "\\.\?:" because I don't want random WRITE opens occurring for >>>>>>> image files. >>>>>> >>>>>> Note that the FILE_SHARE_WRITE designation doesn't open the file for >>>>>> writing, it designates how others should be able to access it, but >>>>>> this seems sensible anyway. >>>>>> http://msdn.microsoft.com/en-us/library/aa363874(VS.85).aspx >>>>>> http://blogs.msdn.com/larryosterman/archive/2004/05/13/131263.aspx >>>>> >>>>> Ahh, even better. I had forgotten what each of the arguments to >>>>> CreateFile meant. >>>>> >>>>> >>>>>>> >>>>>>>> 3. When recompiling with VS 2005 i get some errors on execution on >>>>>>>> some hosts due to wrong versions of the msvc libs. Is there any >>>>>>>> reason >>>>>>>> we don't compile these libs in statically by default? given the >>>>>>>> use of >>>>>>>> these binaries it seems sensible and it only marginally affects the >>>>>>>> size. >>>>>>> >>>>>>> Can you compile them in statically? I didn't think you could. >>>>>> >>>>>> I figured it should be possible so went looking and found "Use of >>>>>> MFC" under: >>>>>> Project Properties -> Configuration Properties -> General -> Use of >>>>>> MFC >>>>>> Setting that to "Use MFC in a Static Library" for each sleuthkit >>>>>> project and recompiling it appears to work perfectly. >>>>>> Searching after the fact I found: >>>>>> http://msdn.microsoft.com/en-us/library/ms235264(VS.80).aspx >>>>>> http://msdn.microsoft.com/en-us/library/ms235316(VS.80).aspx >>>>>> Which advises against it, but I don't see any of the downsides being >>>>>> applicable in this instance. >>>>>> I did this under VC++ Express 2k8, but seems like it should work on >>>>>> any VS. >>>>> >>>>> If there is a large desire to do this, I will consider it more, but >>>>> if you are building your own executables then you probably should be >>>>> using the MFC dlls from your compiler and not using the ones that I >>>>> ship with the pre-built executables (which could be a different >>>>> version). >>>>> >>>>> thanks, >>>>> brian >>>>> >>>>> >>>>> >>>>> ------------------------------------------------------------------------- >>>>> This SF.Net email is sponsored by the Moblin Your Move Developer's >>>>> challenge >>>>> Build the coolest Linux based applications with Moblin SDK & win great >>>>> prizes >>>>> Grand prize is a trip for two to an Open Source event anywhere in the >>>>> world >>>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >>>>> _______________________________________________ >>>>> sleuthkit-developers mailing list >>>>> sle...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/sleuthkit-developers >>>>> >>> >>> >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge >> Build the coolest Linux based applications with Moblin SDK & win great prizes >> Grand prize is a trip for two to an Open Source event anywhere in the world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> sleuthkit-developers mailing list >> sle...@li... >> https://lists.sourceforge.net/lists/listinfo/sleuthkit-developers >> > |