Menu

#488 Sources/Platform.h type definitions are not 64bit-safe

2.0 Series
closed-fixed
General (291)
5
2006-07-30
2006-06-12
No

Source/Platform.h contains definitions that used to be
platform-independent,

Instead, they ARE platform dependent. That leads to
various errors.

For example, DWORD is supposed to be 32bit long (it's
widely used in file headers, where width of a field
MUST BE fixed).

But it is declared as unsigned long, that is 64bit on
x86_64 Linux platform. This leads to file header
corruption when reading.

There is also UINT_PTR (which I suppose, can contain
pointer to void without loss of precision).

It is declared as unsigned int (which is 32bits wide).
But on 64bit systems, pointer is 64bit, and when it is
cast to UINT_PTR, upper 32bits are lost.

I suggest declaring UINT_PTR as unsigned long as
quick-and-dirty hack (until you wish to port NSIS to
Windows x64, where long is still 32bit).

Summary:

I suggest that DWORD and *LPDWORD types declared in
Source/Platform.h must be UINT32 or unsigned int.

UINT_PTR type must be unsigned long.

Discussion

  • Amir Szekely

    Amir Szekely - 2006-07-30
    • assigned_to: nobody --> kichik
    • status: open --> closed-fixed
     
  • Amir Szekely

    Amir Szekely - 2006-07-30

    Logged In: YES
    user_id=584402

    For now I've changed DWORD to unsigned int and left UINT_PTR
    alone as it's not used. However, as I recall, some platforms
    have int as a 16-bit integer. Those are probably some older
    16-bit platforms. I guess it'd be better to have AMD64
    working now instead of those. At least until a better
    solution, like uint32_t, comes around or someone submits a
    bug report about DWORD being 16-bit.

     

Log in to post a comment.