Can NSIS DumpLog be used with 64 bit version?


I'm using the 64 bit build of NSIS and everything works except the DumpLog function to write the install log to a file.

(NSIS 64 is here:

DumpLog uses Windows messages to get the text value and it seems the calls are 32 bit only.

Here's an example of the function:

It defines these which are incorrect for 64 bit:

!define LVM_GETITEMCOUNT 0x1004
!define LVM_GETITEMTEXT 0x1073

I found the 64 bit version of LVM_GETITEMCOUNT which is 0x00001004.

Has anyone got this function to with 64 bit?

asked on Stack Overflow Mar 5, 2014 by sproketboy • edited Mar 5, 2014 by Charles

1 Answer


The bitbucket port does not support calling arbitrary functions with System::Call and that DumpLog function is also not 64 bit compatible because it uses the i type when p is required and there are some additional padding issues.

Here is a 64 bit compatible version:

!define LVM_GETITEMCOUNT 0x1004
!define LVM_GETITEMTEXT 0x1073
Function DumpLog
  Exch $5
  Push $0
  Push $1
  Push $2
  Push $3
  Push $4
  Push $6
  Push $7
  FindWindow $0 "#32770" "" $HWNDPARENT
  GetDlgItem $0 $0 1016
  StrCmp $0 0 error
  FileOpen $5 $5 "w"
  FileWriteWord $5 0xfeff ; Write the BOM
  StrCmp $5 0 error
    SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6
    System::Call "*(&t${NSIS_MAX_STRLEN})p.r3"
    System::Call "*(i0,i0,i0,i0,&i${NSIS_PTR_SIZE} 0,p$3,i${NSIS_MAX_STRLEN},i0,p0)p.r1" ; NSIS_PTR_SIZE is used to align the pszText member on x64
    StrCpy $2 0
    loop: StrCmp $2 $6 done
      System::Call "User32::SendMessage(p$0,i${LVM_GETITEMTEXT},p$2,pr1)p"
      System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)"
      FileWriteUTF16LE $5 "$4$\r$\n"
      IntOp $2 $2 + 1
      Goto loop
      FileClose $5
      System::Free $1
      System::Free $3
      Goto exit
    MessageBox MB_OK|MB_ICONSTOP "Error at DumpLog"
    Pop $7
    Pop $6
    Pop $4
    Pop $3
    Pop $2
    Pop $1
    Pop $0
    Exch $5

You need a version of System.dll that is able to call arbitrary functions and I'm afraid the only way to get that is to compile the official SVN trunk as 64 bit.

(Since StackOverflow does not support file uploads you can rename this image AMD64 System.dll GIFAR to .zip and open it in 7Zip)

answered on Stack Overflow Mar 5, 2014 by Anders

User contributions licensed under CC BY-SA 3.0