MakeNsisW: Functional size gripper and other minor fixes
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6368 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
cc796c202d
commit
1cf3d5cb22
8 changed files with 202 additions and 237 deletions
|
@ -191,11 +191,16 @@ Version History
|
||||||
|
|
||||||
2.3.1
|
2.3.1
|
||||||
- Fixed broken command line parameter handling
|
- Fixed broken command line parameter handling
|
||||||
|
|
||||||
|
2.3.2
|
||||||
|
- The size gripper can be used to resize the window
|
||||||
|
|
||||||
|
|
||||||
Copyright Information
|
Copyright Information
|
||||||
---------------------
|
---------------------
|
||||||
Copyright (c) 2002 Robert Rainwater
|
Copyright (c) 2002 Robert Rainwater
|
||||||
Contributors: Justin Frankel, Fritz Elfert, Amir Szekely, Sunil Kamath, Joost Verburg
|
Contributors: Justin Frankel, Fritz Elfert, Amir Szekely,
|
||||||
|
Sunil Kamath, Joost Verburg, Anders Kjersem.
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|
|
@ -53,7 +53,7 @@ BuildUtil(
|
||||||
res = res,
|
res = res,
|
||||||
resources = resources,
|
resources = resources,
|
||||||
entry = None,
|
entry = None,
|
||||||
defines = ['RELEASE=2.3'],
|
defines = ['RELEASE=2.3.2'],
|
||||||
docs = docs,
|
docs = docs,
|
||||||
root_util = True
|
root_util = True
|
||||||
)
|
)
|
||||||
|
|
|
@ -30,12 +30,6 @@
|
||||||
#include "toolbar.h"
|
#include "toolbar.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
|
|
||||||
#ifdef _countof
|
|
||||||
#define COUNTOF _countof
|
|
||||||
#else
|
|
||||||
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace MakensisAPI {
|
namespace MakensisAPI {
|
||||||
const TCHAR* SigintEventNameFmt = _T("makensis win32 sigint event %u");
|
const TCHAR* SigintEventNameFmt = _T("makensis win32 sigint event %u");
|
||||||
const TCHAR* SigintEventNameLegacy = _T("makensis win32 signint event");
|
const TCHAR* SigintEventNameLegacy = _T("makensis win32 signint event");
|
||||||
|
@ -44,6 +38,7 @@ namespace MakensisAPI {
|
||||||
NSCRIPTDATA g_sdata;
|
NSCRIPTDATA g_sdata;
|
||||||
NRESIZEDATA g_resize;
|
NRESIZEDATA g_resize;
|
||||||
NFINDREPLACE g_find;
|
NFINDREPLACE g_find;
|
||||||
|
TCHAR g_findbuf[128];
|
||||||
extern NTOOLBAR g_toolbar;
|
extern NTOOLBAR g_toolbar;
|
||||||
int g_symbol_set_mode;
|
int g_symbol_set_mode;
|
||||||
|
|
||||||
|
@ -64,13 +59,13 @@ int WINAPI _tWinMain(HINSTANCE hInst,HINSTANCE hOldInst,LPTSTR CmdLineParams,int
|
||||||
HINSTANCE hRichEditDLL = LoadLibrary(_T("RichEd20.dll"));
|
HINSTANCE hRichEditDLL = LoadLibrary(_T("RichEd20.dll"));
|
||||||
|
|
||||||
if (!InitBranding()) {
|
if (!InitBranding()) {
|
||||||
MessageBox(0,NSISERROR,_T("Error"),MB_ICONEXCLAMATION|MB_OK);
|
MessageBox(0,NSISERROR,ERRBOXTITLE,MB_ICONEXCLAMATION|MB_OK);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
ResetObjects();
|
ResetObjects();
|
||||||
HWND hDialog = CreateDialog(g_sdata.hInstance,MAKEINTRESOURCE(DLG_MAIN),0,DialogProc);
|
HWND hDialog = CreateDialog(g_sdata.hInstance,MAKEINTRESOURCE(DLG_MAIN),0,DialogProc);
|
||||||
if (!hDialog) {
|
if (!hDialog) {
|
||||||
MessageBox(0,DLGERROR,_T("Error"),MB_ICONEXCLAMATION|MB_OK);
|
MessageBox(0,DLGERROR,ERRBOXTITLE,MB_ICONEXCLAMATION|MB_OK);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
haccel = LoadAccelerators(g_sdata.hInstance, MAKEINTRESOURCE(IDK_ACCEL));
|
haccel = LoadAccelerators(g_sdata.hInstance, MAKEINTRESOURCE(IDK_ACCEL));
|
||||||
|
@ -85,7 +80,7 @@ int WINAPI _tWinMain(HINSTANCE hInst,HINSTANCE hOldInst,LPTSTR CmdLineParams,int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (g_sdata.script) GlobalFree(g_sdata.script);
|
MemSafeFree(g_sdata.script);
|
||||||
if (g_sdata.script_cmd_args) GlobalFree(g_sdata.script_cmd_args);
|
if (g_sdata.script_cmd_args) GlobalFree(g_sdata.script_cmd_args);
|
||||||
if (g_sdata.sigint_event) CloseHandle(g_sdata.sigint_event);
|
if (g_sdata.sigint_event) CloseHandle(g_sdata.sigint_event);
|
||||||
if (g_sdata.sigint_event_legacy) CloseHandle(g_sdata.sigint_event_legacy);
|
if (g_sdata.sigint_event_legacy) CloseHandle(g_sdata.sigint_event_legacy);
|
||||||
|
@ -96,10 +91,7 @@ int WINAPI _tWinMain(HINSTANCE hInst,HINSTANCE hOldInst,LPTSTR CmdLineParams,int
|
||||||
|
|
||||||
void SetScript(const TCHAR *script, bool clearArgs /*= true*/)
|
void SetScript(const TCHAR *script, bool clearArgs /*= true*/)
|
||||||
{
|
{
|
||||||
if (g_sdata.script)
|
MemSafeFree(g_sdata.script);
|
||||||
{
|
|
||||||
GlobalFree(g_sdata.script);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (clearArgs)
|
if (clearArgs)
|
||||||
{
|
{
|
||||||
|
@ -112,7 +104,7 @@ void SetScript(const TCHAR *script, bool clearArgs /*= true*/)
|
||||||
g_sdata.script_cmd_args = GlobalAlloc(GHND, sizeof(TCHAR));
|
g_sdata.script_cmd_args = GlobalAlloc(GHND, sizeof(TCHAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
g_sdata.script = (TCHAR *) GlobalAlloc(GPTR, (lstrlen(script) + 1)*sizeof(TCHAR));
|
g_sdata.script = (TCHAR*) MemAlloc((lstrlen(script) + 1)*sizeof(TCHAR));
|
||||||
lstrcpy(g_sdata.script, script);
|
lstrcpy(g_sdata.script, script);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,12 +165,10 @@ void ProcessCommandLine()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MemSafeFree(argv);
|
||||||
if (argv)
|
|
||||||
GlobalFree(argv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
|
@ -196,15 +186,15 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||||
RestoreMRUList();
|
RestoreMRUList();
|
||||||
CreateToolBar();
|
CreateToolBar();
|
||||||
InitTooltips(g_sdata.hwnd);
|
InitTooltips(g_sdata.hwnd);
|
||||||
SetBranding(g_sdata.hwnd);
|
SetDlgItemText(g_sdata.hwnd,IDC_VERSION,g_sdata.branding);
|
||||||
HFONT hFont = CreateFont(14,0,0,0,FW_NORMAL,0,0,0,DEFAULT_CHARSET,OUT_CHARACTER_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FIXED_PITCH|FF_DONTCARE,_T("Courier New"));
|
HFONT hFont = CreateFont(14,FW_NORMAL,FIXED_PITCH|FF_DONTCARE,_T("Courier New"));
|
||||||
SendDlgItemMessage(hwndDlg,IDC_LOGWIN,WM_SETFONT,(WPARAM)hFont,0);
|
SendDlgItemMessage(hwndDlg,IDC_LOGWIN,WM_SETFONT,(WPARAM)hFont,0);
|
||||||
RestoreWindowPos(g_sdata.hwnd);
|
RestoreWindowPos(g_sdata.hwnd);
|
||||||
RestoreCompressor();
|
RestoreCompressor();
|
||||||
SetScript(_T(""));
|
SetScript(_T(""));
|
||||||
g_sdata.compressor = COMPRESSOR_NONE_SELECTED;
|
g_sdata.compressor = COMPRESSOR_NONE_SELECTED;
|
||||||
g_sdata.userSelectCompressor = FALSE;
|
g_sdata.userSelectCompressor = FALSE;
|
||||||
|
|
||||||
ProcessCommandLine();
|
ProcessCommandLine();
|
||||||
|
|
||||||
if(g_sdata.compressor == COMPRESSOR_NONE_SELECTED) {
|
if(g_sdata.compressor == COMPRESSOR_NONE_SELECTED) {
|
||||||
|
@ -224,12 +214,10 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||||
case WM_PAINT:
|
case WM_PAINT:
|
||||||
{
|
{
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
GetClientRect(g_sdata.hwnd, &g_resize.griprect);
|
GetGripperPos(hwndDlg, g_resize.griprect);
|
||||||
HDC hdc = BeginPaint(g_sdata.hwnd, &ps);
|
HDC hdc = BeginPaint(hwndDlg, &ps);
|
||||||
g_resize.griprect.left = g_resize.griprect.right - GetSystemMetrics(SM_CXVSCROLL);
|
|
||||||
g_resize.griprect.top = g_resize.griprect.bottom - GetSystemMetrics(SM_CYVSCROLL);
|
|
||||||
DrawFrameControl(hdc, &g_resize.griprect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP);
|
DrawFrameControl(hdc, &g_resize.griprect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP);
|
||||||
EndPaint(g_sdata.hwnd,&ps);
|
EndPaint(hwndDlg, &ps);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
|
@ -266,7 +254,7 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||||
CompileNSISScript();
|
CompileNSISScript();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MessageBox(hwndDlg,MULTIDROPERROR,_T("Error"),MB_OK|MB_ICONSTOP);
|
MessageBox(hwndDlg,MULTIDROPERROR,ERRBOXTITLE,MB_OK|MB_ICONSTOP);
|
||||||
}
|
}
|
||||||
DragFinish((HDROP)wParam);
|
DragFinish((HDROP)wParam);
|
||||||
break;
|
break;
|
||||||
|
@ -297,12 +285,22 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||||
}
|
}
|
||||||
case WM_SIZING:
|
case WM_SIZING:
|
||||||
{
|
{
|
||||||
InvalidateRect(g_sdata.hwnd,&g_resize.griprect,TRUE);
|
InvalidateRect(hwndDlg, &g_resize.griprect, TRUE);
|
||||||
GetClientRect(g_sdata.hwnd, &g_resize.griprect);
|
GetGripperPos(hwndDlg, g_resize.griprect);
|
||||||
g_resize.griprect.left = g_resize.griprect.right - GetSystemMetrics(SM_CXVSCROLL);
|
|
||||||
g_resize.griprect.top = g_resize.griprect.bottom - GetSystemMetrics(SM_CYVSCROLL);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
case WM_NCHITTEST:
|
||||||
|
{
|
||||||
|
RECT r = g_resize.griprect;
|
||||||
|
MapWindowPoints(hwndDlg, 0, (POINT*)&r, 2);
|
||||||
|
POINT pt = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
|
||||||
|
if (PtInRect(&r, pt))
|
||||||
|
{
|
||||||
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, HTBOTTOMRIGHT);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
case WM_MAKENSIS_PROCESSCOMPLETE:
|
case WM_MAKENSIS_PROCESSCOMPLETE:
|
||||||
{
|
{
|
||||||
if (g_sdata.thread) {
|
if (g_sdata.thread) {
|
||||||
|
@ -472,8 +470,8 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||||
PCOPYDATASTRUCT cds = PCOPYDATASTRUCT(lParam);
|
PCOPYDATASTRUCT cds = PCOPYDATASTRUCT(lParam);
|
||||||
switch (cds->dwData) {
|
switch (cds->dwData) {
|
||||||
case MakensisAPI::NOTIFY_SCRIPT:
|
case MakensisAPI::NOTIFY_SCRIPT:
|
||||||
if (g_sdata.input_script) GlobalFree(g_sdata.input_script);
|
MemSafeFree(g_sdata.input_script);
|
||||||
g_sdata.input_script = (TCHAR *)GlobalAlloc(GPTR, cds->cbData * sizeof(TCHAR));
|
g_sdata.input_script = (TCHAR*) MemAlloc(cds->cbData * sizeof(TCHAR));
|
||||||
lstrcpy(g_sdata.input_script, (TCHAR *)cds->lpData);
|
lstrcpy(g_sdata.input_script, (TCHAR *)cds->lpData);
|
||||||
break;
|
break;
|
||||||
case MakensisAPI::NOTIFY_WARNING:
|
case MakensisAPI::NOTIFY_WARNING:
|
||||||
|
@ -482,8 +480,8 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||||
case MakensisAPI::NOTIFY_ERROR:
|
case MakensisAPI::NOTIFY_ERROR:
|
||||||
break;
|
break;
|
||||||
case MakensisAPI::NOTIFY_OUTPUT:
|
case MakensisAPI::NOTIFY_OUTPUT:
|
||||||
if (g_sdata.output_exe) GlobalFree(g_sdata.output_exe);
|
MemSafeFree(g_sdata.output_exe);
|
||||||
g_sdata.output_exe = (TCHAR *)GlobalAlloc(GPTR, cds->cbData * sizeof(TCHAR));
|
g_sdata.output_exe = (TCHAR*) MemAlloc(cds->cbData * sizeof(TCHAR));
|
||||||
lstrcpy(g_sdata.output_exe, (TCHAR *)cds->lpData);
|
lstrcpy(g_sdata.output_exe, (TCHAR *)cds->lpData);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -656,15 +654,17 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||||
lstrcpy(buf,_T("output"));
|
lstrcpy(buf,_T("output"));
|
||||||
if (GetSaveFileName(&l)) {
|
if (GetSaveFileName(&l)) {
|
||||||
HANDLE hFile = CreateFile(buf,GENERIC_WRITE,0,0,CREATE_ALWAYS,0,0);
|
HANDLE hFile = CreateFile(buf,GENERIC_WRITE,0,0,CREATE_ALWAYS,0,0);
|
||||||
if (hFile) {
|
if (INVALID_HANDLE_VALUE != hFile) {
|
||||||
int len=SendDlgItemMessage(g_sdata.hwnd,IDC_LOGWIN,WM_GETTEXTLENGTH,0,0);
|
int len=SendDlgItemMessage(g_sdata.hwnd,IDC_LOGWIN,WM_GETTEXTLENGTH,0,0);
|
||||||
TCHAR *existing_text=(TCHAR*)GlobalAlloc(GPTR,len * sizeof(TCHAR));
|
TCHAR *existing_text=(TCHAR*) MemAlloc(len * sizeof(TCHAR));
|
||||||
existing_text[0]=0;
|
if (existing_text) { // BUGBUG:TODO: Error message for bad hFile and existing_text?
|
||||||
GetDlgItemText(g_sdata.hwnd, IDC_LOGWIN, existing_text, len);
|
existing_text[0]=0;
|
||||||
DWORD dwWritten = 0;
|
GetDlgItemText(g_sdata.hwnd, IDC_LOGWIN, existing_text, len);
|
||||||
WriteFile(hFile,existing_text,len,&dwWritten,0);
|
DWORD dwWritten = 0;
|
||||||
|
WriteFile(hFile,existing_text,len,&dwWritten,0);
|
||||||
|
MemFree(existing_text);
|
||||||
|
}
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
GlobalFree(existing_text);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -676,9 +676,8 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||||
g_find.fr.lStructSize = sizeof(FINDREPLACE);
|
g_find.fr.lStructSize = sizeof(FINDREPLACE);
|
||||||
g_find.fr.hwndOwner = hwndDlg;
|
g_find.fr.hwndOwner = hwndDlg;
|
||||||
g_find.fr.Flags = FR_NOUPDOWN;
|
g_find.fr.Flags = FR_NOUPDOWN;
|
||||||
g_find.fr.lpstrFindWhat = (TCHAR *)GlobalAlloc(GPTR, 128 * sizeof(TCHAR));
|
g_find.fr.lpstrFindWhat = g_findbuf;
|
||||||
if (!g_find.fr.lpstrFindWhat) return TRUE;
|
g_find.fr.wFindWhatLen = COUNTOF(g_findbuf);
|
||||||
g_find.fr.wFindWhatLen = 128;
|
|
||||||
g_find.hwndFind = FindText(&g_find.fr);
|
g_find.hwndFind = FindText(&g_find.fr);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -815,50 +814,34 @@ BOOL CALLBACK DialogResize(HWND hWnd, LPARAM /* unused */)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK AboutProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
INT_PTR CALLBACK AboutProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||||
switch(msg) {
|
switch(msg) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
HFONT bfont = CreateFont(13,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,DEFAULT_CHARSET,
|
HFONT fontnorm = CreateFont(13, FW_NORMAL, FIXED_PITCH|FF_DONTCARE, _T("Tahoma")),
|
||||||
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
|
fontbold = CreateFont(13, FW_BOLD, FIXED_PITCH|FF_DONTCARE, _T("Tahoma"));
|
||||||
FIXED_PITCH|FF_DONTCARE, _T("Tahoma"));
|
if (!fontbold) {
|
||||||
HFONT bfontb = CreateFont(13,0,0,0,FW_BOLD,FALSE,FALSE,FALSE,DEFAULT_CHARSET,
|
fontnorm = CreateFont(12, FW_NORMAL, FIXED_PITCH|FF_DONTCARE, _T("MS Shell Dlg"));
|
||||||
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
|
fontbold = CreateFont(12, FW_BOLD, FIXED_PITCH|FF_DONTCARE, _T("MS Shell Dlg"));
|
||||||
FIXED_PITCH|FF_DONTCARE, _T("Tahoma"));
|
|
||||||
HFONT rfont = CreateFont(12,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,DEFAULT_CHARSET,
|
|
||||||
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
|
|
||||||
FIXED_PITCH|FF_DONTCARE, _T("MS Shell Dlg"));
|
|
||||||
HFONT rfontb = CreateFont(12,0,0,0,FW_BOLD,FALSE,FALSE,FALSE,DEFAULT_CHARSET,
|
|
||||||
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
|
|
||||||
FIXED_PITCH|FF_DONTCARE, _T("MS Shell Dlg"));
|
|
||||||
if (bfont&&bfontb) {
|
|
||||||
SendDlgItemMessage(hwndDlg, IDC_ABOUTVERSION, WM_SETFONT, (WPARAM)bfontb, FALSE);
|
|
||||||
SendDlgItemMessage(hwndDlg, IDC_ABOUTCOPY, WM_SETFONT, (WPARAM)bfont, FALSE);
|
|
||||||
SendDlgItemMessage(hwndDlg, IDC_ABOUTPORTIONS, WM_SETFONT, (WPARAM)bfont, FALSE);
|
|
||||||
SendDlgItemMessage(hwndDlg, IDC_NSISVER, WM_SETFONT, (WPARAM)bfont, FALSE);
|
|
||||||
SendDlgItemMessage(hwndDlg, IDC_OTHERCONTRIB, WM_SETFONT, (WPARAM)bfont, FALSE);
|
|
||||||
}
|
}
|
||||||
else if (rfont&&rfontb) {
|
SendDlgItemMessage(hwndDlg, IDC_ABOUTVERSION, WM_SETFONT, (WPARAM)fontbold, FALSE);
|
||||||
SendDlgItemMessage(hwndDlg, IDC_ABOUTVERSION, WM_SETFONT, (WPARAM)rfontb, FALSE);
|
SendDlgItemMessage(hwndDlg, IDC_ABOUTCOPY, WM_SETFONT, (WPARAM)fontnorm, FALSE);
|
||||||
SendDlgItemMessage(hwndDlg, IDC_ABOUTCOPY, WM_SETFONT, (WPARAM)rfont, FALSE);
|
SendDlgItemMessage(hwndDlg, IDC_ABOUTPORTIONS, WM_SETFONT, (WPARAM)fontnorm, FALSE);
|
||||||
SendDlgItemMessage(hwndDlg, IDC_ABOUTPORTIONS, WM_SETFONT, (WPARAM)rfont, FALSE);
|
SendDlgItemMessage(hwndDlg, IDC_NSISVER, WM_SETFONT, (WPARAM)fontnorm, FALSE);
|
||||||
SendDlgItemMessage(hwndDlg, IDC_NSISVER, WM_SETFONT, (WPARAM)rfont, FALSE);
|
SendDlgItemMessage(hwndDlg, IDC_OTHERCONTRIB, WM_SETFONT, (WPARAM)fontnorm, FALSE);
|
||||||
SendDlgItemMessage(hwndDlg, IDC_OTHERCONTRIB, WM_SETFONT, (WPARAM)rfont, FALSE);
|
SetDlgItemText(hwndDlg, IDC_NSISVER, g_sdata.branding);
|
||||||
}
|
SetDlgItemText(hwndDlg, IDC_ABOUTVERSION, NSISW_VERSION);
|
||||||
SetDlgItemText(hwndDlg,IDC_NSISVER,g_sdata.branding);
|
SetDlgItemText(hwndDlg, IDC_ABOUTCOPY, COPYRIGHT);
|
||||||
SetDlgItemText(hwndDlg,IDC_ABOUTVERSION,NSISW_VERSION);
|
SetDlgItemText(hwndDlg, IDC_OTHERCONTRIB, CONTRIB);
|
||||||
SetDlgItemText(hwndDlg,IDC_ABOUTCOPY,COPYRIGHT);
|
|
||||||
SetDlgItemText(hwndDlg,IDC_OTHERCONTRIB,CONTRIB);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
{
|
if (IDOK == LOWORD(wParam)) EndDialog(hwndDlg, TRUE);
|
||||||
switch (LOWORD(wParam)) {
|
break;
|
||||||
case IDOK:
|
case WM_DESTROY:
|
||||||
EndDialog(hwndDlg, TRUE);
|
DeleteObject((HGDIOBJ)SendDlgItemMessage(hwndDlg, IDC_ABOUTVERSION, WM_GETFONT, 0, 0));
|
||||||
break;
|
DeleteObject((HGDIOBJ)SendDlgItemMessage(hwndDlg, IDC_ABOUTCOPY, WM_GETFONT, 0, 0));
|
||||||
}
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -918,7 +901,7 @@ TCHAR **GetSymbols(HWND hwndDlg)
|
||||||
symbols = (TCHAR **)GlobalLock(hMem);
|
symbols = (TCHAR **)GlobalLock(hMem);
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
int len = SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_GETTEXTLEN, (WPARAM)i, 0);
|
int len = SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_GETTEXTLEN, (WPARAM)i, 0);
|
||||||
symbols[i] = (TCHAR *)GlobalAlloc(GPTR, (len+1)*sizeof(TCHAR));
|
symbols[i] = (TCHAR*) MemAllocZI((len+1)*sizeof(TCHAR));
|
||||||
SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_GETTEXT, (WPARAM)i, (LPARAM)symbols[i]);
|
SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_GETTEXT, (WPARAM)i, (LPARAM)symbols[i]);
|
||||||
}
|
}
|
||||||
symbols[n] = NULL;
|
symbols[n] = NULL;
|
||||||
|
@ -927,7 +910,7 @@ TCHAR **GetSymbols(HWND hwndDlg)
|
||||||
return symbols;
|
return symbols;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK SettingsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
INT_PTR CALLBACK SettingsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||||
switch(msg) {
|
switch(msg) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
|
@ -997,23 +980,23 @@ BOOL CALLBACK SettingsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
int n = SendDlgItemMessage(hwndDlg, IDC_SYMBOL, WM_GETTEXTLENGTH, 0, 0);
|
int n = SendDlgItemMessage(hwndDlg, IDC_SYMBOL, WM_GETTEXTLENGTH, 0, 0);
|
||||||
if(n > 0) {
|
if(n > 0) {
|
||||||
TCHAR *buf = (TCHAR *)GlobalAlloc(GPTR, (n+1)*sizeof(TCHAR));
|
TCHAR *buf = (TCHAR*) MemAllocZI((n+1)*sizeof(TCHAR));
|
||||||
SendDlgItemMessage(hwndDlg, IDC_SYMBOL, WM_GETTEXT, n+1, (LPARAM)buf);
|
SendDlgItemMessage(hwndDlg, IDC_SYMBOL, WM_GETTEXT, n+1, (LPARAM)buf);
|
||||||
if(_tcsstr(buf,_T(" ")) || _tcsstr(buf,_T("\t"))) {
|
if(_tcsstr(buf,_T(" ")) || _tcsstr(buf,_T("\t"))) {
|
||||||
MessageBox(hwndDlg,SYMBOLSERROR,_T("Error"),MB_OK|MB_ICONSTOP);
|
MessageBox(hwndDlg,SYMBOLSERROR,ERRBOXTITLE,MB_OK|MB_ICONSTOP);
|
||||||
GlobalFree(buf);
|
MemFree(buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = SendDlgItemMessage(hwndDlg, IDC_VALUE, WM_GETTEXTLENGTH, 0, 0);
|
n = SendDlgItemMessage(hwndDlg, IDC_VALUE, WM_GETTEXTLENGTH, 0, 0);
|
||||||
if(n > 0) {
|
if(n > 0) {
|
||||||
TCHAR *buf2 = (TCHAR *)GlobalAlloc(GPTR, (n+1)*sizeof(TCHAR));
|
TCHAR *buf2 = (TCHAR*) MemAllocZI((n+1)*sizeof(TCHAR));
|
||||||
SendDlgItemMessage(hwndDlg, IDC_VALUE, WM_GETTEXT, n+1, (LPARAM)buf2);
|
SendDlgItemMessage(hwndDlg, IDC_VALUE, WM_GETTEXT, n+1, (LPARAM)buf2);
|
||||||
TCHAR *buf3 = (TCHAR *)GlobalAlloc(GPTR, (lstrlen(buf)+lstrlen(buf2)+2)*sizeof(TCHAR));
|
TCHAR *buf3 = (TCHAR*) MemAllocZI((lstrlen(buf)+lstrlen(buf2)+2)*sizeof(TCHAR));
|
||||||
wsprintf(buf3,_T("%s=%s"),buf,buf2);
|
wsprintf(buf3,_T("%s=%s"),buf,buf2);
|
||||||
GlobalFree(buf);
|
MemFree(buf);
|
||||||
buf = buf3;
|
buf = buf3;
|
||||||
GlobalFree(buf2);
|
MemFree(buf2);
|
||||||
}
|
}
|
||||||
int idx = SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_ADDSTRING, 0, (LPARAM)buf);
|
int idx = SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_ADDSTRING, 0, (LPARAM)buf);
|
||||||
if (idx >= 0)
|
if (idx >= 0)
|
||||||
|
@ -1024,7 +1007,7 @@ BOOL CALLBACK SettingsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
EnableSymbolEditButtons(hwndDlg);
|
EnableSymbolEditButtons(hwndDlg);
|
||||||
SendDlgItemMessage(hwndDlg, IDC_SYMBOL, WM_SETTEXT, 0, 0);
|
SendDlgItemMessage(hwndDlg, IDC_SYMBOL, WM_SETTEXT, 0, 0);
|
||||||
SendDlgItemMessage(hwndDlg, IDC_VALUE, WM_SETTEXT, 0, 0);
|
SendDlgItemMessage(hwndDlg, IDC_VALUE, WM_SETTEXT, 0, 0);
|
||||||
GlobalFree(buf);
|
MemFree(buf);
|
||||||
EnableSymbolSetButtons(hwndDlg);
|
EnableSymbolSetButtons(hwndDlg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1039,7 +1022,7 @@ BOOL CALLBACK SettingsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
if(num == 1) {
|
if(num == 1) {
|
||||||
int n = SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_GETTEXTLEN, (WPARAM)index, 0);
|
int n = SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_GETTEXTLEN, (WPARAM)index, 0);
|
||||||
if(n > 0) {
|
if(n > 0) {
|
||||||
TCHAR *buf = (TCHAR *)GlobalAlloc(GPTR, (n+1)*sizeof(TCHAR));
|
TCHAR *buf = (TCHAR*) MemAllocZI((n+1)*sizeof(TCHAR));
|
||||||
SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_GETTEXT, (WPARAM)index, (LPARAM)buf);
|
SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_GETTEXT, (WPARAM)index, (LPARAM)buf);
|
||||||
TCHAR *p = _tcsstr(buf,_T("="));
|
TCHAR *p = _tcsstr(buf,_T("="));
|
||||||
if(p) {
|
if(p) {
|
||||||
|
@ -1047,7 +1030,7 @@ BOOL CALLBACK SettingsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
*p=0;
|
*p=0;
|
||||||
}
|
}
|
||||||
SendDlgItemMessage(hwndDlg, IDC_SYMBOL, WM_SETTEXT, 0, (LPARAM)buf);
|
SendDlgItemMessage(hwndDlg, IDC_SYMBOL, WM_SETTEXT, 0, (LPARAM)buf);
|
||||||
GlobalFree(buf);
|
MemFree(buf);
|
||||||
SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_DELETESTRING, (WPARAM)index, 0);
|
SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_DELETESTRING, (WPARAM)index, 0);
|
||||||
EnableWindow(GetDlgItem(hwndDlg, IDLEFT), FALSE);
|
EnableWindow(GetDlgItem(hwndDlg, IDLEFT), FALSE);
|
||||||
EnableWindow(GetDlgItem(hwndDlg, IDDEL), FALSE);
|
EnableWindow(GetDlgItem(hwndDlg, IDDEL), FALSE);
|
||||||
|
@ -1063,25 +1046,21 @@ BOOL CALLBACK SettingsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IDLOAD:
|
case IDLOAD:
|
||||||
{
|
|
||||||
g_symbol_set_mode=1;
|
|
||||||
DialogBox(g_sdata.hInstance,MAKEINTRESOURCE(DLG_SYMBOLSET),hwndDlg,(DLGPROC)SymbolSetProc);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case IDSAVE:
|
case IDSAVE:
|
||||||
{
|
{
|
||||||
g_symbol_set_mode=2;
|
g_symbol_set_mode = IDLOAD == LOWORD(wParam) ? 1 : 2;
|
||||||
DialogBox(g_sdata.hInstance,MAKEINTRESOURCE(DLG_SYMBOLSET),hwndDlg,(DLGPROC)SymbolSetProc);
|
DialogBox(g_sdata.hInstance,MAKEINTRESOURCE(DLG_SYMBOLSET),hwndDlg,(DLGPROC)SymbolSetProc);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IDDEL:
|
case IDDEL:
|
||||||
{
|
{
|
||||||
int n = SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_GETSELCOUNT, 0, 0);
|
int n = SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_GETSELCOUNT, 0, 0);
|
||||||
int *items = (int *)GlobalAlloc(GPTR, n*sizeof(int));
|
int *items = (int*) MemAllocZI(n*sizeof(int));
|
||||||
SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_GETSELITEMS, (WPARAM)n, (LPARAM)items);
|
if (items) {
|
||||||
int i;
|
SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_GETSELITEMS, (WPARAM)n, (LPARAM)items);
|
||||||
for(i=n-1;i>=0;i--) {
|
for(int i=n-1;i>=0;i--)
|
||||||
SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_DELETESTRING, (WPARAM)items[i], 0);
|
SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_DELETESTRING, (WPARAM)items[i], 0);
|
||||||
|
MemFree(items);
|
||||||
}
|
}
|
||||||
EnableSymbolEditButtons(hwndDlg);
|
EnableSymbolEditButtons(hwndDlg);
|
||||||
EnableSymbolSetButtons(hwndDlg);
|
EnableSymbolSetButtons(hwndDlg);
|
||||||
|
@ -1116,7 +1095,7 @@ BOOL CALLBACK SettingsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK CompressorProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
INT_PTR CALLBACK CompressorProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||||
switch(msg) {
|
switch(msg) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
|
@ -1160,7 +1139,7 @@ BOOL CALLBACK CompressorProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK SymbolSetProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
INT_PTR CALLBACK SymbolSetProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||||
switch(msg) {
|
switch(msg) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
|
@ -1239,12 +1218,12 @@ BOOL CALLBACK SymbolSetProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam
|
||||||
int n = SendDlgItemMessage(hwndDlg, IDC_NAMES, CB_GETCURSEL, 0, 0);
|
int n = SendDlgItemMessage(hwndDlg, IDC_NAMES, CB_GETCURSEL, 0, 0);
|
||||||
if(n != CB_ERR) {
|
if(n != CB_ERR) {
|
||||||
long len = SendDlgItemMessage(hwndDlg, IDC_NAMES, CB_GETLBTEXTLEN, (WPARAM)n, 0);
|
long len = SendDlgItemMessage(hwndDlg, IDC_NAMES, CB_GETLBTEXTLEN, (WPARAM)n, 0);
|
||||||
TCHAR *buf = (TCHAR *)GlobalAlloc(GPTR, (len+1)*sizeof(TCHAR));
|
TCHAR *buf = (TCHAR*) MemAllocZI((len+1)*sizeof(TCHAR));
|
||||||
if(SendDlgItemMessage(hwndDlg, IDC_NAMES, CB_GETLBTEXT, (WPARAM)n, (LPARAM)buf) != CB_ERR) {
|
if(SendDlgItemMessage(hwndDlg, IDC_NAMES, CB_GETLBTEXT, (WPARAM)n, (LPARAM)buf) != CB_ERR) {
|
||||||
SendDlgItemMessage(hwndDlg, IDC_NAMES, CB_DELETESTRING, n, 0);
|
SendDlgItemMessage(hwndDlg, IDC_NAMES, CB_DELETESTRING, n, 0);
|
||||||
DeleteSymbolSet(buf);
|
DeleteSymbolSet(buf);
|
||||||
}
|
}
|
||||||
GlobalFree(buf);
|
MemFree(buf);
|
||||||
}
|
}
|
||||||
EnableWindow(GetDlgItem(hwndDlg, IDDEL), FALSE);
|
EnableWindow(GetDlgItem(hwndDlg, IDDEL), FALSE);
|
||||||
break;
|
break;
|
||||||
|
@ -1254,12 +1233,7 @@ BOOL CALLBACK SymbolSetProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam
|
||||||
if(HIWORD(wParam) == CBN_SELCHANGE)
|
if(HIWORD(wParam) == CBN_SELCHANGE)
|
||||||
{
|
{
|
||||||
int n = SendDlgItemMessage(hwndDlg, IDC_NAMES, CB_GETCURSEL, 0, 0);
|
int n = SendDlgItemMessage(hwndDlg, IDC_NAMES, CB_GETCURSEL, 0, 0);
|
||||||
if(n == CB_ERR) {
|
EnableWindow(GetDlgItem(hwndDlg, IDDEL), CB_ERR != n);
|
||||||
EnableWindow(GetDlgItem(hwndDlg, IDDEL), FALSE);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
EnableWindow(GetDlgItem(hwndDlg, IDDEL), TRUE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if(HIWORD(wParam) == CBN_DBLCLK)
|
else if(HIWORD(wParam) == CBN_DBLCLK)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,9 +39,10 @@
|
||||||
#define NSIS_DL_URL "http://nsis.sourceforge.net/download/"
|
#define NSIS_DL_URL "http://nsis.sourceforge.net/download/"
|
||||||
#define USAGE _T("Usage:\r\n\r\n - File | Load Script...\r\n - Drag the .nsi file into this window\r\n - Right click the .nsi file and choose \"Compile NSIS Script\"")
|
#define USAGE _T("Usage:\r\n\r\n - File | Load Script...\r\n - Drag the .nsi file into this window\r\n - Right click the .nsi file and choose \"Compile NSIS Script\"")
|
||||||
#define COPYRIGHT _T("Copyright (C) 2002 Robert Rainwater")
|
#define COPYRIGHT _T("Copyright (C) 2002 Robert Rainwater")
|
||||||
#define CONTRIB _T("Fritz Elfert, Justin Frankel, Amir Szekely, Sunil Kamath, Joost Verburg")
|
#define CONTRIB _T("Fritz Elfert, Justin Frankel, Amir Szekely, Sunil Kamath, Joost Verburg, Anders Kjersem")
|
||||||
#define DOCPATH "http://nsis.sourceforge.net/Docs/"
|
#define DOCPATH "http://nsis.sourceforge.net/Docs/"
|
||||||
#define LOCALDOCS _T("\\NSIS.chm")
|
#define LOCALDOCS _T("\\NSIS.chm")
|
||||||
|
#define ERRBOXTITLE 0 //_T("Error")
|
||||||
#define NSISERROR _T("Unable to intialize MakeNSIS. Please verify that makensis.exe is in the same directory as makensisw.exe.")
|
#define NSISERROR _T("Unable to intialize MakeNSIS. Please verify that makensis.exe is in the same directory as makensisw.exe.")
|
||||||
#define DLGERROR _T("Unable to intialize MakeNSISW.")
|
#define DLGERROR _T("Unable to intialize MakeNSISW.")
|
||||||
#define SYMBOLSERROR _T("Symbol cannot contain whitespace characters")
|
#define SYMBOLSERROR _T("Symbol cannot contain whitespace characters")
|
||||||
|
@ -155,14 +156,13 @@ int compressor_strings[] = {IDS_SCRIPT,
|
||||||
|
|
||||||
extern const TCHAR* NSISW_VERSION;
|
extern const TCHAR* NSISW_VERSION;
|
||||||
|
|
||||||
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
||||||
DWORD WINAPI MakeNSISProc(LPVOID p);
|
DWORD WINAPI MakeNSISProc(LPVOID p);
|
||||||
BOOL CALLBACK DialogResize(HWND hWnd, LPARAM /* unused*/);
|
INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
BOOL CALLBACK AboutNSISProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
|
BOOL CALLBACK DialogResize(HWND hWnd, LPARAM /* unused*/);
|
||||||
BOOL CALLBACK AboutProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
|
INT_PTR CALLBACK AboutProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||||
BOOL CALLBACK SettingsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
|
INT_PTR CALLBACK SettingsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||||
BOOL CALLBACK SymbolSetProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
|
INT_PTR CALLBACK SymbolSetProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||||
BOOL CALLBACK CompressorProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
|
INT_PTR CALLBACK CompressorProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||||
void SetScript(const TCHAR *script, bool clearArgs = true);
|
void SetScript(const TCHAR *script, bool clearArgs = true);
|
||||||
void CompileNSISScript();
|
void CompileNSISScript();
|
||||||
TCHAR* BuildSymbols();
|
TCHAR* BuildSymbols();
|
||||||
|
|
|
@ -27,12 +27,6 @@
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "toolbar.h"
|
#include "toolbar.h"
|
||||||
|
|
||||||
#ifdef _countof
|
|
||||||
#define COUNTOF _countof
|
|
||||||
#else
|
|
||||||
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NTOOLBAR g_toolbar;
|
NTOOLBAR g_toolbar;
|
||||||
extern NSCRIPTDATA g_sdata;
|
extern NSCRIPTDATA g_sdata;
|
||||||
extern NTOOLTIP g_tip;
|
extern NTOOLTIP g_tip;
|
||||||
|
|
|
@ -49,8 +49,7 @@ int getProxyInfo(char *out) {
|
||||||
DWORD CALLBACK UpdateThread(LPVOID v) {
|
DWORD CALLBACK UpdateThread(LPVOID v) {
|
||||||
#define RSZ 30
|
#define RSZ 30
|
||||||
int len;
|
int len;
|
||||||
char *response = (char *)GlobalAlloc(GPTR,RSZ);
|
char response[RSZ], *r;
|
||||||
char *r;
|
|
||||||
char url[300];
|
char url[300];
|
||||||
BOOL error = FALSE;
|
BOOL error = FALSE;
|
||||||
static char pbuf[8192];
|
static char pbuf[8192];
|
||||||
|
@ -72,7 +71,7 @@ DWORD CALLBACK UpdateThread(LPVOID v) {
|
||||||
|
|
||||||
InitializeUpdate();
|
InitializeUpdate();
|
||||||
|
|
||||||
JNL_HTTPGet *get = new JNL_HTTPGet(g_dns,8192,(p&&p[0])?p:NULL);;
|
JNL_HTTPGet *get = new JNL_HTTPGet(g_dns,8192,(p&&p[0])?p:NULL);
|
||||||
lstrcpyA(url,NSIS_UPDATE);
|
lstrcpyA(url,NSIS_UPDATE);
|
||||||
lstrcatA(url,g_sdata.brandingv);
|
lstrcatA(url,g_sdata.brandingv);
|
||||||
|
|
||||||
|
@ -107,36 +106,32 @@ DWORD CALLBACK UpdateThread(LPVOID v) {
|
||||||
}
|
}
|
||||||
else if (*response=='1'&&lstrlenA(response)>2) {
|
else if (*response=='1'&&lstrlenA(response)>2) {
|
||||||
char buf[200];
|
char buf[200];
|
||||||
response+=2;
|
wsprintfA(buf, "NSIS %s is now available. Would you like to download it now?",response+2);
|
||||||
wsprintfA(buf, "NSIS %s is now available. Would you like to download it now?",response);
|
|
||||||
if (MessageBoxA(g_sdata.hwnd,buf,"NSIS Update",MB_YESNO|MB_ICONINFORMATION)==IDYES) {
|
if (MessageBoxA(g_sdata.hwnd,buf,"NSIS Update",MB_YESNO|MB_ICONINFORMATION)==IDYES) {
|
||||||
ShellExecuteA(g_sdata.hwnd,"open",NSIS_DL_URL,NULL,NULL,SW_SHOWNORMAL);
|
ShellExecuteA(g_sdata.hwnd,"open",NSIS_DL_URL,NULL,NULL,SW_SHOWNORMAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (*response=='2'&&lstrlenA(response)>2) {
|
else if (*response=='2'&&lstrlenA(response)>2) {
|
||||||
char buf[200];
|
char buf[200];
|
||||||
response+=2;
|
wsprintfA(buf,"NSIS %s is now available. Would you like to download this preview release now?",response+2);
|
||||||
wsprintfA(buf,"NSIS %s is now available. Would you like to download this preview release now?",response);
|
|
||||||
if (MessageBoxA(g_sdata.hwnd,buf,"NSIS Update",MB_YESNO|MB_ICONINFORMATION)==IDYES) {
|
if (MessageBoxA(g_sdata.hwnd,buf,"NSIS Update",MB_YESNO|MB_ICONINFORMATION)==IDYES) {
|
||||||
ShellExecuteA(g_sdata.hwnd,"open",NSIS_DL_URL,NULL,NULL,SW_SHOWNORMAL);
|
ShellExecuteA(g_sdata.hwnd,"open",NSIS_DL_URL,NULL,NULL,SW_SHOWNORMAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else MessageBoxA(g_sdata.hwnd,"There is no update available for NSIS at this time.","NSIS Update",MB_OK|MB_ICONINFORMATION);
|
else MessageBoxA(g_sdata.hwnd,"There is no update available for NSIS at this time.","NSIS Update",MB_OK|MB_ICONINFORMATION);
|
||||||
GlobalFree(response);
|
|
||||||
delete get;
|
delete get;
|
||||||
EnableMenuItem(g_sdata.menu,IDM_NSISUPDATE,MF_ENABLED);
|
EnableMenuItem(g_sdata.menu,IDM_NSISUPDATE,MF_ENABLED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update() {
|
void Update() {
|
||||||
DWORD dwThreadId;
|
|
||||||
|
|
||||||
if (strstr(g_sdata.brandingv,"cvs"))
|
if (strstr(g_sdata.brandingv,"cvs"))
|
||||||
{
|
{
|
||||||
MessageBox(g_sdata.hwnd,_T("Cannot check for new version of nightly builds. To update, download a new nightly build."),_T("NSIS Update"),MB_OK|MB_ICONSTOP);
|
MessageBoxA(g_sdata.hwnd,"Cannot check for new version of nightly builds. To update, download a new nightly build.","NSIS Update",MB_OK|MB_ICONSTOP);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EnableMenuItem(g_sdata.menu,IDM_NSISUPDATE,MF_GRAYED);
|
EnableMenuItem(g_sdata.menu,IDM_NSISUPDATE,MF_GRAYED);
|
||||||
CloseHandle(CreateThread(NULL,0,UpdateThread,(LPVOID)NULL,0,&dwThreadId));
|
DWORD tid;
|
||||||
|
CloseHandle(CreateThread(NULL,0,UpdateThread,NULL,0,&tid));
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,12 +27,6 @@
|
||||||
#include "toolbar.h"
|
#include "toolbar.h"
|
||||||
#include <shlwapi.h>
|
#include <shlwapi.h>
|
||||||
|
|
||||||
#ifdef _countof
|
|
||||||
#define COUNTOF _countof
|
|
||||||
#else
|
|
||||||
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NTOOLTIP g_tip;
|
NTOOLTIP g_tip;
|
||||||
LRESULT CALLBACK TipHookProc(int nCode, WPARAM wParam, LPARAM lParam);
|
LRESULT CALLBACK TipHookProc(int nCode, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
|
@ -41,8 +35,10 @@ TCHAR g_mru_list[MRU_LIST_SIZE][MAX_PATH] = { _T(""), _T(""), _T(""), _T(""), _T
|
||||||
extern NSCRIPTDATA g_sdata;
|
extern NSCRIPTDATA g_sdata;
|
||||||
extern const TCHAR *compressor_names[];
|
extern const TCHAR *compressor_names[];
|
||||||
|
|
||||||
int SetArgv(const TCHAR *cmdLine, TCHAR ***argv)
|
void MemSafeFree(void*mem) { if (mem) GlobalFree(mem); }
|
||||||
{
|
void*MemAllocZI(SIZE_T cb) { return GlobalAlloc(GPTR, cb); }
|
||||||
|
|
||||||
|
int SetArgv(const TCHAR *cmdLine, TCHAR ***argv) {
|
||||||
const TCHAR *p;
|
const TCHAR *p;
|
||||||
TCHAR *arg, *argSpace;
|
TCHAR *arg, *argSpace;
|
||||||
int size, argSpaceSize, inquote, copy, slashes;
|
int size, argSpaceSize, inquote, copy, slashes;
|
||||||
|
@ -61,7 +57,7 @@ int SetArgv(const TCHAR *cmdLine, TCHAR ***argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
argSpaceSize = (size+1) * sizeof(TCHAR *) + (lstrlen(cmdLine) + 1) * sizeof(TCHAR);
|
argSpaceSize = (size+1) * sizeof(TCHAR *) + (lstrlen(cmdLine) + 1) * sizeof(TCHAR);
|
||||||
argSpace = (TCHAR *) GlobalAlloc(GMEM_FIXED, argSpaceSize);
|
argSpace = (TCHAR *) MemAlloc(argSpaceSize);
|
||||||
*argv = (TCHAR **) argSpace;
|
*argv = (TCHAR **) argSpace;
|
||||||
if (!argSpace)
|
if (!argSpace)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -132,10 +128,6 @@ void SetTitle(HWND hwnd,const TCHAR *substr) {
|
||||||
SetWindowText(hwnd,title);
|
SetWindowText(hwnd,title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetBranding(HWND hwnd) {
|
|
||||||
SetDlgItemText(hwnd, IDC_VERSION, g_sdata.branding);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CopyToClipboard(HWND hwnd) {
|
void CopyToClipboard(HWND hwnd) {
|
||||||
if (!hwnd||!OpenClipboard(hwnd)) return;
|
if (!hwnd||!OpenClipboard(hwnd)) return;
|
||||||
int len=SendDlgItemMessage(hwnd,IDC_LOGWIN,WM_GETTEXTLENGTH,0,0);
|
int len=SendDlgItemMessage(hwnd,IDC_LOGWIN,WM_GETTEXTLENGTH,0,0);
|
||||||
|
@ -174,7 +166,7 @@ void ErrorMessage(HWND hwnd,const TCHAR *str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Altered by Darren Owen (DrO) on 1/10/2003
|
// Altered by Darren Owen (DrO) on 1/10/2003
|
||||||
void Items(HWND hwnd, int on){
|
void Items(HWND hwnd, int on) {
|
||||||
UINT mf = (!on ? MF_GRAYED : MF_ENABLED);
|
UINT mf = (!on ? MF_GRAYED : MF_ENABLED);
|
||||||
UINT nmf = (!on ? MF_ENABLED : MF_GRAYED);
|
UINT nmf = (!on ? MF_ENABLED : MF_GRAYED);
|
||||||
|
|
||||||
|
@ -190,26 +182,25 @@ void Items(HWND hwnd, int on){
|
||||||
EnableWindow(GetDlgItem(hwnd,IDC_TEST),on);
|
EnableWindow(GetDlgItem(hwnd,IDC_TEST),on);
|
||||||
EnableWindow(GetDlgItem(hwnd,IDC_RECOMPILE_TEST),on);
|
EnableWindow(GetDlgItem(hwnd,IDC_RECOMPILE_TEST),on);
|
||||||
|
|
||||||
EnableMenuItem(g_sdata.menu,IDM_SAVE,mf);
|
const HMENU menu = g_sdata.menu;
|
||||||
|
EnableMenuItem(menu,IDM_CANCEL,nmf);
|
||||||
// Altered by Darren Owen (DrO) on 6/10/2003
|
// Altered by Darren Owen (DrO) on 6/10/2003
|
||||||
if((!g_sdata.retcode && on) || !on)
|
if((!g_sdata.retcode && on) || !on)
|
||||||
EnableMenuItem(g_sdata.menu,IDM_TEST,mf);
|
EnableMenuItem(menu,IDM_TEST,mf);
|
||||||
EnableMenuItem(g_sdata.menu,IDM_EXIT,mf);
|
const UINT mcmdbase = IDM_COMPRESSOR;
|
||||||
EnableMenuItem(g_sdata.menu,IDM_LOADSCRIPT,mf);
|
static const UINT8 mcmds [] = {
|
||||||
EnableMenuItem(g_sdata.menu,IDM_RECOMPILE,mf);
|
UINT8(IDM_SAVE-mcmdbase), UINT8(IDM_EXIT-mcmdbase), UINT8(IDM_LOADSCRIPT-mcmdbase),
|
||||||
EnableMenuItem(g_sdata.menu,IDM_COPY,mf);
|
UINT8(IDM_RECOMPILE-mcmdbase), UINT8(IDM_COPY-mcmdbase), UINT8(IDM_COPYSELECTED-mcmdbase),
|
||||||
EnableMenuItem(g_sdata.menu,IDM_COPYSELECTED,mf);
|
UINT8(IDM_EDITSCRIPT-mcmdbase), UINT8(IDM_CLEARLOG-mcmdbase), UINT8(IDM_BROWSESCR-mcmdbase),
|
||||||
EnableMenuItem(g_sdata.menu,IDM_EDITSCRIPT,mf);
|
UINT8(IDM_RECOMPILE_TEST-mcmdbase), UINT8(IDM_COMPRESSOR-mcmdbase)
|
||||||
EnableMenuItem(g_sdata.menu,IDM_CLEARLOG,mf);
|
};
|
||||||
EnableMenuItem(g_sdata.menu,IDM_BROWSESCR,mf);
|
for (UINT i = 0; i < COUNTOF(mcmds); ++i)
|
||||||
EnableMenuItem(g_sdata.menu,IDM_RECOMPILE_TEST,mf);
|
EnableMenuItem(menu,mcmdbase+mcmds[i],mf);
|
||||||
EnableMenuItem(g_sdata.menu,IDM_COMPRESSOR,mf);
|
|
||||||
EnableMenuItem(g_sdata.menu,IDM_CANCEL,nmf);
|
|
||||||
|
|
||||||
EnableToolBarButton(IDM_SAVE,on);
|
|
||||||
// Altered by Darren Owen (DrO) on 6/10/2003
|
// Altered by Darren Owen (DrO) on 6/10/2003
|
||||||
if((!g_sdata.retcode && on) || !on)
|
if((!g_sdata.retcode && on) || !on)
|
||||||
EnableToolBarButton(IDM_TEST,on);
|
EnableToolBarButton(IDM_TEST,on);
|
||||||
|
EnableToolBarButton(IDM_SAVE,on);
|
||||||
EnableToolBarButton(IDM_EXIT,on);
|
EnableToolBarButton(IDM_EXIT,on);
|
||||||
EnableToolBarButton(IDM_LOADSCRIPT,on);
|
EnableToolBarButton(IDM_LOADSCRIPT,on);
|
||||||
EnableToolBarButton(IDM_RECOMPILE,on);
|
EnableToolBarButton(IDM_RECOMPILE,on);
|
||||||
|
@ -258,7 +249,6 @@ void SetCompressorStats()
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompileNSISScript() {
|
void CompileNSISScript() {
|
||||||
static TCHAR *s;
|
|
||||||
DragAcceptFiles(g_sdata.hwnd,FALSE);
|
DragAcceptFiles(g_sdata.hwnd,FALSE);
|
||||||
ClearLog(g_sdata.hwnd);
|
ClearLog(g_sdata.hwnd);
|
||||||
SetTitle(g_sdata.hwnd,NULL);
|
SetTitle(g_sdata.hwnd,NULL);
|
||||||
|
@ -282,10 +272,9 @@ void CompileNSISScript() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!g_sdata.compile_command) {
|
if (!g_sdata.compile_command) {
|
||||||
if (s) GlobalFree(s);
|
|
||||||
TCHAR *symbols = BuildSymbols();
|
TCHAR *symbols = BuildSymbols();
|
||||||
|
|
||||||
TCHAR compressor[40];
|
TCHAR compressor[40];
|
||||||
|
|
||||||
if(lstrlen(g_sdata.compressor_name)) {
|
if(lstrlen(g_sdata.compressor_name)) {
|
||||||
wsprintf(compressor,_T("/X\"SetCompressor /FINAL %s\""),g_sdata.compressor_name);
|
wsprintf(compressor,_T("/X\"SetCompressor /FINAL %s\""),g_sdata.compressor_name);
|
||||||
}
|
}
|
||||||
|
@ -304,7 +293,7 @@ void CompileNSISScript() {
|
||||||
/* /NOTIFYHWND + HWND */ COUNTOF(_T("/NOTIFYHWND -4294967295")) + /* space */ 1
|
/* /NOTIFYHWND + HWND */ COUNTOF(_T("/NOTIFYHWND -4294967295")) + /* space */ 1
|
||||||
+6); /* for -- \"\" and NULL */
|
+6); /* for -- \"\" and NULL */
|
||||||
|
|
||||||
g_sdata.compile_command = (TCHAR *) GlobalAlloc(GPTR, byteSize);
|
g_sdata.compile_command = (TCHAR*) MemAlloc(byteSize);
|
||||||
|
|
||||||
wsprintf(
|
wsprintf(
|
||||||
g_sdata.compile_command,
|
g_sdata.compile_command,
|
||||||
|
@ -318,18 +307,18 @@ void CompileNSISScript() {
|
||||||
);
|
);
|
||||||
|
|
||||||
GlobalUnlock(g_sdata.script_cmd_args);
|
GlobalUnlock(g_sdata.script_cmd_args);
|
||||||
GlobalFree(symbols);
|
MemFree(symbols);
|
||||||
}
|
}
|
||||||
GlobalFree(g_sdata.input_script);
|
MemSafeFree(g_sdata.input_script);
|
||||||
GlobalFree(g_sdata.output_exe);
|
MemSafeFree(g_sdata.output_exe);
|
||||||
g_sdata.input_script = 0;
|
g_sdata.input_script = 0;
|
||||||
g_sdata.output_exe = 0;
|
g_sdata.output_exe = 0;
|
||||||
g_sdata.warnings = 0;
|
g_sdata.warnings = 0;
|
||||||
g_sdata.logLength = 0;
|
g_sdata.logLength = 0;
|
||||||
// Disable buttons during compile
|
// Disable buttons during compile
|
||||||
DisableItems(g_sdata.hwnd);
|
DisableItems(g_sdata.hwnd);
|
||||||
DWORD id;
|
DWORD tid;
|
||||||
g_sdata.thread=CreateThread(NULL,0,MakeNSISProc,0,0,&id);
|
g_sdata.thread=CreateThread(NULL,0,MakeNSISProc,0,0,&tid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool InternalOpenRegSettingsKey(HKEY root, HKEY &key, bool create) {
|
static bool InternalOpenRegSettingsKey(HKEY root, HKEY &key, bool create) {
|
||||||
|
@ -470,7 +459,7 @@ TCHAR** LoadSymbolSet(TCHAR *name)
|
||||||
if(symbols) {
|
if(symbols) {
|
||||||
l++;
|
l++;
|
||||||
DWORD bytes = sizeof(TCHAR) * l;
|
DWORD bytes = sizeof(TCHAR) * l;
|
||||||
symbols[i] = (TCHAR *)GlobalAlloc(GPTR, bytes);
|
symbols[i] = (TCHAR*) MemAllocZI(bytes);
|
||||||
if (symbols[i]) {
|
if (symbols[i]) {
|
||||||
RegQueryValueEx(hSubKey,buf,NULL,&t,(unsigned char*)symbols[i],&bytes);
|
RegQueryValueEx(hSubKey,buf,NULL,&t,(unsigned char*)symbols[i],&bytes);
|
||||||
}
|
}
|
||||||
|
@ -541,16 +530,11 @@ void SaveSymbolSet(TCHAR *name, TCHAR **symbols)
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResetObjects() {
|
void ResetObjects() {
|
||||||
if (g_sdata.compile_command)
|
MemSafeFree(g_sdata.compile_command);
|
||||||
{
|
g_sdata.compile_command = NULL;
|
||||||
GlobalFree(g_sdata.compile_command);
|
|
||||||
g_sdata.compile_command = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_sdata.warnings = FALSE;
|
g_sdata.warnings = FALSE;
|
||||||
g_sdata.retcode = -1;
|
g_sdata.retcode = -1;
|
||||||
g_sdata.thread = NULL;
|
g_sdata.thread = NULL;
|
||||||
g_sdata.compile_command = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResetSymbols() {
|
void ResetSymbols() {
|
||||||
|
@ -558,7 +542,7 @@ void ResetSymbols() {
|
||||||
HGLOBAL hMem;
|
HGLOBAL hMem;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while(g_sdata.symbols[i]) {
|
while(g_sdata.symbols[i]) {
|
||||||
GlobalFree(g_sdata.symbols[i]);
|
MemFree(g_sdata.symbols[i]);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
hMem = GlobalHandle(g_sdata.symbols);
|
hMem = GlobalHandle(g_sdata.symbols);
|
||||||
|
@ -605,39 +589,35 @@ BOOL InitSpawn(STARTUPINFO &si, HANDLE &hRd, HANDLE &hWr) {
|
||||||
int InitBranding() {
|
int InitBranding() {
|
||||||
const TCHAR *opt = _T(" /version");
|
const TCHAR *opt = _T(" /version");
|
||||||
UINT cch = lstrlen(EXENAME) + lstrlen(opt) + 1;
|
UINT cch = lstrlen(EXENAME) + lstrlen(opt) + 1;
|
||||||
TCHAR *s = (TCHAR *)GlobalAlloc(GPTR, cch*sizeof(TCHAR));
|
TCHAR *cmd = (TCHAR*) MemAlloc(cch*sizeof(TCHAR));
|
||||||
if (s) {
|
if (!cmd) return 0;
|
||||||
lstrcpy(s, EXENAME);
|
lstrcpy(cmd, EXENAME);
|
||||||
lstrcat(s, opt);
|
lstrcat(cmd, opt);
|
||||||
STARTUPINFO si;
|
STARTUPINFO si;
|
||||||
HANDLE newstdout, read_stdout;
|
HANDLE newstdout, read_stdout;
|
||||||
if (!InitSpawn(si, read_stdout, newstdout)) return 0;
|
char szBuf[1024], retval = 0;
|
||||||
PROCESS_INFORMATION pi;
|
if (InitSpawn(si, read_stdout, newstdout)) {
|
||||||
if (!CreateProcess(0, s, 0, 0, TRUE, CREATE_NEW_CONSOLE, 0, 0, &si, &pi)) {
|
PROCESS_INFORMATION pi, *ppi = 0;
|
||||||
FreeSpawn(0, read_stdout, newstdout);
|
if (CreateProcess(0, cmd, 0, 0, TRUE, CREATE_NEW_CONSOLE, 0, 0, &si, &pi)) {
|
||||||
return 0;
|
DWORD dwRead = 0;
|
||||||
|
if (WAIT_OBJECT_0 == WaitForSingleObject(pi.hProcess, 10000)) {
|
||||||
|
ReadFile(read_stdout, szBuf, sizeof(szBuf)-1, &dwRead, NULL);
|
||||||
|
retval = 1;
|
||||||
|
}
|
||||||
|
szBuf[dwRead] = 0, ppi = π
|
||||||
|
int len = lstrlenA(szBuf);
|
||||||
|
if (!len) retval = 0;
|
||||||
|
g_sdata.branding = (TCHAR*) MemAlloc((len+6)*sizeof(TCHAR)); // LEAKED
|
||||||
|
wsprintf(g_sdata.branding, _T("NSIS %hs"), szBuf);
|
||||||
|
g_sdata.brandingv = (char*) MemAlloc(len+1); // LEAKED
|
||||||
|
lstrcpyA(g_sdata.brandingv, szBuf);
|
||||||
}
|
}
|
||||||
char szBuf[1024], retval = 0;
|
FreeSpawn(ppi, read_stdout, newstdout);
|
||||||
DWORD dwRead = 0;
|
|
||||||
if (WAIT_OBJECT_0 == WaitForSingleObject(pi.hProcess, 10000)) {
|
|
||||||
ReadFile(read_stdout, szBuf, sizeof(szBuf)-1, &dwRead, NULL);
|
|
||||||
retval = 1;
|
|
||||||
}
|
|
||||||
FreeSpawn(&pi, read_stdout, newstdout);
|
|
||||||
szBuf[dwRead] = 0;
|
|
||||||
int len = lstrlenA(szBuf);
|
|
||||||
if (len==0) retval = 0;
|
|
||||||
g_sdata.branding = (TCHAR *)GlobalAlloc(GPTR, (len+6)*sizeof(TCHAR)); // LEAKED
|
|
||||||
wsprintf(g_sdata.branding, _T("NSIS %hs"), szBuf);
|
|
||||||
g_sdata.brandingv = (char *)GlobalAlloc(GPTR, len+1); // LEAKED
|
|
||||||
lstrcpyA(g_sdata.brandingv, szBuf);
|
|
||||||
GlobalFree(s);
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
return 0;
|
MemFree(cmd);
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InitTooltips(HWND h) {
|
void InitTooltips(HWND h) {
|
||||||
if (h == NULL) return;
|
if (h == NULL) return;
|
||||||
memset(&g_tip,0,sizeof(NTOOLTIP));
|
memset(&g_tip,0,sizeof(NTOOLTIP));
|
||||||
|
@ -701,20 +681,20 @@ TCHAR* BuildSymbols()
|
||||||
int i=0;
|
int i=0;
|
||||||
while(g_sdata.symbols[i]) {
|
while(g_sdata.symbols[i]) {
|
||||||
if(buf) {
|
if(buf) {
|
||||||
TCHAR *buf3 = (TCHAR *)GlobalAlloc(GPTR,(lstrlen(buf)+lstrlen(g_sdata.symbols[i])+6)*sizeof(TCHAR));
|
TCHAR *buf3 = (TCHAR*) MemAlloc((lstrlen(buf)+lstrlen(g_sdata.symbols[i])+6)*sizeof(TCHAR));
|
||||||
wsprintf(buf3,_T("%s \"/D%s\""),buf,g_sdata.symbols[i]);
|
wsprintf(buf3,_T("%s \"/D%s\""),buf,g_sdata.symbols[i]);
|
||||||
GlobalFree(buf);
|
MemFree(buf);
|
||||||
buf = buf3;
|
buf = buf3;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
buf = (TCHAR *)GlobalAlloc(GPTR,(lstrlen(g_sdata.symbols[i])+5)*sizeof(TCHAR));
|
buf = (TCHAR*) MemAlloc((lstrlen(g_sdata.symbols[i])+5)*sizeof(TCHAR));
|
||||||
wsprintf(buf,_T("\"/D%s\""),g_sdata.symbols[i]);
|
wsprintf(buf,_T("\"/D%s\""),g_sdata.symbols[i]);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
buf = (TCHAR *)GlobalAlloc(GPTR, sizeof(TCHAR));
|
buf = (TCHAR*) MemAlloc(sizeof(TCHAR));
|
||||||
buf[0] = _T('\0');
|
buf[0] = _T('\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -987,9 +967,7 @@ void SaveCompressor()
|
||||||
bool FileExists(const TCHAR *fname)
|
bool FileExists(const TCHAR *fname)
|
||||||
{
|
{
|
||||||
WIN32_FIND_DATA wfd;
|
WIN32_FIND_DATA wfd;
|
||||||
HANDLE h;
|
HANDLE h = FindFirstFile(fname,&wfd);
|
||||||
|
|
||||||
h = FindFirstFile(fname,&wfd);
|
|
||||||
if(INVALID_HANDLE_VALUE != h) {
|
if(INVALID_HANDLE_VALUE != h) {
|
||||||
FindClose(h);
|
FindClose(h);
|
||||||
return true;
|
return true;
|
||||||
|
@ -999,14 +977,15 @@ bool FileExists(const TCHAR *fname)
|
||||||
|
|
||||||
HMENU FindSubMenu(HMENU hMenu, UINT uId)
|
HMENU FindSubMenu(HMENU hMenu, UINT uId)
|
||||||
{
|
{
|
||||||
MENUITEMINFO mii = {
|
MENUITEMINFO mii;
|
||||||
sizeof(MENUITEMINFO),
|
mii.cbSize = sizeof(MENUITEMINFO);
|
||||||
MIIM_SUBMENU,
|
mii.fMask = MIIM_SUBMENU;
|
||||||
};
|
return GetMenuItemInfo(hMenu, uId, FALSE, &mii) ? mii.hSubMenu : 0;
|
||||||
|
}
|
||||||
mii.hSubMenu = NULL;
|
|
||||||
|
HFONT CreateFont(int Height, int Weight, DWORD PitchAndFamily, LPCTSTR Face)
|
||||||
GetMenuItemInfo(hMenu, uId, FALSE, &mii);
|
{
|
||||||
|
return CreateFont(Height, 0, 0, 0, Weight, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
|
||||||
return mii.hSubMenu;
|
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
|
||||||
|
PitchAndFamily, Face);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,15 +27,25 @@
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "toolbar.h"
|
#include "toolbar.h"
|
||||||
|
|
||||||
|
#ifdef _countof
|
||||||
|
#define COUNTOF _countof
|
||||||
|
#else
|
||||||
|
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MRU_LIST_SIZE 5
|
#define MRU_LIST_SIZE 5
|
||||||
#define MRU_DISPLAY_LENGTH 40
|
#define MRU_DISPLAY_LENGTH 40
|
||||||
|
|
||||||
|
void* MemAllocZI(SIZE_T cb);
|
||||||
|
void MemSafeFree(void*mem);
|
||||||
|
#define MemAlloc MemAllocZI
|
||||||
|
#define MemFree MemSafeFree
|
||||||
|
|
||||||
void FreeSpawn(PROCESS_INFORMATION *pPI, HANDLE hRd, HANDLE hWr);
|
void FreeSpawn(PROCESS_INFORMATION *pPI, HANDLE hRd, HANDLE hWr);
|
||||||
BOOL InitSpawn(STARTUPINFO &si, HANDLE &hRd, HANDLE &hWr);
|
BOOL InitSpawn(STARTUPINFO &si, HANDLE &hRd, HANDLE &hWr);
|
||||||
|
|
||||||
int SetArgv(const TCHAR *cmdLine, TCHAR ***argv);
|
int SetArgv(const TCHAR *cmdLine, TCHAR ***argv);
|
||||||
void SetTitle(HWND hwnd,const TCHAR *substr);
|
void SetTitle(HWND hwnd,const TCHAR *substr);
|
||||||
void SetBranding(HWND hwnd);
|
|
||||||
void CopyToClipboard(HWND hwnd);
|
void CopyToClipboard(HWND hwnd);
|
||||||
void ClearLog(HWND hwnd);
|
void ClearLog(HWND hwnd);
|
||||||
void LogMessage(HWND hwnd,const TCHAR *str);
|
void LogMessage(HWND hwnd,const TCHAR *str);
|
||||||
|
@ -68,4 +78,12 @@ void ClearMRUList();
|
||||||
bool FileExists(const TCHAR *fname);
|
bool FileExists(const TCHAR *fname);
|
||||||
|
|
||||||
HMENU FindSubMenu(HMENU hMenu, UINT uId);
|
HMENU FindSubMenu(HMENU hMenu, UINT uId);
|
||||||
|
HFONT CreateFont(int Height, int Weight, DWORD PitchAndFamily, LPCTSTR Face);
|
||||||
|
|
||||||
|
inline void GetGripperPos(HWND hwnd, RECT&r)
|
||||||
|
{
|
||||||
|
GetClientRect(hwnd, &r);
|
||||||
|
r.left = r.right - GetSystemMetrics(SM_CXVSCROLL);
|
||||||
|
r.top = r.bottom - GetSystemMetrics(SM_CYVSCROLL);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue