Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#2 patch for Windows

closed-accepted
Len Sassaman
None
7
2001-12-11
2001-11-01
Disastry
No

This is a patch allows compile mix with MSVC and
run it as Service (daemon) on Windows NT/2K

Discussion

  • Disastry
    Disastry
    2001-11-01

    patch for Windows

     
    Attachments
  • Len Sassaman
    Len Sassaman
    2001-11-02

    • assigned_to: nobody --> rabbi
    • priority: 5 --> 3
    • status: open --> closed-postponed
     
  • Len Sassaman
    Len Sassaman
    2001-11-02

    Logged In: YES
    user_id=29569

    I'm hesitant to put this into the main Mixmaster
    distribution. I'm considering either placing it in its own
    directory in the tarball with instructions on patching for
    use with MSVC, or spinning out a canned MSVC
    version.

    (I don't have the ability to thoroughly test and verify this
    patch myself.)

    For now, I'll point people to your site to get this patch,
    though, if they want to use Mixmaster on Windows.

     
  • Disastry
    Disastry
    2001-11-02

    Logged In: YES
    user_id=363885

    mixmasters code already have some files and functions
    that are used only on windows. and they contains bugs (for
    example in opendir() and readdir() functions).

    I don't think that it is good to have separete windows
    version.

    All windows code are inside #ifdefs so there should not
    be any problems un unix.

     
  • Len Sassaman
    Len Sassaman
    2001-11-02

    Logged In: YES
    user_id=29569

    You've made a few changes that aren't #ifdef'd -- are
    these changes directly related to the Windows Service
    code?

    Also, what's the license requirements for serivice.c?
    Can we legally include this code?

     
  • Len Sassaman
    Len Sassaman
    2001-11-02

    • status: closed-postponed --> pending-postponed
     
  • Disastry
    Disastry
    2001-11-04

    • status: pending-postponed --> open-postponed
     
  • Disastry
    Disastry
    2001-11-04

    Logged In: YES
    user_id=363885

    > You've made a few changes that aren't #ifdef'd

    Only changes that aren't in #ifdefs is in pgpcreat.c.
    but the

    assert (pgp_getpacket(msg, d) == PGP_PUBKEY);

    does exactly the same as

    type1 = pgp_getpacket(msg, d);
    assert (type1 == PGP_PUBKEY);

    So I did not feel the need to use #ifdef.

    It can also be written as

    type1 = pgp_getpacket(msg, d) == PGP_PUBKEY;
    assert (type1);

    If you like it better... maybe even it is better.

    The problem was that assert in windows (MSVC)
    is defined as:

    #ifdef NDEBUG
    #define assert(exp) ((void)0)
    #else
    void __cdecl _assert(void *, void *, unsigned);
    #endif

    So when compiling release (with NDEBUG defined)
    assert's parameter is ignored and because parameter
    contains call to pgp_getpacket(msg, d),
    pgp_getpacket is not called and d does not get value,
    but d is used later in buf_appendi(msg, d->length);.

    Another reason not to use #ifdef here is possibility that
    there may be some other compilers that defines assert()
    the same way

    Other changes that are not #ifdef'd are related to DIRSEP
    (directory separator). but DIRSEP itself is in #ifdef:

    #ifdef _MSC
    #define snprintf _snprintf
    #endif
    #define DIRSEP '\\'
    #define DIRSEPSTR "\\"
    #else
    #define DIRSEP '/'
    #define DIRSEPSTR "/"

    > are these changes directly related to the Windows Service
    > code?

    no, all Windows Service code is inside #ifdef WIN32SERVICE
    (except service.c and service.h)

    > Also, what's the license requirements for serivice.c?
    > Can we legally include this code?

    This my be a problem... This code is from MSVC sample. It is
    ok to use this code if you have (licensed) MSVC. But I don't
    know if it is ok to use it with different compiler (Borland,
    for example) and distribute it.
    Maybe I should write my own service.c....

    So for now I think it's ok to apply other changes but
    service.c/h and ones in #ifdef WIN32SERVICE.

     
  • Len Sassaman
    Len Sassaman
    2001-11-07

    Logged In: YES
    user_id=29569

    Changes are in CVS, with the exception of service.c and
    service.h.

    Are you planning on writing replacements for those two
    files?

     
  • Len Sassaman
    Len Sassaman
    2001-11-07

    • priority: 3 --> 7
     
  • Len Sassaman
    Len Sassaman
    2001-11-07

    Logged In: YES
    user_id=29569

    Apache appears to include service.c and service.h
    (heavily modified, but derived from the same code as
    the ones you provided) in its source for WinNT.

    This would appear promising.

     
  • Lucky Green
    Lucky Green
    2001-12-10

    Logged In: YES
    user_id=391215

    The standard MSVC sample code license allows you to use
    their sample code anyway you please:

    ---
    This sample code is made available by Microsoft
    Corporation on an as-is basis. Anyone receiving this code
    is considered to be licensed under Microsoft copyrights to
    use the Microsoft-provided source code in any way he or
    she deems fit, including copying it, compiling it,
    modifying it, and redistributing it, with or without
    modifications. No license under any Microsoft patents or
    patent applications is to be implied from this copyright
    license.

    A user of this sample code should understand that
    Microsoft cannot provide technical support for the code
    and will not be responsible for any consequences of its
    use.
    -------

    Did you happen to get this code from
    http://msdn.microsoft.com/library/default.asp?
    url=/library/en-us/dnwbgen/html/msdn_ntservic.asp

     
  • Len Sassaman
    Len Sassaman
    2001-12-11

    Logged In: YES
    user_id=29569

    service.c and service.h added to CVS as-is. Will be in
    the next build.

     
  • Len Sassaman
    Len Sassaman
    2001-12-11

    • status: open-postponed --> closed-accepted
     
  • Disastry
    Disastry
    2001-12-11

    new patch for Windows

     
    Attachments
  • Disastry
    Disastry
    2001-12-11

    Logged In: YES
    user_id=363885

    I finally have made new service.c

    it is better than old one,
    for example now pipes (_popen) works from service too,
    now it checks if it is started as service or not (no extra
    commandline option needed)

    I also moved code from main.c that don't belong there
    out to service.c.
    service.h is no longer needed..

    this patch is for mix-2.9b32, not for the CVS version.