Merging various fixes from latest Jim Park repository

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6096 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
wizou 2010-05-28 14:09:08 +00:00
parent 23fe81e16e
commit 74ffaada4e
4 changed files with 37 additions and 12 deletions

View file

@ -368,10 +368,14 @@ BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_COMMAND:
if (LOWORD(wParam) == IDC_DIRLIST && HIWORD(wParam) == LBN_SELCHANGE)
{
SendMessage(hwDirList, LB_GETTEXT, SendMessage(hwDirList, LB_GETCURSEL, 0, 0), (WPARAM)buf);
if (autoadd)
lstrcat(lstrcat(buf, _T("\\")), progname);
SetWindowText(hwLocation, buf);
LRESULT selection = SendMessage(hwDirList, LB_GETCURSEL, 0, 0);
if (selection != LB_ERR)
{
SendMessage(hwDirList, LB_GETTEXT, selection, (WPARAM)buf);
if (autoadd)
lstrcat(lstrcat(buf, _T("\\")), progname);
SetWindowText(hwLocation, buf);
}
}
else if (LOWORD(wParam) == IDC_CHECK && HIWORD(wParam) == BN_CLICKED)
{

View file

@ -801,7 +801,26 @@ SystemProc *PrepareProc(BOOL NeedForCall)
}
// Get proc address
if ((proc->Proc = NSISGetProcAddress(proc->Dll, proc->ProcName)) == NULL)
proc->Proc = NSISGetProcAddress(proc->Dll, proc->ProcName);
#ifdef _UNICODE
if ((proc->Proc != NULL) &&
(proc->ProcName[0] == _T('l') &&
proc->ProcName[1] == _T('s') &&
proc->ProcName[2] == _T('t') &&
proc->ProcName[3] == _T('r')) &&
(lstrcmpi(_T("kernel32"), proc->DllName) == 0 || lstrcmpi(_T("kernel32.dll"), proc->DllName) == 0))
{
int lastCharIdx = lstrlen(proc->ProcName) - 1;
if (lastCharIdx > 1 &&
proc->ProcName[lastCharIdx] != _T('A') &&
proc->ProcName[lastCharIdx] != _T('W'))
{
proc->Proc = NULL; // force using W variant
}
}
#endif
if (proc->Proc == NULL)
{
#ifdef _UNICODE
// automatic W discover

View file

@ -225,7 +225,8 @@ params:
if (!pExec[0])
{
pushstring(_T("error"));
*(pExec-2) = _T('\0'); // skip space and quote
if (pExec-2 >= g_exec)
*(pExec-2) = _T('\0'); // skip space and quote
if (executor) DeleteFile(executor);
GlobalFree(g_exec);
return;
@ -393,7 +394,8 @@ done:
CloseHandle(read_stdout);
CloseHandle(newstdin);
CloseHandle(read_stdin);
*(pExec-2) = _T('\0'); // skip space and quote
if (pExec-2 >= g_exec)
*(pExec-2) = _T('\0'); // skip space and quote
if (executor) DeleteFile(executor);
GlobalFree(g_exec);
if (log) {

View file

@ -3144,7 +3144,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
*++p=0;
bool endSlash = (str[0] && str[_tcslen(str)-1] == _T('\\'));
if (tmpstr.getlen() || endSlash) tmpstr.add(str,_tcslen(str));
if (tmpstr.getlen() || endSlash) tmpstr.add(str,sizeof(TCHAR)*_tcslen(str));
// if we have valid contents and not ending on slash, then done
if (!endSlash && (str[0] || tmpstr.getlen())) break;
@ -3155,7 +3155,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
TCHAR *thisline=str;
if (tmpstr.getlen())
{
tmpstr.add(_T("\0"),1);
tmpstr.add(_T("\0"),sizeof(TCHAR));
thisline=(TCHAR *)tmpstr.get();
}
@ -3233,15 +3233,15 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
while (*src)
{
if (ignoreCase ? _tcsnicmp(src,search,searchlen) : _tcsncmp(src,search,searchlen))
valout.add(src++,1);
valout.add(src++,sizeof(TCHAR));
else
{
valout.add(replace,replacelen);
valout.add(replace,sizeof(TCHAR)*replacelen);
src+=searchlen;
}
}
valout.add(_T(""),1);
valout.add(_T(""),sizeof(TCHAR));
definedlist.del(define); // allow changing variables since we'll often use this in series