Win64 fixes

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6413 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2013-09-06 23:48:59 +00:00
parent e23b3db418
commit e63fa6c53b
38 changed files with 389 additions and 331 deletions

View file

@ -11,7 +11,7 @@ BOOL bFailed;
TCHAR buf[1024];
BOOL CALLBACK BannerProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
INT_PTR CALLBACK BannerProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_INITDIALOG)
{
@ -42,7 +42,7 @@ BOOL CALLBACK BannerProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
DestroyWindow(hwndDlg);
}
return 0;
return FALSE;
}
BOOL ProcessMessages()

View file

@ -46,7 +46,7 @@ void NSISCALL pushstring(const TCHAR *str)
*g_stacktop=th;
}
TCHAR * NSISCALL getuservariable(const int varnum)
TCHAR* NSISCALL getuservariable(const int varnum)
{
if (varnum < 0 || varnum >= __INST_LAST) return NULL;
return g_variables+varnum*g_stringsize;
@ -159,9 +159,9 @@ void NSISCALL SetUserVariableW(const int varnum, const wchar_t* wideStr)
// playing with integers
int NSISCALL myatoi(const TCHAR *s)
INT_PTR NSISCALL nsishelper_str_to_ptr(const TCHAR *s)
{
int v=0;
INT_PTR v=0;
if (*s == _T('0') && (s[1] == _T('x') || s[1] == _T('X')))
{
s++;
@ -204,7 +204,7 @@ int NSISCALL myatoi(const TCHAR *s)
return v;
}
unsigned NSISCALL myatou(const TCHAR *s)
unsigned int NSISCALL myatou(const TCHAR *s)
{
unsigned int v=0;
@ -270,13 +270,12 @@ int NSISCALL myatoi_or(const TCHAR *s)
return v;
}
int NSISCALL popint()
INT_PTR NSISCALL popintptr()
{
TCHAR buf[128];
if (popstringn(buf,COUNTOF(buf)))
return 0;
return myatoi(buf);
return nsishelper_str_to_ptr(buf);
}
int NSISCALL popint_or()
@ -284,13 +283,12 @@ int NSISCALL popint_or()
TCHAR buf[128];
if (popstringn(buf,COUNTOF(buf)))
return 0;
return myatoi_or(buf);
}
void NSISCALL pushint(int value)
void NSISCALL pushintptr(INT_PTR value)
{
TCHAR buffer[1024];
wsprintf(buffer, _T("%d"), value);
TCHAR buffer[30];
wsprintf(buffer, sizeof(void*) > 4 ? _T("%Id") : _T("%d"), value);
pushstring(buffer);
}

View file

@ -56,16 +56,19 @@ extern unsigned int g_stringsize;
extern stack_t **g_stacktop;
extern TCHAR *g_variables;
void NSISCALL pushstring(const TCHAR *str);
void NSISCALL pushintptr(INT_PTR value);
#define pushint(v) pushintptr((INT_PTR)(v))
int NSISCALL popstring(TCHAR *str); // 0 on success, 1 on empty stack
int NSISCALL popstringn(TCHAR *str, int maxlen); // with length limit, pass 0 for g_stringsize
int NSISCALL popint(); // pops an integer
INT_PTR NSISCALL popintptr();
#define popint() ( (int) popintptr() )
int NSISCALL popint_or(); // with support for or'ing (2|4|8)
int NSISCALL myatoi(const TCHAR *s); // converts a string to an integer
unsigned NSISCALL myatou(const TCHAR *s); // converts a string to an unsigned integer, decimal only
INT_PTR NSISCALL nsishelper_str_to_ptr(const TCHAR *s);
#define myatoi(s) ( (int) nsishelper_str_to_ptr(s) ) // converts a string to an integer
unsigned int NSISCALL myatou(const TCHAR *s); // converts a string to an unsigned integer, decimal only
int NSISCALL myatoi_or(const TCHAR *s); // with support for or'ing (2|4|8)
void NSISCALL pushstring(const TCHAR *str);
void NSISCALL pushint(int value);
TCHAR * NSISCALL getuservariable(const int varnum);
TCHAR* NSISCALL getuservariable(const int varnum);
void NSISCALL setuservariable(const int varnum, const TCHAR *var);
#ifdef _UNICODE

View file

@ -32,7 +32,7 @@ struct lang {
UINT cp;
} *langs;
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
int i, size;
TCHAR *selected_language = NULL;

View file

@ -193,7 +193,7 @@ line sub[] = {
CBL(SUBLANG_UZBEK_CYRILLIC)
};
BOOL CALLBACK DialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) {
INT_PTR CALLBACK DialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) {
size_t i;
switch (uMsg) {
case WM_INITDIALOG:
@ -222,7 +222,7 @@ BOOL CALLBACK DialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) {
TCHAR *lang_id = (TCHAR *)GlobalLock(hMem);
wsprintf(lang_id, _T("%u"), MAKELANGID(primary[SendDlgItemMessage(hwndDlg, IDC_PRIMARY, CB_GETCURSEL, 0, 0)].id, sub[SendDlgItemMessage(hwndDlg, IDC_SUB, CB_GETCURSEL, 0, 0)].id));
GlobalUnlock(hMem);
if (!OpenClipboard(hwndDlg)) return 0;
if (!OpenClipboard(hwndDlg)) return FALSE;
EmptyClipboard();
#ifdef _UNICODE
SetClipboardData(CF_UNICODETEXT,hMem);
@ -234,7 +234,7 @@ BOOL CALLBACK DialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) {
}
break;
}
return 0;
return FALSE;
}
NSIS_ENTRYPOINT_GUINOCRT

View file

@ -16,7 +16,7 @@
#include "util.h"
#include "httpget.h"
void *operator new( unsigned int num_bytes ){return GlobalAlloc(GPTR,num_bytes);}
void *operator new( size_t num_bytes ){return GlobalAlloc(GPTR,num_bytes);}
void operator delete( void *p ) { if (p) GlobalFree(p); }
JNL_HTTPGet::JNL_HTTPGet(JNL_AsyncDNS *dns, int recvbufsize, char *proxy)

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="Nullsoft.NSIS.makensisw" type="win32"/>
<assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="Nullsoft.NSIS.makensisw" type="win32"/>
<description>MakeNSIS Wrapper</description>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" />
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" />
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">

View file

@ -30,7 +30,7 @@
#include <nsis/pluginapi.h> // nsis plugin
void *operator new( unsigned int num_bytes )
void *operator new( size_t num_bytes )
{
return GlobalAlloc(GPTR,num_bytes);
}

View file

@ -25,8 +25,8 @@ WNDPROC lpWndProcOld;
void (__stdcall *validate_filename)(TCHAR *);
BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
static BOOL CALLBACK ParentWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK ParentWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
void AddFolderFromReg(int nFolder);
static UINT_PTR PluginCallback(enum NSPIM msg)
@ -158,9 +158,9 @@ void __declspec(dllexport) Select(HWND hwndParent, int string_size, TCHAR *varia
}
}
static BOOL CALLBACK ParentWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
static INT_PTR CALLBACK ParentWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
BOOL bRes = CallWindowProc(lpWndProcOld,hwnd,message,wParam,lParam);
INT_PTR bRes = CallWindowProc(lpWndProcOld,hwnd,message,wParam,lParam);
if (message == WM_NOTIFY_OUTER_NEXT && !bRes)
{
// if leave function didn't abort (lRes != 0 in that case)
@ -191,7 +191,7 @@ void AddRTLStyle(HWND hWnd, long dwStyle)
\
y_offset += cy + 3;
BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
INT_PTR CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HWND hwLocation = GetDlgItem(hwndDlg, IDC_LOCATION);
HWND hwDirList = GetDlgItem(hwndDlg, IDC_DIRLIST);
@ -424,7 +424,7 @@ BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
return SendMessage(hwParent, uMsg, wParam, lParam);
break;
}
return 0;
return FALSE;
}
BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)

View file

@ -26,14 +26,17 @@ docs = Split("""
Import('BuildPlugin env')
conf = env.Configure()
if conf.TryCompile('END', '.S'):
files += ['Source/Call.S']
elif conf.TryCompile('.end', '.sx'):
files += ['Source/Call.sx']
if env['TARGET_ARCH'] != 'amd64':
conf = env.Configure()
if conf.TryCompile('END', '.S'):
files += ['Source/Call.S']
elif conf.TryCompile('.end', '.sx'):
files += ['Source/Call.sx']
else:
print 'WARNING: unable to find assembler for Call.S'
conf.Finish()
else:
print 'WARNING: unable to find assembler for Call.S'
conf.Finish()
print 'WARNING: missing Win64 code, dynamic function calls not supported'
BuildPlugin(
target,

View file

@ -15,8 +15,8 @@ TempStack *tempstack = NULL;
static void AllocWorker(unsigned int mult)
{
int size;
if ((size = popint()) == 0)
size_t size;
if ((size = popintptr()) == 0)
{
system_pushint(0);
return;
@ -56,7 +56,7 @@ PLUGINFUNCTIONSHORT(Copy)
// Ok, check the size
if (size == 0) size = (SIZE_T) GlobalSize(source);
// and the destinantion
if ((int) dest == 0)
if (!dest)
{
dest = GlobalAlloc((GPTR), size);
system_pushintptr((INT_PTR) dest);

View file

@ -134,20 +134,20 @@ void myitoa64(__int64 i, TCHAR *buffer)
*buffer = 0;
}
int system_popint()
INT_PTR system_popintptr()
{
int value;
INT_PTR value;
TCHAR *str;
if ((str = system_popstring()) == NULL) return -1;
value = myatoi(str);
value = StrToIntPtr(str);
GlobalFree(str);
return value;
}
void system_pushint(int value)
void system_pushintptr(INT_PTR value)
{
TCHAR buffer[80];
wsprintf(buffer, _T("%d"), value);
TCHAR buffer[50];
wsprintf(buffer, sizeof(void*) > 4 ? _T("%Id") : _T("%d"), value);
system_pushstring(buffer);
}

View file

@ -5,15 +5,17 @@
// Always use system* functions to keep the size down
#define pushstring error(use system_pushstring)
#undef pushint
#define pushint error(use system_pushint)
#define pushintptr error(use system_pushintptr)
#define popint system_popint
#undef myatoi
#define myatoi(str) ( (int) myatoi64(str) )
#define system_pushint(v) system_pushintptr((INT_PTR)(v))
#define popintptr system_popintptr
#ifdef _WIN64
# error TODO
# define StrToIntPtr(str) ( (INT_PTR)myatoi64((str)) )
#else
# define system_pushintptr system_pushint
# define popintptr popint
# define StrToIntPtr(str) ( (INT_PTR)myatoi((str)) )
#endif
@ -39,8 +41,8 @@ extern TCHAR *system_setuservariable(int varnum, TCHAR *var);
extern TCHAR* system_popstring(); // NULL - stack empty
extern TCHAR* system_pushstring(TCHAR *str);
extern __int64 myatoi64(TCHAR *s);
extern int system_popint(); // -1 -> stack empty
extern void system_pushint(int value);
extern INT_PTR system_popintptr(); // -1 -> stack empty
extern void system_pushintptr(INT_PTR value);
extern HANDLE GlobalCopy(HANDLE Old);
extern void *copymem(void *output, void *input, size_t cbSize);

View file

@ -30,18 +30,18 @@
#define PCD_PARAMS 2
#define PCD_DONE 3 // Just Continue
const int PARAMSIZEBYTYPE_PTR = (4==sizeof(void*)) ? 1 : 2;
const int ParamSizeByType[7] = {
0, // PAT_VOID (Size will be equal to 1)
0, // PAT_VOID (Size will be equal to 1) //BUGBUG64?
1, // PAT_INT
2, // PAT_LONG
1, // PAT_STRING
1, // PAT_WSTRING
1, // PAT_GUID
sizeof(void*) / 4, // PAT_STRING //BUGBUG64?
sizeof(void*) / 4, // PAT_WSTRING //BUGBUG64?
sizeof(void*) / 4, // PAT_GUID //BUGBUG64?
0}; // PAT_CALLBACK (Size will be equal to 1) //BUGBUG64?
const int PARAMSIZEBYTYPE_PTR = (4==sizeof(void*)) ? 1 : 2;
// Thomas needs to look at this.
const int ByteSizeByType[7] = {
static const int ByteSizeByType[7] = {
1, // PAT_VOID
1, // PAT_INT
1, // PAT_LONG
@ -55,7 +55,7 @@ int LastStackReal;
DWORD LastError;
volatile SystemProc *LastProc;
int CallbackIndex;
CallbackThunk* CallbackThunkListHead;
CallbackThunk* g_CallbackThunkListHead;
HINSTANCE g_hInstance;
// Return to callback caller with stack restore
@ -145,7 +145,7 @@ PLUGINFUNCTION(Debug)
GetLocalTime(&t);
GetTimeFormat(LOCALE_SYSTEM_DEFAULT, LOCALE_NOUSEROVERRIDE, &t, NULL, buftime, 1024);
GetDateFormat(LOCALE_SYSTEM_DEFAULT, LOCALE_NOUSEROVERRIDE, &t, NULL, bufdate, 1024);
wsprintf(buffer, _T("System, %s %s [build ") __TTIME__ _T(" ") __TDATE__ _T("]\n"), buftime, bufdate);
wsprintf(buffer, _T("System, %s %s [build %hs %hs]\n"), buftime, bufdate, __TIME__, __DATE__);
WriteToLog(buffer);
} else ;
else
@ -207,9 +207,9 @@ PLUGINFUNCTIONSHORT(Free)
{
HANDLE memtofree = (HANDLE)popintptr();
if (CallbackThunkListHead)
if (g_CallbackThunkListHead)
{
CallbackThunk *pCb=CallbackThunkListHead,*pPrev=NULL;
CallbackThunk *pCb=g_CallbackThunkListHead,*pPrev=NULL;
do
{
if (GetAssociatedSysProcFromCallbackThunkPtr(pCb) == (SystemProc*)memtofree)
@ -217,7 +217,7 @@ PLUGINFUNCTIONSHORT(Free)
if (pPrev)
pPrev->pNext=pCb->pNext;
else
CallbackThunkListHead=pCb->pNext;
g_CallbackThunkListHead=pCb->pNext;
--(CallbackIndex);
VirtualFree(pCb,0,MEM_RELEASE);
@ -268,12 +268,45 @@ PLUGINFUNCTION(Get)
}
} PLUGINFUNCTIONEND
#ifdef _WIN64
/*
TODO: CallProc/Back not implemeted.
Fake the behavior of the System plugin for the LoadImage API function so MUI works.
BUGBUG: Leaking DeleteObject and failing GetClientRect
*/
static SystemProc* CallProc(SystemProc *proc)
{
INT_PTR ret, *place;
LastError = lstrcmp(proc->ProcName, sizeof(TCHAR) > 1 ? _T("LoadImageW") : _T("LoadImageA"));
if (!LastError)
{
ret = (INT_PTR) LoadImage((HINSTANCE)proc->Params[1].Value,
(LPCTSTR)proc->Params[2].Value, (UINT)proc->Params[3].Value,
(int)proc->Params[4].Value, (int)proc->Params[5].Value,
(UINT)proc->Params[6].Value);
LastError = GetLastError();
}
else
proc->ProcResult = PR_ERROR, ret = 0;
place = (INT_PTR*) proc->Params[0].Value;
if (proc->Params[0].Option != -1) place = (INT_PTR*) &(proc->Params[0].Value);
if (place) *place = ret;
return proc;
}
static SystemProc* CallBack(SystemProc *proc)
{
proc->ProcResult = PR_ERROR;
return proc;
}
#endif
PLUGINFUNCTION(Call)
{
// Prepare input
SystemProc *proc = PrepareProc(TRUE);
if (proc == NULL)
return;
if (proc == NULL) return;
SYSTEM_LOG_ADD(_T("Call "));
SYSTEM_LOG_ADD(proc->DllName);
@ -281,8 +314,7 @@ PLUGINFUNCTION(Call)
SYSTEM_LOG_ADD(proc->ProcName);
//SYSTEM_LOG_ADD(_T("\n"));
SYSTEM_LOG_POST;
if (proc->ProcResult != PR_CALLBACK)
ParamAllocate(proc);
if (proc->ProcResult != PR_CALLBACK) ParamAllocate(proc);
ParamsIn(proc);
// Make the call
@ -308,35 +340,30 @@ PLUGINFUNCTION(Call)
// Always return flag set - return separate return and result
ParamsOut(proc);
GlobalFree(system_pushstring(GetResultStr(proc)));
} else
}
else
{
if (proc->ProcResult != PR_OK)
{
ProcParameter pp;
// Save old return param
pp = proc->Params[0];
ProcParameter pp = proc->Params[0]; // Save old return param
// Return result instead of return value
proc->Params[0].Value = BUGBUG64(int) GetResultStr(proc);
proc->Params[0].Value = (INT_PTR) GetResultStr(proc);
proc->Params[0].Type = PAT_TSTRING;
// Return all params
ParamsOut(proc);
// Restore old return param
proc->Params[0] = pp;
} else
ParamsOut(proc); // Return all params
proc->Params[0] = pp; // Restore old return param
}
else
ParamsOut(proc);
}
if (proc->ProcResult != PR_CALLBACK)
{
// Deallocate params if not callback
ParamsDeAllocate(proc);
// if not callback - check for unload library option
if ((proc->Options & POPT_UNLOAD)
&& (proc->ProcType == PT_PROC)
&& (proc->Dll != NULL))
if ((proc->Options & POPT_UNLOAD) && proc->ProcType == PT_PROC && proc->Dll)
FreeLibrary(proc->Dll); // and unload it :)
// In case of POPT_ERROR - first pop will be proc error
@ -344,8 +371,7 @@ PLUGINFUNCTION(Call)
}
// If proc is permanent?
if ((proc->Options & POPT_PERMANENT) == 0)
GlobalFree((HANDLE) proc); // No, free it
if ((proc->Options & POPT_PERMANENT) == 0) GlobalFree((HANDLE) proc); // No, free it
} PLUGINFUNCTIONEND
PLUGINFUNCTIONSHORT(Int64Op)
@ -602,13 +628,14 @@ SystemProc *PrepareProc(BOOL NeedForCall)
case _T('v'):
case _T('V'): temp2 = PAT_VOID; break;
#if !defined(SYSTEM_X86)
#error "TODO: handle p"
#else
case _T('p'):
#endif
#ifndef _WIN64
case _T('p'):
#endif
case _T('i'):
case _T('I'): temp2 = PAT_INT; break;
#ifdef _WIN64
case _T('p'):
#endif
case _T('l'):
case _T('L'): temp2 = PAT_LONG; break;
case _T('m'):
@ -865,12 +892,9 @@ SystemProc *PrepareProc(BOOL NeedForCall)
void ParamAllocate(SystemProc *proc)
{
int i;
for (i = 0; i <= proc->ParamCount; i++)
if (((HANDLE) proc->Params[i].Value == NULL) && (proc->Params[i].Option == -1))
{
proc->Params[i].Value = BUGBUG64(int) GlobalAlloc(GPTR, 4*ParamSizeByType[proc->Params[i].Type]);
}
if (!proc->Params[i].Value && proc->Params[i].Option == -1)
proc->Params[i].Value = (INT_PTR) GlobalAlloc(GPTR, 4*ParamSizeByType[proc->Params[i].Type]);
}
void ParamsIn(SystemProc *proc)
@ -958,7 +982,7 @@ void ParamsIn(SystemProc *proc)
#ifdef SYSTEM_LOG_DEBUG
{
TCHAR buf[666];
wsprintf(buf, _T("\t\t\tParam In %d: type %d value 0x%08X value2 0x%08X"), i,
wsprintf(buf, _T("\t\t\tParam In %d: type %d value ")SYSFMT_HEXPTR _T(" value2 0x%08X"), i,
par->Type, par->Value, par->_value);
SYSTEM_LOG_ADD(buf);
SYSTEM_LOG_POST;
@ -974,18 +998,18 @@ void ParamsIn(SystemProc *proc)
void ParamsDeAllocate(SystemProc *proc)
{
int i;
for (i = proc->ParamCount; i >= 0; i--)
if (((HANDLE) proc->Params[i].Value != NULL) && (proc->Params[i].Option == -1))
if (proc->Params[i].Value && proc->Params[i].Option == -1)
{
GlobalFree((HANDLE) (proc->Params[i].Value));
proc->Params[i].Value = (int) NULL;
proc->Params[i].Value = 0;
}
}
void ParamsOut(SystemProc *proc)
{
int i, *place;
INT_PTR *place;
int i;
TCHAR *realbuf;
LPWSTR wstr;
@ -993,8 +1017,8 @@ void ParamsOut(SystemProc *proc)
do
{
// Retreive pointer to place
if (proc->Params[i].Option == -1) place = BUGBUG64(int*) proc->Params[i].Value;
else place = BUGBUG64(int*) &(proc->Params[i].Value);
if (proc->Params[i].Option == -1) place = (INT_PTR*) proc->Params[i].Value;
else place = (INT_PTR*) &(proc->Params[i].Value);
realbuf = AllocString();
@ -1005,7 +1029,7 @@ void ParamsOut(SystemProc *proc)
lstrcpy(realbuf,_T(""));
break;
case PAT_INT:
wsprintf(realbuf, _T("%d"), *((int*) place));
wsprintf(realbuf, _T("%d"), (int)(*((INT_PTR*) place)));
break;
case PAT_LONG:
myitoa64(*((__int64*) place), realbuf);
@ -1038,7 +1062,7 @@ void ParamsOut(SystemProc *proc)
#endif
break;
case PAT_CALLBACK:
wsprintf(realbuf, _T("%d"), proc->Params[i].Value);
wsprintf(realbuf, _T("%d"), BUGBUG64(proc->Params[i].Value));
break;
}
@ -1083,6 +1107,9 @@ void ParamsOut(SystemProc *proc)
HANDLE CreateCallback(SystemProc *cbproc)
{
#ifdef SYSTEM_X64
return BUGBUG64(HANDLE) NULL;
#else
char *mem;
if (cbproc->Proc == NULL)
@ -1093,8 +1120,8 @@ HANDLE CreateCallback(SystemProc *cbproc)
mem = (char *) (cbproc->Proc = VirtualAlloc(NULL, sizeof(CallbackThunk), MEM_COMMIT, PAGE_EXECUTE_READWRITE));
((CallbackThunk*)mem)->pNext=CallbackThunkListHead;
CallbackThunkListHead=(CallbackThunk*)mem;
((CallbackThunk*)mem)->pNext=g_CallbackThunkListHead;
g_CallbackThunkListHead=(CallbackThunk*)mem;
#ifdef SYSTEM_X86
*(mem++) = (char) 0xB8; // Mov eax, const
@ -1111,6 +1138,7 @@ HANDLE CreateCallback(SystemProc *cbproc)
// Return proc address
return cbproc->Proc;
#endif
}
void CallStruct(SystemProc *proc)
@ -1215,7 +1243,7 @@ void CallStruct(SystemProc *proc)
SYSTEM_LOG_POST;
// Proc virtual return - pointer to memory struct
proc->Params[0].Value = (int) proc->Proc;
proc->Params[0].Value = BUGBUG64(int) proc->Proc;
}
/*
@ -1231,25 +1259,28 @@ the same means as used for the _RPT0 macro. This leads to an endless recursion.
BOOL WINAPI DllMain(HINSTANCE hInst, DWORD fdwReason, LPVOID lpReserved)
{
g_hInstance=hInst;
if (DLL_PROCESS_ATTACH == fdwReason)
{
// change the protection of return command
VirtualProtect(&retexpr, sizeof(retexpr), PAGE_EXECUTE_READWRITE, (PDWORD)&LastStackPlace);
g_hInstance=hInst;
// initialize some variables
LastStackPlace = 0;
LastStackReal = 0;
LastError = 0;
LastProc = NULL;
CallbackIndex = 0;
CallbackThunkListHead = NULL;
retexpr[0] = (char) 0xC2;
retexpr[2] = 0x00;
}
if (DLL_PROCESS_ATTACH == fdwReason)
{
// change the protection of return command
VirtualProtect(&retexpr, sizeof(retexpr), PAGE_EXECUTE_READWRITE, (PDWORD)&LastStackPlace);
return TRUE;
// initialize some variables
LastStackPlace = 0, LastStackReal = 0;
LastError = 0;
LastProc = NULL;
CallbackIndex = 0, g_CallbackThunkListHead = NULL;
#ifdef SYSTEM_X86
retexpr[0] = (char) 0xC2;
retexpr[2] = 0x00;
#elif defined(SYSTEM_X64)
retexpr[0] = BUGBUG64(0);
#else
#error TODO
#endif
}
return TRUE;
}
/*

View file

@ -10,7 +10,11 @@
#else
# error "Unknown architecture!"
#endif
#ifdef _WIN64
#define SYSFMT_HEXPTR _T("0x%016IX")
#else
#define SYSFMT_HEXPTR _T("0x%08X")
#endif
// The following ifdef block is the standard way of creating macros which make exporting
@ -76,8 +80,8 @@ typedef struct
{
int Type;
int Option; // -1 -> Pointer, 1-... -> Special+1
int Value; // it can hold any 4 byte value BUGBUG: What about pointers on Win64?
int _value; // value buffer for structures > 4 bytes (I hope 8 bytes will be enough)
INT_PTR Value; // it can hold any pointer sized value
int _value; // value buffer for structures > 4 bytes (I hope 8 bytes will be enough) BUGBUG: Does Win64 need this?
int Size; // Value real size (should be either 1 or 2 (the number of pushes))
int Input; //BUGBUG: What about pointers on Win64?
int Output;
@ -119,6 +123,8 @@ struct tag_CallbackThunk
#pragma pack(pop)
*/
char asm_code[10];
#elif defined(SYSTEM_X64)
char asm_code[BUGBUG64(1)]; // TODO: BUGBUG64
#else
#error "Asm thunk not implemeted for this architecture!"
#endif
@ -129,6 +135,8 @@ struct tag_CallbackThunk
// Free() only knows about pNext in CallbackThunk, it does not know anything about the assembly, that is where this helper comes in...
#ifdef SYSTEM_X86
# define GetAssociatedSysProcFromCallbackThunkPtr(pCbT) ( (SystemProc*) *(unsigned int*) (((char*)(pCbT))+1) )
#elif defined(SYSTEM_X64)
# define GetAssociatedSysProcFromCallbackThunkPtr(pCbT) BUGBUG64(NULL)
#else
# error "GetAssociatedSysProcFromCallbackThunkPtr not defined for the current architecture!"
#endif

View file

@ -14,105 +14,105 @@
; ------------- Functions --------------
; LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
!define sysWNDPROC "(i.s, i.s, i.s, i.s) iss"
!define sysWNDPROC "(p.s, i.s, p.s, p.s) pss"
; LRESULT DefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
!define sysDefWindowProc "user32::DefWindowProc(i, i, i, i) i"
!define sysDefWindowProc "user32::DefWindowProc(p, i, p, p) p"
!define sysMessageBox "user32::MessageBox(i, t, t, i) i"
!define sysMessageBox "user32::MessageBox(p, t, t, i) i"
!define sysMessageBeep "user32::MessageBeep(i) i"
!define sysMessageBoxIndirect 'user32::MessageBoxIndirect(i) i'
!define sysMessageBoxIndirect 'user32::MessageBoxIndirect(p) i'
; HMODULE GetModuleHandle(LPCTSTR lpModuleName);
!define sysGetModuleHandle "kernel32::GetModuleHandle(t) i"
; HMODULE LoadLibrary(LPCTSTR lpFileName);
!define sysLoadLibrary "kernel32::LoadLibrary(t) i"
!define sysLoadLibrary "kernel32::LoadLibrary(t) p"
; BOOL FreeLibrary(HMODULE hModule);
!define sysFreeLibrary "kernel32::FreeLibrary(i) i"
!define sysFreeLibrary "kernel32::FreeLibrary(p) i"
; HCURSOR LoadCursor(HINSTANCE hInstance, LPCTSTR lpCursorName);
!define sysLoadCursor "user32::LoadCursor(i, t) i"
!define sysLoadCursor "user32::LoadCursor(p, t) p"
; ATOM RegisterClass(CONST WNDCLASS *lpWndClass);
!define sysRegisterClass "user32::RegisterClass(i) i"
!define sysRegisterClass "user32::RegisterClass(p) i"
; HANDLE LoadImage(HINSTANCE hinst, LPCTSTR lpszName, UINT uType,
; int cxDesired, int cyDesired, UINT fuLoad);
!define sysLoadImage "user32::LoadImage(i, t, i, i, i, i) i"
!define sysLoadImage "user32::LoadImage(p, t, i, i, i, i) p"
; BOOL PlaySound(LPCSTR pszSound, HMODULE hmod, DWORD fdwSound);
!define sysPlaySound "winmm.dll::PlaySound(t, i, i) i"
!define sysPlaySound "winmm.dll::PlaySound(t, p, i) i"
; HWND CreateWindowEx(DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName,
; DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent,
; HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam);
!define sysCreateWindowEx "user32::CreateWindowEx(i, t, t, i, i, i, i, i, i, i, i, i) i"
!define sysCreateWindowEx "user32::CreateWindowEx(i, t, t, i, i, i, i, i, p, p, p, p) p"
; BOOL IsWindow(HWND hWnd);
!define sysIsWindow "user32::IsWindow(i) i"
!define sysIsWindow "user32::IsWindow(p) i"
; LONG SetWindowLong(HWND hWnd, int nIndex, LONG dwNewLong);
!define sysSetWindowLong "user32::SetWindowLong(i, i, i) i"
!define sysSetWindowLong "user32::SetWindowLong(p, i, p) p"
; BOOL SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags);
!define sysSetWindowPos "user32::SetWindowPos(i, i, i, i, i, i, i) i"
!define sysSetWindowPos "user32::SetWindowPos(p, p, i, i, i, i, i) i"
; BOOL ShowWindow(HWND hWnd, int nCmdShow);
!define sysShowWindow "user32::ShowWindow(i, i) i"
!define sysShowWindow "user32::ShowWindow(p, i) i"
; BOOL DestroyWindow(HWND hWnd);
!define sysDestroyWindow "user32::DestroyWindow(i) i"
!define sysDestroyWindow "user32::DestroyWindow(p) i"
; BOOL GetClientRect(HWND hWnd, LPRECT lpRect);
!define sysGetClientRect "user32::GetClientRect(i, i) i"
!define sysGetClientRect "user32::GetClientRect(p, p) i"
; BOOL GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax);
!define sysGetMessage "user32::GetMessage(i, i, i, i) i"
!define sysGetMessage "user32::GetMessage(p, p, i, i) i"
; LRESULT DispatchMessage(CONST MSG *lpmsg);
!define sysDispatchMessage "user32::DispatchMessage(i) i"
!define sysDispatchMessage "user32::DispatchMessage(p) p"
; BOOL DeleteObject(HGDIOBJ hObject);
!define sysDeleteObject "gdi32::DeleteObject(i) i"
!define sysDeleteObject "gdi32::DeleteObject(p) i"
; int GetObject(HGDIOBJ hgdiobj, int cbBuffer, LPVOID lpvObject);
!define sysGetObject "gdi32::GetObject(i, i, i) i"
!define sysGetObject "gdi32::GetObject(p, i, p) i"
; HGDIOBJ SelectObject(HDC hdc, HGDIOBJ hgdiobj);
!define sysSelectObject "gdi32::SelectObject(i, i) i"
!define sysSelectObject "gdi32::SelectObject(p, p) p"
; HDC CreateCompatibleDC(HDC hdc);
!define sysCreateCompatibleDC "gdi32::CreateCompatibleDC(i) i"
!define sysCreateCompatibleDC "gdi32::CreateCompatibleDC(p) p"
; BOOL DeleteDC(HDC hdc);
!define sysDeleteDC "gdi32::DeleteDC(i) i"
!define sysDeleteDC "gdi32::DeleteDC(p) i"
; BOOL BitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight,
; HDC hdcSrc, int nXSrc, int nYSrc, DWORD dwRop);
!define sysBitBlt "gdi32::BitBlt(i, i, i, i, i, i, i, i, i) i"
!define sysBitBlt "gdi32::BitBlt(p, i, i, i, i, p, i, i, i) i"
; proposed by abgandar
; int AddFontResource(LPCTSTR lpszFilename);
!define sysAddFontResource "gdi32::AddFontResource(t) i"
; HDC BeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint);
!define sysBeginPaint "user32::BeginPaint(i, i) i"
!define sysBeginPaint "user32::BeginPaint(p, p) p"
; BOOL EndPaint(HWND hWnd, CONST PAINTSTRUCT *lpPaint);
!define sysEndPaint "user32::EndPaint(i, i) i"
!define sysEndPaint "user32::EndPaint(p, p) i"
; BOOL SystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni);
!define sysSystemParametersInfo "user32::SystemParametersInfo(i, i, i, i) i"
!define sysSystemParametersInfo "user32::SystemParametersInfo(i, i, p, i) i"
; UINT_PTR SetTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc);
!define sysSetTimer "user32::SetTimer(i, i, i, k) i"
!define sysSetTimer "user32::SetTimer(p, p, i, k) i"
; DWORD GetLogicalDriveStrings(DWORD nBufferLength, LPTSTR LpBuffer);
!define sysGetLogicalDriveStrings 'kernel32::GetLogicalDriveStrings(i, i) i'
!define sysGetLogicalDriveStrings 'kernel32::GetLogicalDriveStrings(i, p) i'
!define sysGetDiskFreeSpaceEx 'kernel32::GetDiskFreeSpaceEx(t, *l, *l, *l) i'
@ -120,14 +120,14 @@
!define sysGetDriveType 'kernel32::GetDriveType(t) i'
; HANDLE FindFirstFile(LPCTSTR lpFileName,LPWIN32_FIND_DATA lpFindFileData);
!define sysFindFirstFile 'kernel32::FindFirstFile(t, i) i'
!define sysFindFirstFile 'kernel32::FindFirstFile(t, p) p'
; BOOL FindClose(HANDLE hFindFile);
!define sysFindClose 'kernel32::FindClose(i) i'
!define sysFindClose 'kernel32::FindClose(p) i'
; BOOL FileTimeToSystemTime(CONST FILETIME *lpFileTime,
; LPSYSTEMTIME lpSystemTime);
!define sysFileTimeToSystemTime 'kernel32::FileTimeToSystemTime(*l, i) i'
!define sysFileTimeToSystemTime 'kernel32::FileTimeToSystemTime(*l, p) i'
; BOOL FileTimeToLocalFileTime(
; CONST FILETIME *lpFileTime,
@ -136,7 +136,7 @@
; BOOL SystemTimeToTzSpecificLocalTime(LPTIME_ZONE_INFORMATION lpTimeZone,
; LPSYSTEMTIME lpUniversalTime, LPSYSTEMTIME lpLocalTime);
!define sysSystemTimeToTzSpecificLocalTime 'kernel32::SystemTimeToTzSpecificLocalTime(i, i, i) i'
!define sysSystemTimeToTzSpecificLocalTime 'kernel32::SystemTimeToTzSpecificLocalTime(p, p, p) i'
!define syslstrlen 'kernel32::lstrlen(t) i'
@ -157,7 +157,7 @@
; LPCTSTR lpszMenuName;
; LPCTSTR lpszClassName;
; } WNDCLASS, *PWNDCLASS;
!define stWNDCLASS "(i, k, i, i, i, i, i, i, t, t) i"
!define stWNDCLASS "(i, k, i, i, p, p, p, p, t, t) p"
; typedef struct tagMSG {
; HWND hwnd;
@ -167,7 +167,7 @@
; DWORD time;
; POINT pt; -> will be presented as two separate px and py
; } MSG, *PMSG;
!define stMSG "(i, i, i, i, i, i, i) i"
!define stMSG "(p, i, p, p, i, i, i) p"
; typedef struct tagBITMAP {
; LONG bmType;
@ -178,7 +178,7 @@
; WORD bmBitsPixel;
; LPVOID bmBits;
; } BITMAP, *PBITMAP;
!define stBITMAP "(i, i, i, i, i, i, i) i"
!define stBITMAP "(i, i, i, i, i, i, p) p"
; typedef struct _RECT {
; LONG left;
@ -186,7 +186,7 @@
; LONG right;
; LONG bottom;
; } RECT, *PRECT;
!define stRECT "(i, i, i, i) i"
!define stRECT "(i, i, i, i) p"
; typedef struct tagPAINTSTRUCT {
; HDC hdc;
@ -196,7 +196,7 @@
; BOOL fIncUpdate;
; BYTE rgbReserved[32];
; } PAINTSTRUCT, *PPAINTSTRUCT;
!define stPAINTSTRUCT "(i, i, i, i, i, i, i, i, &v32) i"
!define stPAINTSTRUCT "(p, i, i, i, i, i, i, i, &v32) p"
; typedef struct {
; UINT cbSize;
@ -210,7 +210,7 @@
; MSGBOXCALLBACK lpfnMsgBoxCallback;
; DWORD dwLanguageId;
; } MSGBOXPARAMS, *PMSGBOXPARAMS;
!define stMSGBOXPARAMS '(&l4, i, i, t, t, i, t, i, k, i) i'
!define stMSGBOXPARAMS '(&l4, p, p, t, t, i, t, p, k, i) p'
; typedef struct _SYSTEMTIME {
; WORD wYear;
@ -222,7 +222,7 @@
; WORD wSecond;
; WORD wMilliseconds;
; } SYSTEMTIME, *PSYSTEMTIME;
!define stSYSTEMTIME '(&i2, &i2, &i2, &i2, &i2, &i2, &i2, &i2) i'
!define stSYSTEMTIME '(&i2, &i2, &i2, &i2, &i2, &i2, &i2, &i2) p'
; Maximal windows path
!define /ifndef MAX_PATH 260
@ -239,7 +239,7 @@
; TCHAR cFileName[ MAX_PATH ];
; TCHAR cAlternateFileName[ 14 ];
; } WIN32_FIND_DATA, *PWIN32_FIND_DATA;
!define stWIN32_FIND_DATA '(i, l, l, l, i, i, i, i, &t${MAX_PATH}, &t14) i'
!define stWIN32_FIND_DATA '(i, l, l, l, i, i, i, i, &t${MAX_PATH}, &t14) p'
; ------------- Constants --------------

View file

@ -73,7 +73,7 @@ enumex: ; End of drives or user cancel
; ----- Sample 3 ----- Direct proc defenition -----
; Direct specification demo
System::Call 'user32::MessageBox(i $HWNDPARENT, t "Just direct MessageBox specification demo ;)", t "System Example 3", i ${MB_OK}) i.s'
System::Call 'user32::MessageBox(p $HWNDPARENT, t "Just direct MessageBox specification demo ;)", t "System Example 3", i ${MB_OK}) i.s'
Pop $0
; ----- Sample 4 ----- Int64, mixed definition demo -----

View file

@ -18,7 +18,7 @@ const TCHAR* windows[] = {
MAKEINTRESOURCE(IDD_UNINST)
};
BOOL CALLBACK GenericProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) {
INT_PTR CALLBACK GenericProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) {
static LOGBRUSH b = {BS_SOLID, RGB(255,0,0), 0};
static HBRUSH red;
@ -27,26 +27,26 @@ BOOL CALLBACK GenericProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) {
switch (uMsg) {
case WM_CTLCOLORSTATIC:
return (int)red;
return (INT_PTR)red;
}
return 0;
return FALSE;
}
BOOL CALLBACK DialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) {
INT_PTR CALLBACK DialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) {
static int i = -1;
switch (uMsg) {
case WM_INITDIALOG:
SetWindowText(hwndDlg, _T("NSIS User Interface - Testing"));
SetWindowText(GetDlgItem(hwndDlg, IDC_VERSTR), _T("NSIS version"));
SetWindowText(GetDlgItem(hwndDlg, IDC_BACK), _T("< Back"));
SetWindowText(GetDlgItem(hwndDlg, IDOK), _T("Next >"));
SetWindowText(GetDlgItem(hwndDlg, IDCANCEL), _T("Cancel"));
ShowWindow(GetDlgItem(hwndDlg, IDC_BACK), SW_SHOW);
ShowWindow(GetDlgItem(hwndDlg, IDC_CHILDRECT), SW_SHOW);
switch (uMsg) {
case WM_INITDIALOG:
SetWindowText(hwndDlg, _T("NSIS User Interface - Testing"));
SetWindowText(GetDlgItem(hwndDlg, IDC_VERSTR), _T("NSIS version"));
SetWindowText(GetDlgItem(hwndDlg, IDC_BACK), _T("< Back"));
SetWindowText(GetDlgItem(hwndDlg, IDOK), _T("Next >"));
SetWindowText(GetDlgItem(hwndDlg, IDCANCEL), _T("Cancel"));
ShowWindow(GetDlgItem(hwndDlg, IDC_BACK), SW_SHOW);
ShowWindow(GetDlgItem(hwndDlg, IDC_CHILDRECT), SW_SHOW);
SendMessage(hwndDlg, WM_COMMAND, MAKEWORD(IDOK, 0), 0);
ShowWindow(hwndDlg, SW_SHOW);
break;
case WM_COMMAND:
ShowWindow(hwndDlg, SW_SHOW);
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
case IDC_BACK:
@ -77,7 +77,7 @@ BOOL CALLBACK DialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) {
}
break;
}
return 0;
return FALSE;
}
NSIS_ENTRYPOINT_SIMPLEGUI

View file

@ -58,7 +58,7 @@ Function OnChange
Pop $0 # HWND
System::Call user32::GetWindowText(i$EDIT,t.r0,i${NSIS_MAX_STRLEN})
System::Call user32::GetWindowText(p$EDIT,t.r0,i${NSIS_MAX_STRLEN})
${If} $0 == "hello there"
MessageBox MB_OK "right back at ya"

View file

@ -32,9 +32,9 @@ struct nsControl* NSDFUNC GetControl(HWND hwCtl)
return &g_dialog.controls[id - 1];
}
BOOL CALLBACK ParentProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
INT_PTR CALLBACK ParentProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
BOOL res;
INT_PTR res;
if (message == WM_NOTIFY_OUTER_NEXT)
{
@ -76,7 +76,7 @@ LRESULT CALLBACK LinkWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPar
return CallWindowProc(ctl->oldWndProc, hwnd, message, wParam, lParam);
}
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
@ -93,7 +93,7 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (ctl->callbacks.onClick)
{
pushint((int) hwCtl);
pushintptr((INT_PTR) hwCtl);
g_pluginParms->ExecuteCodeSegment(ctl->callbacks.onClick - 1, 0);
}
}
@ -101,7 +101,7 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (ctl->callbacks.onChange)
{
pushint((int) hwCtl);
pushintptr((INT_PTR) hwCtl);
g_pluginParms->ExecuteCodeSegment(ctl->callbacks.onChange - 1, 0);
}
}
@ -109,7 +109,7 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (ctl->callbacks.onChange)
{
pushint((int) hwCtl);
pushintptr((INT_PTR) hwCtl);
g_pluginParms->ExecuteCodeSegment(ctl->callbacks.onChange - 1, 0);
}
}
@ -118,7 +118,7 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (ctl->callbacks.onChange)
{
pushint((int) hwCtl);
pushintptr((INT_PTR) hwCtl);
g_pluginParms->ExecuteCodeSegment(ctl->callbacks.onChange - 1, 0);
}
}
@ -126,7 +126,7 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (ctl->callbacks.onClick)
{
pushint((int) hwCtl);
pushintptr((INT_PTR) hwCtl);
g_pluginParms->ExecuteCodeSegment(ctl->callbacks.onClick - 1, 0);
}
}
@ -145,9 +145,9 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (!ctl->callbacks.onNotify)
break;
pushint((int) nmhdr);
pushint(nmhdr->code);
pushint((int) nmhdr->hwndFrom);
pushintptr((INT_PTR) nmhdr);
pushintptr(nmhdr->code);
pushintptr((INT_PTR) nmhdr->hwndFrom);
g_pluginParms->ExecuteCodeSegment(ctl->callbacks.onNotify - 1, 0);
}
@ -287,7 +287,7 @@ void __declspec(dllexport) Create(HWND hwndParent, int string_size, TCHAR *varia
g_dialog.callbacks.onBack = 0;
pushint((int) g_dialog.hwDialog);
pushintptr((INT_PTR) g_dialog.hwDialog);
}
void __declspec(dllexport) CreateControl(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, extra_parameters *extra)
@ -393,7 +393,7 @@ void __declspec(dllexport) CreateControl(HWND hwndParent, int string_size, TCHAR
// push back result
pushint((int) hwItem);
pushintptr((INT_PTR) hwItem);
// done
@ -413,11 +413,11 @@ void __declspec(dllexport) SetUserData(HWND hwndParent, int string_size, TCHAR *
// get info from stack
hwCtl = (HWND) popint();
hwCtl = (HWND) popintptr();
if (!IsWindow(hwCtl))
{
popint(); // remove user data from stack
popintptr(); // remove user data from stack
return;
}
@ -440,7 +440,7 @@ void __declspec(dllexport) GetUserData(HWND hwndParent, int string_size, TCHAR *
// get info from stack
hwCtl = (HWND) popint();
hwCtl = (HWND) popintptr();
if (!IsWindow(hwCtl))
{
@ -513,7 +513,7 @@ void NSDFUNC SetControlCallback(size_t callbackIdx)
// get info from stack
hwCtl = (HWND) popint();
hwCtl = (HWND) popintptr();
callback = (nsFunction) popint();
if (!IsWindow(hwCtl))

View file

@ -354,9 +354,9 @@ Header file for creating custom installer pages with nsDialogs
!macro _NSD_GWLAddFlags GWL HWND DATA
System::Call "user32::GetWindowLong(i${HWND},i${GWL})i.s"
System::Call "user32::GetWindowLong(p${HWND},i${GWL})p.s"
System::Int64Op "${DATA}" |
System::Call "user32::SetWindowLong(i${HWND},i${GWL},is)"
System::Call "user32::SetWindowLong(p${HWND},p${GWL},ps)"
!macroend
@ -365,7 +365,7 @@ Header file for creating custom installer pages with nsDialogs
!macro __NSD_GetText CONTROL VAR
System::Call user32::GetWindowText(i${CONTROL},t.s,i${NSIS_MAX_STRLEN})
System::Call user32::GetWindowText(p${CONTROL},t.s,i${NSIS_MAX_STRLEN})
Pop ${VAR}
!macroend
@ -422,7 +422,7 @@ Header file for creating custom installer pages with nsDialogs
!macro __NSD_SetFocus HWND
System::Call "user32::SetFocus(i${HWND})"
System::Call "user32::SetFocus(p${HWND})"
!macroend
@ -492,7 +492,7 @@ Header file for creating custom installer pages with nsDialogs
!macro __NSD_LB_GetSelection CONTROL VAR
SendMessage ${CONTROL} ${LB_GETCURSEL} 0 0 ${VAR}
System::Call 'user32::SendMessage(i ${CONTROL}, i ${LB_GETTEXT}, i ${VAR}, t .s)'
System::Call 'user32::SendMessage(p ${CONTROL}, i ${LB_GETTEXT}, p ${VAR}, t .s)'
Pop ${VAR}
!macroend
@ -511,10 +511,10 @@ Header file for creating custom installer pages with nsDialogs
!if "${_LIHINSTMODE}" == "exeresource"
!undef _LIHINSTSRC # If (internal?) _* macro params starts using $0,
!define _LIHINSTSRC r0 # _LIHINSTSRC can be changed to s
System::Call 'kernel32::GetModuleHandle(i0)i.${_LIHINSTSRC}'
System::Call 'kernel32::GetModuleHandle(p0)p.${_LIHINSTSRC}'
!endif
System::Call 'user32::LoadImage(i ${_LIHINSTSRC}, ts, i ${_IMGTYPE}, i0, i0, i${_LIFLAGS}) i.r0'
System::Call 'user32::LoadImage(p ${_LIHINSTSRC}, ts, i ${_IMGTYPE}, i0, i0, i${_LIFLAGS})p.r0'
SendMessage $R0 ${STM_SETIMAGE} ${_IMGTYPE} $0
Pop $R0
@ -549,25 +549,19 @@ Header file for creating custom installer pages with nsDialogs
StrCpy $R0 ${CONTROL} # in case ${CONTROL} is $0
StrCpy $1 ""
StrCpy $2 ""
System::Call '*(i, i, i, i) i.s'
Pop $0
# Allocate a RECT in $0 and initialize $1 and $2 to 0
System::Call '*(i0r1, i0r2, i, i)p.r0'
${If} $0 <> 0
System::Call 'user32::GetClientRect(iR0, ir0)'
System::Call 'user32::GetClientRect(pR0, pr0)'
System::Call '*$0(i, i, i .s, i .s)'
System::Free $0
Pop $1
Pop $2
${EndIf}
System::Call 'user32::LoadImage(i0, ts, i ${IMAGE_BITMAP}, ir1, ir2, i${LR_LOADFROMFILE}) i.s' "${IMAGE}"
System::Call 'user32::LoadImage(p0, ts, i ${IMAGE_BITMAP}, ir1, ir2, i${LR_LOADFROMFILE}) p.s' "${IMAGE}"
Pop $0
SendMessage $R0 ${STM_SETIMAGE} ${IMAGE_BITMAP} $0
SendMessage $R0 ${STM_SETIMAGE} ${IMAGE_BITMAP} $0
Pop $R0
Pop $2
@ -583,9 +577,7 @@ Header file for creating custom installer pages with nsDialogs
!macro __NSD_FreeImage IMAGE
${If} ${IMAGE} <> 0
System::Call gdi32::DeleteObject(is) ${IMAGE}
System::Call gdi32::DeleteObject(ps) ${IMAGE}
${EndIf}
!macroend
@ -594,7 +586,7 @@ Header file for creating custom installer pages with nsDialogs
!define NSD_FreeBitmap `${NSD_FreeImage}`
!macro __NSD_FreeIcon IMAGE
System::Call user32::DestroyIcon(is) ${IMAGE}
System::Call user32::DestroyIcon(ps) ${IMAGE}
!macroend
!define NSD_FreeIcon `!insertmacro __NSD_FreeIcon`

View file

@ -96,7 +96,7 @@ Function nsDialogsWelcome
Pop $IMAGECTL
StrCpy $0 $PLUGINSDIR\welcome.bmp
System::Call 'user32::LoadImage(i 0, t r0, i ${IMAGE_BITMAP}, i 0, i 0, i ${LR_LOADFROMFILE}) i.s'
System::Call 'user32::LoadImage(p 0, t r0, i ${IMAGE_BITMAP}, i 0, i 0, i ${LR_LOADFROMFILE})p.s'
Pop $IMAGE
SendMessage $IMAGECTL ${STM_SETIMAGE} ${IMAGE_BITMAP} $IMAGE
@ -119,7 +119,7 @@ Function nsDialogsWelcome
Call ShowControls
System::Call gdi32::DeleteObject(i$IMAGE)
System::Call gdi32::DeleteObject(p$IMAGE)
FunctionEnd
@ -198,7 +198,7 @@ Function DirChange
GetDlgItem $0 $HWNDPARENT 1
System::Call user32::GetWindowText(i$DIRECTORY,t.d,i${NSIS_MAX_STRLEN})
System::Call user32::GetWindowText(p$DIRECTORY,t.d,i${NSIS_MAX_STRLEN})
${If} ${FileExists} $INSTDIR\makensis.exe
EnableWindow $0 1

View file

@ -76,7 +76,7 @@ int g_zipfile_size;
bool g_made;
static BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
NSIS_ENTRYPOINT_SIMPLEGUI
int WINAPI _tWinMain(HINSTANCE hInst,HINSTANCE hOldInst,LPTSTR CmdLineParams,int ShowCmd)
@ -600,7 +600,7 @@ void SetZip(HWND hwndDlg, TCHAR *path)
}
}
BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
INT_PTR CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static int ids[]={IDC_INFO,IDC_NSISICON,IDC_SZIPFRAME,IDC_BROWSE,IDC_ZIPFILE,IDC_ZIPINFO_SUMMARY,IDC_ZIPINFO_FILES,IDC_OFRAME,IDC_INAMEST,
IDC_INSTNAME,IDC_INSTPATH,IDC_OEFST,IDC_OUTFILE,IDC_BROWSE2,IDC_COMPRESSOR,IDC_ZLIB,IDC_BZIP2,IDC_LZMA,IDC_SOLID,IDC_INTERFACE,IDC_MODERNUI,IDC_CLASSICUI,IDC_UNICODE};
@ -783,5 +783,5 @@ BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
break;
}
return 0;
return FALSE;
}