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

2.0 Series
Amir Szekely
General (292)

Source/Platform.h contains definitions that used to be

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).


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.


  • Amir Szekely
    Amir Szekely

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

    Logged In: YES

    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.