Skip to content

Commit

Permalink
Applied changes from upstream 1.0.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadahar committed Oct 2, 2018
1 parent e7548cc commit ea0c45a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 14 deletions.
35 changes: 25 additions & 10 deletions Contrib/Inetc/inetc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@
* Nadahar
* Sep 21, 2018 - 1.0.5.5
* Created /NOSSL option that prevents redirects to HTTPS (which breaks Windows XP)
* Sep 24, 2018 - 1.0.5.6 - anders_k
* /tostackconv supports UTF-8 and UTF-16LE BOM sniffing and conversion.
*******************************************************/


Expand Down Expand Up @@ -432,7 +434,10 @@ void fileTransfer(HANDLE localFile,
if(szToStack)
{
for (DWORD i = 0; cntToStack < g_stringsize && i < rslt; i++, cntToStack++)
*(szToStack + cntToStack) = data_buf[i];
if (convToStack)
*((BYTE*)szToStack + cntToStack) = data_buf[i]; // Bytes
else
*(szToStack + cntToStack) = data_buf[i]; // ? to TCHARs
}
else if(!WriteFile(localFile, data_buf, rslt, &bytesDone, NULL) ||
rslt != bytesDone)
Expand Down Expand Up @@ -1008,7 +1013,7 @@ DWORD __stdcall inetTransfer(void *hw)
if(szToStack)
{
for (DWORD i = 0; cntToStack < g_stringsize && i < rslt; i++, cntToStack++)
*(szToStack + cntToStack) = hdr[i];
*(szToStack + cntToStack) = hdr[i]; // ASCII to TCHAR
}
else
{
Expand Down Expand Up @@ -1456,12 +1461,15 @@ INT_PTR CALLBACK dlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
return false;
case WM_PAINT:
// child dialog redraw problem. return false is important
RedrawWindow(GetDlgItem(hDlg, IDC_STATIC1), NULL, NULL, RDW_INVALIDATE);
RedrawWindow(GetDlgItem(hDlg, IDCANCEL), NULL, NULL, RDW_INVALIDATE);
RedrawWindow(GetDlgItem(hDlg, IDC_PROGRESS1), NULL, NULL, RDW_INVALIDATE);
UpdateWindow(GetDlgItem(hDlg, IDC_STATIC1));
UpdateWindow(GetDlgItem(hDlg, IDCANCEL));
UpdateWindow(GetDlgItem(hDlg, IDC_PROGRESS1));
{
HWND hS1 = GetDlgItem(hDlg, IDC_STATIC1), hC = GetDlgItem(hDlg, IDCANCEL), hP1 = GetDlgItem(hDlg, IDC_PROGRESS1);
RedrawWindow(hS1, NULL, NULL, RDW_INVALIDATE);
RedrawWindow(hC, NULL, NULL, RDW_INVALIDATE);
RedrawWindow(hP1, NULL, NULL, RDW_INVALIDATE);
UpdateWindow(hS1);
UpdateWindow(hC);
UpdateWindow(hP1);
}
return false;
case WM_TIMER:
if(!silent && IsWindow(hDlg))
Expand Down Expand Up @@ -1869,13 +1877,20 @@ void __declspec(dllexport) __cdecl get(HWND hwndParent,
if(cntToStack > 0 && convToStack)
{
#ifdef UNICODE
int required = MultiByteToWideChar(CP_ACP, 0, (CHAR*)szToStack, string_size * sizeof(TCHAR), NULL, 0);
int cp = CP_ACP;
if (0xef == ((BYTE*)szToStack)[0] && 0xbb == ((BYTE*)szToStack)[1] && 0xbf == ((BYTE*)szToStack)[2]) cp = 65001; // CP_UTF8
if (0xff == ((BYTE*)szToStack)[0] && 0xfe == ((BYTE*)szToStack)[1])
{
cp = 1200; // UTF-16LE
pushstring((LPWSTR)szToStack);
}
int required = (cp == 1200) ? 0 : MultiByteToWideChar(cp, 0, (CHAR*)szToStack, string_size * sizeof(TCHAR), NULL, 0);
if(required > 0)
{
WCHAR* pszToStackNew = (WCHAR*)LocalAlloc(LPTR, sizeof(WCHAR) * (required + 1));
if(pszToStackNew)
{
if(MultiByteToWideChar(CP_ACP, 0, (CHAR*)szToStack, string_size * sizeof(TCHAR), pszToStackNew, required) > 0)
if(MultiByteToWideChar(cp, 0, (CHAR*)szToStack, string_size * sizeof(TCHAR), pszToStackNew, required) > 0)
pushstring(pszToStackNew);
LocalFree(pszToStackNew);
}
Expand Down
8 changes: 4 additions & 4 deletions Contrib/Inetc/inetc.rc
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,5,5
PRODUCTVERSION 1,0,5,5
FILEVERSION 1,0,5,6
PRODUCTVERSION 1,0,5,6
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -203,12 +203,12 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "inetc NSIS plug-in"
VALUE "FileVersion", "1.0.5.5"
VALUE "FileVersion", "1.0.5.6"
VALUE "InternalName", "inetc.dll"
VALUE "LegalCopyright", "Copyright � Takhir Bedertdinov"
VALUE "OriginalFilename", "inetc.dll"
VALUE "ProductName", "inetc NSIS plug-in"
VALUE "ProductVersion", "1.0.5.5"
VALUE "ProductVersion", "1.0.5.6"
END
END
BLOCK "VarFileInfo"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Changes in this fork are:
* **1.0.5.3** - Added options `/TEXTCOLOR "RRGGBB"` and `/BGCOLOR "RRGGBB"`
* **1.0.5.4** - Created a 4th download dialog `/MODERNPOPUP`
* **1.0.5.5** - Created option `/NOSSL` which prevents redirects from HTTP to HTTPS
* **1.0.5.6** - Applied changes from upstream `1.0.5.3`: `/tostackconv` supports UTF-8 and UTF-16LE BOM sniffing and conversion.

Nadahar

Expand Down

0 comments on commit ea0c45a

Please sign in to comment.