Commits

Anonymous committed d37062f

Tweaks so that UI appears correct on 64-bit Windows.

Comments (0)

Files changed (4)

Contrib/Makensisw/toolbar.cpp

     NULL );
   
   SendMessage(g_toolbar.hwnd, TB_BUTTONSTRUCTSIZE, sizeof(tbButton[0]), 0);
-  SendMessage(g_toolbar.hwnd, TB_ADDBUTTONS, BUTTONCOUNT, (LONG) &tbButton);
+  SendMessage(g_toolbar.hwnd, TB_ADDBUTTONS, BUTTONCOUNT, (LONG_PTR) &tbButton);
 
   // For Comctl32.dll version detection
   HMODULE hMod = GetModuleHandle(_T("comctl32.dll"));

Source/exehead/exec.c

 
 static int NSISCALL GetIntFromParm(int id_)
 {
+  return (int)myatoi(GetNSISStringTT(parms[id_]));
+}
+
+static int NSISCALL GetIntPtrFromParm(int id_)
+{
   return myatoi(GetNSISStringTT(parms[id_]));
 }
 
     case EW_SENDMESSAGE:
       {
         int v;
-        int b3=GetIntFromParm(3);
-        int b4=GetIntFromParm(4);
-        if (parm5&1) b3=(int)GetStringFromParm(0x33);
-        if (parm5&2) b4=(int)GetStringFromParm(0x44);
+        INT_PTR b3=GetIntPtrFromParm(3);
+        INT_PTR b4=GetIntPtrFromParm(4);
+        if (parm5&1) b3=(INT_PTR)GetStringFromParm(0x33);
+        if (parm5&2) b4=(INT_PTR)GetStringFromParm(0x44);
 
         if (which == EW_SENDMESSAGE)
         {
-          HWND hwnd=(HWND)GetIntFromParm(1);
+          HWND hwnd=(HWND)GetIntPtrFromParm(1);
           int msg=GetIntFromParm(2);
 
           if (parm5>>2) exec_error += !SendMessageTimeout(hwnd,msg,b3,b4,SMTO_NORMAL,parm5>>2,(LPDWORD)&v);
       }
     break;
     case EW_ISWINDOW:
-      if (IsWindow((HWND)GetIntFromParm(0))) return parm1;
+      if (IsWindow((HWND)GetIntPtrFromParm(0))) return parm1;
     return parm2;
 #ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT
     case EW_GETDLGITEM:
       myitoa(
         var0,
-        (int)GetDlgItem(
-          (HWND)GetIntFromParm(1),
+        (INT_PTR)GetDlgItem(
+          (HWND)GetIntPtrFromParm(1),
           GetIntFromParm(2)
         )
       );
     case EW_SETCTLCOLORS:
     {
       ctlcolors *c = (ctlcolors *)(g_blocks[NB_CTLCOLORS].offset + parm1);
-      SetWindowLongPtr((HWND) GetIntFromParm(0), GWLP_USERDATA, (LONG_PTR) c);
+      SetWindowLongPtr((HWND) GetIntPtrFromParm(0), GWLP_USERDATA, (LONG_PTR) c);
     }
     break;
     case EW_SETBRANDINGIMAGE:
     break;
     case EW_SHOWWINDOW:
     {
-      HWND hw=(HWND)GetIntFromParm(0);
+      HWND hw=(HWND)GetIntPtrFromParm(0);
       int a=GetIntFromParm(1);
       if (parm2) log_printf(_T("HideWindow"));
       if (!parm3)

Source/exehead/util.c

   }
 }
 
-void NSISCALL myitoa(TCHAR *s, int d)
+void NSISCALL myitoa(TCHAR *s, INT_PTR d)
 {
+#ifdef _WIN64
+  static const TCHAR c[] = _T("%I64d");
+#else
   static const TCHAR c[] = _T("%d");
+#endif
   wsprintf(s,c,d);
 }
 
-int NSISCALL myatoi(TCHAR *s)
+INT_PTR NSISCALL myatoi(TCHAR *s)
 {
-  unsigned int v=0;
-  int sign=1; // sign of positive
+  UINT_PTR v=0;
+  INT_PTR sign=1; // sign of positive
   TCHAR m=10; // base of 10
   TCHAR t=_T('9'); // cap top of numbers at 9
 

Source/exehead/util.h

 #define GetNSISTab(strtab) (strtab < 0 ? LANG_STR_TAB(strtab) : strtab)
 
 void NSISCALL myRegGetStr(HKEY root, const TCHAR *sub, const TCHAR *name, TCHAR *out, int x64);
-int NSISCALL myatoi(TCHAR *s);
-void NSISCALL myitoa(TCHAR *s, int d);
+INT_PTR NSISCALL myatoi(TCHAR *s);
+void NSISCALL myitoa(TCHAR *s, INT_PTR d);
 TCHAR * NSISCALL mystrcpy(TCHAR *out, const TCHAR *in);
 int NSISCALL mystrlen(const TCHAR *in);
 TCHAR * NSISCALL mystrcat(TCHAR *out, const TCHAR *concat);