Unicode NSISdl needs to call CreateFileW
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6349 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
cf0d27706a
commit
c6f149764d
1 changed files with 18 additions and 11 deletions
|
@ -241,7 +241,7 @@ __declspec(dllexport) void download (HWND parent,
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
char url[1024];
|
char url[1024];
|
||||||
char filename[1024];
|
TCHAR filenameT[1024];
|
||||||
static char proxy[1024];
|
static char proxy[1024];
|
||||||
BOOL bSuccess=FALSE;
|
BOOL bSuccess=FALSE;
|
||||||
int timeout_ms=30000;
|
int timeout_ms=30000;
|
||||||
|
@ -325,13 +325,22 @@ __declspec(dllexport) void download (HWND parent,
|
||||||
getieproxy=0;
|
getieproxy=0;
|
||||||
PopStringA(url);
|
PopStringA(url);
|
||||||
}
|
}
|
||||||
PopStringA(filename);
|
popstring(filenameT);
|
||||||
|
|
||||||
HANDLE hFile = CreateFileA(filename,GENERIC_WRITE,FILE_SHARE_READ,NULL,CREATE_ALWAYS,0,NULL);
|
static char main_buf[8192];
|
||||||
|
char *filenameA;
|
||||||
|
#ifdef _UNICODE
|
||||||
|
filenameA = main_buf;
|
||||||
|
wsprintfA(filenameA, "%S", filenameT);
|
||||||
|
#else
|
||||||
|
filenameA = filenameT;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
HANDLE hFile = CreateFile(filenameT,GENERIC_WRITE,FILE_SHARE_READ,NULL,CREATE_ALWAYS,0,NULL);
|
||||||
|
|
||||||
if (hFile == INVALID_HANDLE_VALUE)
|
if (hFile == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
wsprintfA(buf, "Unable to open %s", filename);
|
wsprintfA(buf, "Unable to open %s", filenameA);
|
||||||
error = buf;
|
error = buf;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -345,10 +354,10 @@ __declspec(dllexport) void download (HWND parent,
|
||||||
SendMessage(parent, uMsgCreate, TRUE, (LPARAM) parent);
|
SendMessage(parent, uMsgCreate, TRUE, (LPARAM) parent);
|
||||||
|
|
||||||
// set initial text
|
// set initial text
|
||||||
char *p = filename;
|
char *p = filenameA;
|
||||||
while (*p) p++;
|
while (*p) p++;
|
||||||
while (*p !='\\' && p != filename) p = CharPrevA(filename, p);
|
while (*p !='\\' && p != filenameA) p = CharPrevA(filenameA, p);
|
||||||
wsprintfA(buf, szDownloading, p != filename ? p + 1 : p);
|
wsprintfA(buf, szDownloading, p != filenameA ? p + 1 : p);
|
||||||
SetDlgItemTextA(childwnd, 1006, buf);
|
SetDlgItemTextA(childwnd, 1006, buf);
|
||||||
SetWindowTextA(g_hwndStatic, szConnecting);
|
SetWindowTextA(g_hwndStatic, szConnecting);
|
||||||
}
|
}
|
||||||
|
@ -358,9 +367,7 @@ __declspec(dllexport) void download (HWND parent,
|
||||||
|
|
||||||
JNL_HTTPGet *get = 0;
|
JNL_HTTPGet *get = 0;
|
||||||
|
|
||||||
static char main_buf[8192];
|
char *buf = main_buf, *p = NULL;
|
||||||
char *buf=main_buf;
|
|
||||||
char *p=NULL;
|
|
||||||
|
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
if (getieproxy && RegOpenKeyExA(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",0,KEY_READ,&hKey) == ERROR_SUCCESS)
|
if (getieproxy && RegOpenKeyExA(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",0,KEY_READ,&hKey) == ERROR_SUCCESS)
|
||||||
|
@ -574,7 +581,7 @@ __declspec(dllexport) void download (HWND parent,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_cancelled || !bSuccess) {
|
if (g_cancelled || !bSuccess) {
|
||||||
DeleteFileA(filename);
|
DeleteFile(filenameT);
|
||||||
}
|
}
|
||||||
|
|
||||||
PushStringA(error);
|
PushStringA(error);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue