diff options
author | George Hazan <george.hazan@gmail.com> | 2016-07-26 09:20:25 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-07-26 09:20:25 +0000 |
commit | 6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac (patch) | |
tree | 2e8bb660c908b54914abd562af8aafa4a486c846 /plugins/PluginUpdater | |
parent | a61c8728b379057fe7f0a0d86fe0b037598229dd (diff) |
less TCHARs:
- TCHAR is replaced with wchar_t everywhere;
- LPGENT replaced with either LPGENW or LPGEN;
- fixes for ANSI plugins that improperly used _t functions;
- TCHAR *t removed from MAllStrings;
- ptszGroup, ptszTitle & ptszTab in OPTIONSDIALOGPAGE replaced with pwsz*
git-svn-id: http://svn.miranda-ng.org/main/trunk@17133 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/PluginUpdater')
-rw-r--r-- | plugins/PluginUpdater/pu_stub/pu_stub.cpp | 59 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/DlgListNew.cpp | 62 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/DlgUpdate.cpp | 82 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Events.cpp | 2 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Notifications.cpp | 2 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Notifications.h | 6 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Options.cpp | 26 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/PluginUpdater.cpp | 2 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Services.cpp | 2 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Utils.cpp | 52 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/checksum.cpp | 4 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/stdafx.h | 30 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/unzipfile.cpp | 16 |
13 files changed, 172 insertions, 173 deletions
diff --git a/plugins/PluginUpdater/pu_stub/pu_stub.cpp b/plugins/PluginUpdater/pu_stub/pu_stub.cpp index 8167c32d83..e7d346533d 100644 --- a/plugins/PluginUpdater/pu_stub/pu_stub.cpp +++ b/plugins/PluginUpdater/pu_stub/pu_stub.cpp @@ -7,38 +7,37 @@ #include <stdlib.h>
#include <malloc.h>
#include <memory.h>
-#include <tchar.h>
#include <varargs.h>
#include <stdio.h>
// Global Variables:
HINSTANCE hInst; // current instance
-void log(const TCHAR *tszFormat, ...)
+void log(const wchar_t *tszFormat, ...)
{
#if defined(_DEBUG)
- FILE *out = fopen("c:\\temp\\pu.log", "a");
- if (out) {
- va_list params;
- va_start(params, tszFormat);
- _vftprintf(out, tszFormat, params);
- va_end(params);
- fputc('\n', out);
- fclose(out);
- }
+ FILE *out = fopen("c:\\temp\\pu.log", "a");
+ if (out) {
+ va_list params;
+ va_start(params, tszFormat);
+ vfwprintf(out, tszFormat, params);
+ va_end(params);
+ fputc('\n', out);
+ fclose(out);
+ }
#endif
}
int CreateDirectoryTreeW(const WCHAR* szDir)
{
- DWORD dwAttributes;
- WCHAR* pszLastBackslash, szTestDir[ MAX_PATH ];
-
+ wchar_t szTestDir[MAX_PATH];
lstrcpynW(szTestDir, szDir, MAX_PATH);
- if ((dwAttributes = GetFileAttributesW(szTestDir)) != INVALID_FILE_ATTRIBUTES && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
+
+ DWORD dwAttributes = GetFileAttributesW(szTestDir);
+ if (dwAttributes != INVALID_FILE_ATTRIBUTES && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
return 0;
- pszLastBackslash = wcsrchr(szTestDir, '\\');
+ WCHAR *pszLastBackslash = wcsrchr(szTestDir, '\\');
if (pszLastBackslash == NULL)
return 0;
@@ -59,42 +58,42 @@ void CreatePathToFileW(WCHAR* wszFilePath) *pszLastBackslash = '\\';
}
-int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int)
+int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int)
{
DWORD dwError;
hInst = hInstance;
- TCHAR tszPipeName[MAX_PATH];
+ wchar_t tszPipeName[MAX_PATH];
#if _MSC_VER < 1400
- _stprintf(tszPipeName, L"\\\\.\\pipe\\Miranda_Pu_%s", lpCmdLine);
+ swprintf(tszPipeName, L"\\\\.\\pipe\\Miranda_Pu_%s", lpCmdLine);
#else
- _stprintf_s(tszPipeName, MAX_PATH, L"\\\\.\\pipe\\Miranda_Pu_%s", lpCmdLine);
+ swprintf_s(tszPipeName, L"\\\\.\\pipe\\Miranda_Pu_%s", lpCmdLine);
#endif
- log( L"Opening pipe %s...", tszPipeName);
+ log(L"Opening pipe %s...", tszPipeName);
HANDLE hPipe = CreateFile(tszPipeName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (hPipe == INVALID_HANDLE_VALUE) {
dwError = GetLastError();
- log( L"Failed to open a pipe: error %d", dwError);
+ log(L"Failed to open a pipe: error %d", dwError);
return dwError;
}
- log( L"Entering the reading cycle...");
+ log(L"Entering the reading cycle...");
BYTE szReadBuffer[1024] = { 0 };
DWORD dwBytes;
- while ( ReadFile(hPipe, szReadBuffer, sizeof(szReadBuffer), &dwBytes, NULL)) {
+ while (ReadFile(hPipe, szReadBuffer, sizeof(szReadBuffer), &dwBytes, NULL)) {
DWORD dwAction = *(DWORD*)szReadBuffer;
- TCHAR *ptszFile1 = (TCHAR*)(szReadBuffer + sizeof(DWORD));
- TCHAR *ptszFile2 = ptszFile1 + _tcslen(ptszFile1)+1;
- log( L"Received command: %d <%s> <%s>", dwAction, ptszFile1, ptszFile2);
- switch(dwAction) {
+ wchar_t *ptszFile1 = (wchar_t*)(szReadBuffer + sizeof(DWORD));
+ wchar_t *ptszFile2 = ptszFile1 + wcslen(ptszFile1) + 1;
+ log(L"Received command: %d <%s> <%s>", dwAction, ptszFile1, ptszFile2);
+ switch (dwAction) {
case 1: // copy
dwError = CopyFile(ptszFile1, ptszFile2, FALSE);
break;
case 2: // move
DeleteFile(ptszFile2);
- if ( MoveFile(ptszFile1, ptszFile2) == 0) // use copy on error
+ if (MoveFile(ptszFile1, ptszFile2) == 0) // use copy on error
dwError = CopyFile(ptszFile1, ptszFile2, FALSE);
else
dwError = 0;
@@ -122,7 +121,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int) }
dwError = GetLastError();
- log( L"Pipe is closed (%d), exiting", dwError);
+ log(L"Pipe is closed (%d), exiting", dwError);
CloseHandle(hPipe);
return 0;
}
diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp index 3d6b7ed772..89ccf41904 100644 --- a/plugins/PluginUpdater/src/DlgListNew.cpp +++ b/plugins/PluginUpdater/src/DlgListNew.cpp @@ -53,7 +53,7 @@ static void ApplyDownloads(void *param) HWND hwndList = GetDlgItem(hDlg, IDC_LIST_UPDATES);
OBJLIST<FILEINFO> &todo = *(OBJLIST<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
//create needed folders after escalating priviledges. Folders creates when we actually install updates
- TCHAR tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH];
+ wchar_t tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH];
mir_sntprintf(tszFileBack, L"%s\\Backups", g_tszRoot);
SafeCreateDirectory(tszFileBack);
@@ -111,11 +111,11 @@ static LRESULT CALLBACK PluginListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LP if (ListView_GetItem(hwnd, &lvi) && lvi.iGroupId == 1) {
FILEINFO *info = (FILEINFO *)lvi.lParam;
- TCHAR tszFileName[MAX_PATH];
- _tcscpy(tszFileName, _tcsrchr(info->tszNewName, L'\\') + 1);
- TCHAR *p = _tcschr(tszFileName, L'.'); *p = 0;
+ wchar_t tszFileName[MAX_PATH];
+ wcscpy(tszFileName, wcsrchr(info->tszNewName, L'\\') + 1);
+ wchar_t *p = wcschr(tszFileName, L'.'); *p = 0;
- TCHAR link[MAX_PATH];
+ wchar_t link[MAX_PATH];
mir_sntprintf(link, PLUGIN_INFO_URL, tszFileName);
Utils_OpenUrlT(link);
}
@@ -165,10 +165,10 @@ INT_PTR CALLBACK DlgList(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) if (GetVersionEx(&osver) && osver.dwMajorVersion >= 6) {
wchar_t szPath[MAX_PATH];
GetModuleFileName(NULL, szPath, _countof(szPath));
- TCHAR *ext = _tcsrchr(szPath, '.');
+ wchar_t *ext = wcsrchr(szPath, '.');
if (ext != NULL)
*ext = '\0';
- _tcscat(szPath, L".test");
+ wcscat(szPath, L".test");
HANDLE hFile = CreateFile(szPath, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
// Running Windows Vista or later (major version >= 6).
@@ -229,8 +229,8 @@ INT_PTR CALLBACK DlgList(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) lvi.mask = LVIF_PARAM | LVIF_GROUPID | LVIF_TEXT | LVIF_IMAGE;
int groupId = 4;
- if (_tcschr(todo[i].tszOldName, L'\\') != NULL)
- groupId = (_tcsstr(todo[i].tszOldName, L"Plugins") != NULL) ? 1 : ((_tcsstr(todo[i].tszOldName, L"Languages") != NULL) ? 3 : 2);
+ if (wcschr(todo[i].tszOldName, L'\\') != NULL)
+ groupId = (wcsstr(todo[i].tszOldName, L"Plugins") != NULL) ? 1 : ((wcsstr(todo[i].tszOldName, L"Languages") != NULL) ? 3 : 2);
lvi.iItem = i;
lvi.lParam = (LPARAM)&todo[i];
@@ -344,27 +344,27 @@ static void __stdcall LaunchListDialog(void *param) hwndDialog = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_LIST), GetDesktopWindow(), DlgList, (LPARAM)param);
}
-static FILEINFO* ServerEntryToFileInfo(const ServListEntry &hash, const TCHAR* tszBaseUrl, const TCHAR* tszPath)
+static FILEINFO* ServerEntryToFileInfo(const ServListEntry &hash, const wchar_t* tszBaseUrl, const wchar_t* tszPath)
{
FILEINFO *FileInfo = new FILEINFO;
FileInfo->bDeleteOnly = FALSE;
// copy the relative old name
- _tcsncpy(FileInfo->tszOldName, hash.m_name, _countof(FileInfo->tszOldName));
- _tcsncpy(FileInfo->tszNewName, hash.m_name, _countof(FileInfo->tszNewName));
+ wcsncpy(FileInfo->tszOldName, hash.m_name, _countof(FileInfo->tszOldName));
+ wcsncpy(FileInfo->tszNewName, hash.m_name, _countof(FileInfo->tszNewName));
- TCHAR tszFileName[MAX_PATH];
- _tcsncpy(tszFileName, _tcsrchr(tszPath, L'\\') + 1, _countof(tszFileName));
- TCHAR *tp = _tcschr(tszFileName, L'.'); if (tp) *tp = 0;
+ wchar_t tszFileName[MAX_PATH];
+ wcsncpy(tszFileName, wcsrchr(tszPath, L'\\') + 1, _countof(tszFileName));
+ wchar_t *tp = wcschr(tszFileName, L'.'); if (tp) *tp = 0;
- TCHAR tszRelFileName[MAX_PATH];
- _tcsncpy(tszRelFileName, hash.m_name, MAX_PATH);
- tp = _tcsrchr(tszRelFileName, L'.'); if (tp) *tp = 0;
- tp = _tcschr(tszRelFileName, L'\\'); if (tp) tp++; else tp = tszRelFileName;
- _tcslwr(tp);
+ wchar_t tszRelFileName[MAX_PATH];
+ wcsncpy(tszRelFileName, hash.m_name, MAX_PATH);
+ tp = wcsrchr(tszRelFileName, L'.'); if (tp) *tp = 0;
+ tp = wcschr(tszRelFileName, L'\\'); if (tp) tp++; else tp = tszRelFileName;
+ wcslwr(tp);
mir_sntprintf(FileInfo->File.tszDiskPath, L"%s\\Temp\\%s.zip", g_tszRoot, tszFileName);
mir_sntprintf(FileInfo->File.tszDownloadURL, L"%s/%s.zip", tszBaseUrl, tszRelFileName);
- for (tp = _tcschr(FileInfo->File.tszDownloadURL, '\\'); tp != 0; tp = _tcschr(tp, '\\'))
+ for (tp = wcschr(FileInfo->File.tszDownloadURL, '\\'); tp != 0; tp = wcschr(tp, '\\'))
*tp++ = '/';
FileInfo->File.CRCsum = hash.m_crc;
// Load list of checked Plugins from database
@@ -380,7 +380,7 @@ static void GetList(void *) {
Thread_SetName("PluginUpdater: GetList");
- TCHAR tszTempPath[MAX_PATH];
+ wchar_t tszTempPath[MAX_PATH];
DWORD dwLen = GetTempPath(_countof(tszTempPath), tszTempPath);
if (tszTempPath[dwLen-1] == '\\')
tszTempPath[dwLen-1] = 0;
@@ -398,7 +398,7 @@ static void GetList(void *) for (int i=0; i < hashes.getCount(); i++) {
ServListEntry &hash = hashes[i];
- TCHAR tszPath[MAX_PATH];
+ wchar_t tszPath[MAX_PATH];
mir_sntprintf(tszPath, L"%s\\%s", dirname, hash.m_name);
if (GetFileAttributes(tszPath) == INVALID_FILE_ATTRIBUTES) {
@@ -450,21 +450,21 @@ void UnloadListNew() static INT_PTR ParseUriService(WPARAM, LPARAM lParam)
{
- TCHAR *arg = (TCHAR *)lParam;
+ wchar_t *arg = (wchar_t *)lParam;
if (arg == NULL)
return 1;
- TCHAR uri[1024];
- _tcsncpy_s(uri, arg, _TRUNCATE);
+ wchar_t uri[1024];
+ wcsncpy_s(uri, arg, _TRUNCATE);
- TCHAR *p = _tcschr(uri, _T(':'));
+ wchar_t *p = wcschr(uri, ':');
if (p == NULL)
return 1;
- TCHAR pluginPath[MAX_PATH];
+ wchar_t pluginPath[MAX_PATH];
mir_tstrcpy(pluginPath, p + 1);
- p = _tcschr(pluginPath, _T('/'));
- if (p) *p = _T('\\');
+ p = wcschr(pluginPath, '/');
+ if (p) *p = '\\';
if (GetFileAttributes(pluginPath) != INVALID_FILE_ATTRIBUTES)
return 0;
@@ -481,7 +481,7 @@ static INT_PTR ParseUriService(WPARAM, LPARAM lParam) return 0;
VARST dirName(L"%miranda_path%");
- TCHAR tszPath[MAX_PATH];
+ wchar_t tszPath[MAX_PATH];
mir_sntprintf(tszPath, L"%s\\%s", dirName, hash->m_name);
FILEINFO *fileInfo = ServerEntryToFileInfo(*hash, baseUrl, tszPath);
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 38e3646421..f09070bd43 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -36,7 +36,7 @@ static void SelectAll(HWND hDlg, bool bEnable) }
}
-static void SetStringText(HWND hWnd, size_t i, TCHAR *ptszText)
+static void SetStringText(HWND hWnd, size_t i, wchar_t *ptszText)
{
ListView_SetItemText(hWnd, i, 1, ptszText);
}
@@ -60,7 +60,7 @@ static void ApplyUpdates(void *param) AutoHandle pipe(hPipe);
HWND hwndList = GetDlgItem(hDlg, IDC_LIST_UPDATES);
//create needed folders after escalating priviledges. Folders creates when we actually install updates
- TCHAR tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH];
+ wchar_t tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH];
mir_sntprintf(tszFileBack, L"%s\\Backups", g_tszRoot);
SafeCreateDirectory(tszFileBack);
mir_sntprintf(tszFileTemp, L"%s\\Temp", g_tszRoot);
@@ -102,7 +102,7 @@ static void ApplyUpdates(void *param) if (p.bEnabled) {
if (p.bDeleteOnly) {
// we need only to backup the old file
- TCHAR *ptszRelPath = p.tszNewName + _tcslen(tszMirandaPath) + 1, tszBackFile[MAX_PATH];
+ wchar_t *ptszRelPath = p.tszNewName + wcslen(tszMirandaPath) + 1, tszBackFile[MAX_PATH];
mir_sntprintf(tszBackFile, L"%s\\%s", tszFileBack, ptszRelPath);
BackupFile(p.tszNewName, tszBackFile);
}
@@ -110,7 +110,7 @@ static void ApplyUpdates(void *param) // if file name differs, we also need to backup the old file here
// otherwise it would be replaced by unzip
if ( _tcsicmp(p.tszOldName, p.tszNewName)) {
- TCHAR tszSrcPath[MAX_PATH], tszBackFile[MAX_PATH];
+ wchar_t tszSrcPath[MAX_PATH], tszBackFile[MAX_PATH];
mir_sntprintf(tszSrcPath, L"%s\\%s", tszMirandaPath, p.tszOldName);
mir_sntprintf(tszBackFile, L"%s\\%s", tszFileBack, p.tszOldName);
BackupFile(tszSrcPath, tszBackFile);
@@ -136,7 +136,7 @@ static void ApplyUpdates(void *param) CallService(MS_AB_BACKUP);
if (opts.bChangePlatform) {
- TCHAR mirandaPath[MAX_PATH];
+ wchar_t mirandaPath[MAX_PATH];
GetModuleFileName(NULL, mirandaPath, _countof(mirandaPath));
db_set_ts(NULL, MODNAME, "OldBin2", mirandaPath);
@@ -162,7 +162,7 @@ static void ApplyUpdates(void *param) #if MIRANDA_VER >= 0x0A00
BOOL bRestartCurrentProfile = db_get_b(NULL, MODNAME, "RestartCurrentProfile", 1) ? 1 : 0;
if (opts.bChangePlatform) {
- TCHAR mirstartpath[MAX_PATH];
+ wchar_t mirstartpath[MAX_PATH];
#ifdef _WIN64
mir_sntprintf(mirstartpath, L"%s\\miranda32.exe", tszMirandaPath);
@@ -207,10 +207,10 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM {
wchar_t szPath[MAX_PATH];
GetModuleFileName(NULL, szPath, _countof(szPath));
- TCHAR *ext = _tcsrchr(szPath, '.');
+ wchar_t *ext = wcsrchr(szPath, '.');
if (ext != NULL)
*ext = '\0';
- _tcscat(szPath, L".test");
+ wcscat(szPath, L".test");
HANDLE hFile = CreateFile(szPath, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
// Running Windows Vista or later (major version >= 6).
@@ -268,9 +268,9 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM for (int i = 0; i < todo.getCount(); ++i) {
LVITEM lvI = {0};
lvI.mask = LVIF_TEXT | LVIF_PARAM | LVIF_GROUPID | LVIF_NORECOMPUTE;
- lvI.iGroupId = (_tcsstr(todo[i].tszOldName, L"Plugins") != NULL) ? 1 :
- ((_tcsstr(todo[i].tszOldName, L"Languages") != NULL) ? 3 :
- ((_tcsstr(todo[i].tszOldName, L"Icons") != NULL) ? 4 : 2));
+ lvI.iGroupId = (wcsstr(todo[i].tszOldName, L"Plugins") != NULL) ? 1 :
+ ((wcsstr(todo[i].tszOldName, L"Languages") != NULL) ? 3 :
+ ((wcsstr(todo[i].tszOldName, L"Icons") != NULL) ? 4 : 2));
lvI.iSubItem = 0;
lvI.lParam = (LPARAM)&todo[i];
lvI.pszText = todo[i].tszOldName;
@@ -410,7 +410,7 @@ static void DlgUpdateSilent(void *param) AutoHandle pipe(hPipe);
//create needed folders after escalating priviledges. Folders creates when we actually install updates
- TCHAR tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH];
+ wchar_t tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH];
mir_sntprintf(tszFileBack, L"%s\\Backups", g_tszRoot);
SafeCreateDirectory(tszFileBack);
@@ -452,7 +452,7 @@ static void DlgUpdateSilent(void *param) if (p.bEnabled) {
if (p.bDeleteOnly) {
// we need only to backup the old file
- TCHAR *ptszRelPath = p.tszNewName + _tcslen(tszMirandaPath) + 1, tszBackFile[MAX_PATH];
+ wchar_t *ptszRelPath = p.tszNewName + wcslen(tszMirandaPath) + 1, tszBackFile[MAX_PATH];
mir_sntprintf(tszBackFile, L"%s\\%s", tszFileBack, ptszRelPath);
BackupFile(p.tszNewName, tszBackFile);
}
@@ -460,7 +460,7 @@ static void DlgUpdateSilent(void *param) // if file name differs, we also need to backup the old file here
// otherwise it would be replaced by unzip
if (_tcsicmp(p.tszOldName, p.tszNewName)) {
- TCHAR tszSrcPath[MAX_PATH], tszBackFile[MAX_PATH];
+ wchar_t tszSrcPath[MAX_PATH], tszBackFile[MAX_PATH];
mir_sntprintf(tszSrcPath, L"%s\\%s", tszMirandaPath, p.tszOldName);
mir_sntprintf(tszBackFile, L"%s\\%s", tszFileBack, p.tszOldName);
BackupFile(tszSrcPath, tszBackFile);
@@ -492,7 +492,7 @@ static void DlgUpdateSilent(void *param) db_set_b(NULL, MODNAME, DB_SETTING_NEED_RESTART, 1);
// 5) Prepare Restart
- TCHAR tszTitle[100];
+ wchar_t tszTitle[100];
mir_sntprintf(tszTitle, TranslateT("%d component(s) was updated"), count);
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1)) {
@@ -514,7 +514,7 @@ static void DlgUpdateSilent(void *param) if (!notified) {
// Error, let's try to show MessageBox as last way to inform user about successful update
- TCHAR tszText[200];
+ wchar_t tszText[200];
mir_sntprintf(tszText, L"%s\n\n%s", TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
if (MessageBox(NULL, tszText, tszTitle, MB_ICONINFORMATION | MB_YESNO) == IDYES)
@@ -540,7 +540,7 @@ static void __stdcall LaunchDialog(void *param) struct
{
- TCHAR *oldName, *newName;
+ wchar_t *oldName, *newName;
}
static renameTable[] =
{
@@ -603,18 +603,18 @@ static renameTable[] = // Checks if file needs to be renamed and copies it in pNewName
// Returns true if smth. was copied
-static bool CheckFileRename(const TCHAR *ptszOldName, TCHAR *pNewName)
+static bool CheckFileRename(const wchar_t *ptszOldName, wchar_t *pNewName)
{
for (int i = 0; i < _countof(renameTable); i++) {
if (wildcmpit(ptszOldName, renameTable[i].oldName)) {
- TCHAR *ptszDest = renameTable[i].newName;
+ wchar_t *ptszDest = renameTable[i].newName;
if (ptszDest == NULL)
*pNewName = 0;
else {
- _tcsncpy_s(pNewName, MAX_PATH, ptszDest, _TRUNCATE);
- size_t cbLen = _tcslen(ptszDest) - 1;
+ wcsncpy_s(pNewName, MAX_PATH, ptszDest, _TRUNCATE);
+ size_t cbLen = wcslen(ptszDest) - 1;
if (pNewName[cbLen] == '*')
- _tcsncpy_s(pNewName + cbLen, MAX_PATH - cbLen, ptszOldName, _TRUNCATE);
+ wcsncpy_s(pNewName + cbLen, MAX_PATH - cbLen, ptszOldName, _TRUNCATE);
}
return true;
}
@@ -625,23 +625,23 @@ static bool CheckFileRename(const TCHAR *ptszOldName, TCHAR *pNewName) /////////////////////////////////////////////////////////////////////////////////////////
// We only update ".dll", ".exe" and ".ico"
-static bool isValidExtension(const TCHAR *ptszFileName)
+static bool isValidExtension(const wchar_t *ptszFileName)
{
- const TCHAR *pExt = _tcsrchr(ptszFileName, '.');
+ const wchar_t *pExt = wcsrchr(ptszFileName, '.');
return (pExt != NULL) && (!_tcsicmp(pExt, L".dll") || !_tcsicmp(pExt, L".exe") || !_tcsicmp(pExt, L".txt"));
}
// We only scan subfolders "Plugins", "Icons", "Languages", "Libs", "Core"
-static bool isValidDirectory(const TCHAR *ptszDirName)
+static bool isValidDirectory(const wchar_t *ptszDirName)
{
return !_tcsicmp(ptszDirName, L"Plugins") || !_tcsicmp(ptszDirName, L"Icons") || !_tcsicmp(ptszDirName, L"Languages") || !_tcsicmp(ptszDirName, L"Libs") || !_tcsicmp(ptszDirName, L"Core");
}
// Scans folders recursively
-static int ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, const TCHAR *tszBaseUrl, SERVLIST& hashes, OBJLIST<FILEINFO> *UpdateFiles, int level = 0)
+static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t *tszBaseUrl, SERVLIST& hashes, OBJLIST<FILEINFO> *UpdateFiles, int level = 0)
{
- TCHAR tszBuf[MAX_PATH];
+ wchar_t tszBuf[MAX_PATH];
mir_sntprintf(tszBuf, L"%s\\*", tszFolder);
WIN32_FIND_DATA ffd;
@@ -662,7 +662,7 @@ static int ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, const TCHAR *tsz }
else if (isValidExtension(ffd.cFileName)) {
// calculate the current file's relative name and store it into tszNewName
- TCHAR tszNewName[MAX_PATH];
+ wchar_t tszNewName[MAX_PATH];
if (CheckFileRename(ffd.cFileName, tszNewName)) {
Netlib_LogfT(hNetlibUser, L"File %s will be renamed to %s.", ffd.cFileName, tszNewName);
// Yes, we need the old file name, because this will be hashed later
@@ -671,7 +671,7 @@ static int ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, const TCHAR *tsz else {
if (level == 0) {
// Rename Miranda*.exe
- _tcsncpy_s(tszNewName, opts.bChangePlatform && !mir_tstrcmpi(ffd.cFileName, OLD_FILENAME) ? NEW_FILENAME : ffd.cFileName, _TRUNCATE);
+ wcsncpy_s(tszNewName, opts.bChangePlatform && !mir_tstrcmpi(ffd.cFileName, OLD_FILENAME) ? NEW_FILENAME : ffd.cFileName, _TRUNCATE);
mir_sntprintf(tszBuf, L"%s\\%s", tszFolder, tszNewName);
}
else {
@@ -680,17 +680,17 @@ static int ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, const TCHAR *tsz }
}
- TCHAR *ptszUrl;
+ wchar_t *ptszUrl;
int MyCRC;
bool bDeleteOnly = (tszNewName[0] == 0);
// this file is not marked for deletion
if (!bDeleteOnly) {
- TCHAR *pName = tszNewName;
+ wchar_t *pName = tszNewName;
ServListEntry *item = hashes.find((ServListEntry*)&pName);
// Not in list? Check for trailing 'W' or 'w'
if (item == NULL) {
- TCHAR *p = _tcsrchr(tszNewName, '.');
+ wchar_t *p = wcsrchr(tszNewName, '.');
if (p[-1] != 'w' && p[-1] != 'W') {
Netlib_LogfT(hNetlibUser, L"File %s: Not found on server, skipping", ffd.cFileName);
continue;
@@ -744,26 +744,26 @@ static int ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, const TCHAR *tsz // Yeah, we've got new version.
FILEINFO *FileInfo = new FILEINFO;
// copy the relative old name
- _tcsncpy(FileInfo->tszOldName, tszBuf + cbBaseLen, _countof(FileInfo->tszOldName));
+ wcsncpy(FileInfo->tszOldName, tszBuf + cbBaseLen, _countof(FileInfo->tszOldName));
FileInfo->bDeleteOnly = bDeleteOnly;
if (FileInfo->bDeleteOnly) {
// save the full old name for deletion
- _tcsncpy(FileInfo->tszNewName, tszBuf, _countof(FileInfo->tszNewName));
+ wcsncpy(FileInfo->tszNewName, tszBuf, _countof(FileInfo->tszNewName));
}
else {
- _tcsncpy(FileInfo->tszNewName, ptszUrl, _countof(FileInfo->tszNewName));
+ wcsncpy(FileInfo->tszNewName, ptszUrl, _countof(FileInfo->tszNewName));
}
- _tcsncpy(tszBuf, ptszUrl, _countof(tszBuf));
- TCHAR *p = _tcsrchr(tszBuf, '.');
+ wcsncpy(tszBuf, ptszUrl, _countof(tszBuf));
+ wchar_t *p = wcsrchr(tszBuf, '.');
if (p) *p = 0;
- p = _tcsrchr(tszBuf, '\\');
+ p = wcsrchr(tszBuf, '\\');
p = (p) ? p + 1 : tszBuf;
- _tcslwr(p);
+ wcslwr(p);
mir_sntprintf(FileInfo->File.tszDiskPath, L"%s\\Temp\\%s.zip", g_tszRoot, p);
mir_sntprintf(FileInfo->File.tszDownloadURL, L"%s/%s.zip", tszBaseUrl, tszBuf);
- for (p = _tcschr(FileInfo->File.tszDownloadURL, '\\'); p != 0; p = _tcschr(p, '\\'))
+ for (p = wcschr(FileInfo->File.tszDownloadURL, '\\'); p != 0; p = wcschr(p, '\\'))
*p++ = '/';
// remember whether the user has decided not to update this component with this particular new version
@@ -789,7 +789,7 @@ static void CheckUpdates(void *) Netlib_LogfT(hNetlibUser, L"Checking for updates");
Thread_SetName("PluginUpdater: CheckUpdates");
- TCHAR tszTempPath[MAX_PATH];
+ wchar_t tszTempPath[MAX_PATH];
DWORD dwLen = GetTempPath(_countof(tszTempPath), tszTempPath);
if (tszTempPath[dwLen - 1] == '\\')
tszTempPath[dwLen - 1] = 0;
diff --git a/plugins/PluginUpdater/src/Events.cpp b/plugins/PluginUpdater/src/Events.cpp index 1afbe741cc..ea4c6e8ddf 100644 --- a/plugins/PluginUpdater/src/Events.cpp +++ b/plugins/PluginUpdater/src/Events.cpp @@ -24,7 +24,7 @@ HANDLE hPluginUpdaterFolder; int OnFoldersChanged(WPARAM, LPARAM)
{
FoldersGetCustomPathT(hPluginUpdaterFolder, g_tszRoot, MAX_PATH, L"");
- size_t len = _tcslen(g_tszRoot);
+ size_t len = wcslen(g_tszRoot);
if (g_tszRoot[len-1] == '\\' || g_tszRoot[len-1] == '/')
g_tszRoot[len-1] = 0;
return 0;
diff --git a/plugins/PluginUpdater/src/Notifications.cpp b/plugins/PluginUpdater/src/Notifications.cpp index f21dd3481f..5741de81bd 100644 --- a/plugins/PluginUpdater/src/Notifications.cpp +++ b/plugins/PluginUpdater/src/Notifications.cpp @@ -70,7 +70,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hPopup, UINT uMsg, WPARAM wParam, LPAR static void _stdcall RestartPrompt(void *)
{
- TCHAR tszText[200];
+ wchar_t tszText[200];
mir_sntprintf(tszText, L"%s\n\n%s", TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
if (MessageBox(0, tszText, TranslateT("Plugin Updater"), MB_YESNO | MB_ICONQUESTION | MB_TOPMOST) == IDYES)
diff --git a/plugins/PluginUpdater/src/Notifications.h b/plugins/PluginUpdater/src/Notifications.h index 1d8544ba63..2819baf04b 100644 --- a/plugins/PluginUpdater/src/Notifications.h +++ b/plugins/PluginUpdater/src/Notifications.h @@ -60,9 +60,9 @@ extern struct POPUP_OPTIONS { } PopupOptions;
static struct {
- TCHAR *Text;
+ wchar_t *Text;
int Action;
} PopupActions[] = {
- LPGENT("Close popup"), PCA_CLOSEPOPUP,
- LPGENT("Do nothing"), PCA_DONOTHING
+ LPGENW("Close popup"), PCA_CLOSEPOPUP,
+ LPGENW("Do nothing"), PCA_DONOTHING
};
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp index 4586df734a..1e379e7264 100644 --- a/plugins/PluginUpdater/src/Options.cpp +++ b/plugins/PluginUpdater/src/Options.cpp @@ -34,7 +34,7 @@ static int GetUpdateMode() // Check if there is url for custom mode
if (UpdateMode == UPDATE_MODE_CUSTOM) {
ptrT url(db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL));
- if (url == NULL || !_tcslen(url)) {
+ if (url == NULL || !wcslen(url)) {
// No url for custom mode, reset that setting so it will be determined automatically
db_unset(NULL, MODNAME, DB_SETTING_UPDATE_MODE);
UpdateMode = -1;
@@ -51,9 +51,9 @@ static int GetUpdateMode() return UpdateMode;
}
-TCHAR* GetDefaultUrl()
+wchar_t* GetDefaultUrl()
{
- TCHAR url[MAX_PATH];
+ wchar_t url[MAX_PATH];
switch (GetUpdateMode()) {
case UPDATE_MODE_STABLE:
mir_sntprintf(url, _T(DEFAULT_UPDATE_URL), opts.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
@@ -71,7 +71,7 @@ TCHAR* GetDefaultUrl() static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- TCHAR defurl[MAX_PATH];
+ wchar_t defurl[MAX_PATH];
switch (msg) {
case WM_INITDIALOG:
@@ -98,7 +98,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar if (ServiceExists(MS_AB_BACKUP)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_BACKUP), TRUE);
- SetDlgItemText(hwndDlg, IDC_BACKUP, LPGENT("Backup database before update"));
+ SetDlgItemText(hwndDlg, IDC_BACKUP, LPGENW("Backup database before update"));
if(opts.bBackup)
CheckDlgButton(hwndDlg, IDC_BACKUP, BST_CHECKED);
}
@@ -111,7 +111,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar int UpdateMode = db_get_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
if (UpdateMode == UPDATE_MODE_STABLE)
db_set_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
- SetDlgItemText(hwndDlg,IDC_STABLE,LPGENT("Stable version (incompatible with current development version)"));
+ SetDlgItemText(hwndDlg,IDC_STABLE,LPGENW("Stable version (incompatible with current development version)"));
}
TranslateDialogDefault(hwndDlg);
@@ -266,9 +266,9 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar db_set_b(NULL, MODNAME, "PeriodMeasure", opts.bPeriodMeasure = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE)));
db_set_b(NULL, MODNAME, "SilentMode", opts.bSilentMode = IsDlgButtonChecked(hwndDlg, IDC_SILENTMODE));
db_set_b(NULL, MODNAME, "Backup", opts.bBackup = IsDlgButtonChecked(hwndDlg, IDC_BACKUP));
- TCHAR buffer[3] = {0};
+ wchar_t buffer[3] = {0};
Edit_GetText(GetDlgItem(hwndDlg, IDC_PERIOD), buffer, _countof(buffer));
- db_set_dw(NULL, MODNAME, "Period", opts.Period = _ttoi(buffer));
+ db_set_dw(NULL, MODNAME, "Period", opts.Period = _wtoi(buffer));
mir_forkthread(InitTimer, (void*)1);
@@ -293,7 +293,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar }
}
else {
- TCHAR tszUrl[100];
+ wchar_t tszUrl[100];
GetDlgItemText(hwndDlg, IDC_CUSTOMURL, tszUrl, _countof(tszUrl));
db_set_ts(NULL, MODNAME, DB_SETTING_UPDATE_URL, tszUrl);
db_set_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_CUSTOM);
@@ -512,15 +512,15 @@ static int OptInit(WPARAM wParam, LPARAM) odp.hInstance = hInst;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_UPDATENOTIFY);
- odp.ptszGroup = LPGENT("Services");
- odp.ptszTitle = LPGENT("Plugin Updater");
+ odp.pwszGroup = LPGENW("Services");
+ odp.pwszTitle = LPGENW("Plugin Updater");
odp.pfnDlgProc = UpdateNotifyOptsProc;
Options_AddPage(wParam, &odp);
if ( ServiceExists(MS_POPUP_ADDPOPUPT)) {
odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP);
- odp.ptszGroup = LPGENT("Popups");
- odp.ptszTitle = LPGENT("Plugin Updater");
+ odp.pwszGroup = LPGENW("Popups");
+ odp.pwszTitle = LPGENW("Plugin Updater");
odp.pfnDlgProc = DlgPopupOpts;
Options_AddPage(wParam, &odp);
}
diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp index 4a07853828..a10066806b 100644 --- a/plugins/PluginUpdater/src/PluginUpdater.cpp +++ b/plugins/PluginUpdater/src/PluginUpdater.cpp @@ -20,7 +20,7 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
HINSTANCE hInst = NULL;
-TCHAR g_tszRoot[MAX_PATH] = {0}, g_tszTempPath[MAX_PATH];
+wchar_t g_tszRoot[MAX_PATH] = {0}, g_tszTempPath[MAX_PATH];
int hLangpack;
DWORD g_mirandaVersion;
diff --git a/plugins/PluginUpdater/src/Services.cpp b/plugins/PluginUpdater/src/Services.cpp index 4111fca483..bd12b68f17 100644 --- a/plugins/PluginUpdater/src/Services.cpp +++ b/plugins/PluginUpdater/src/Services.cpp @@ -29,7 +29,7 @@ static INT_PTR srvParseHashes(WPARAM wParam, LPARAM lParam) SERVLIST *pList = new SERVLIST(50, CompareHashes);
ptrT baseUrl;
if ( ParseHashes(ptszUrl, baseUrl, *pList)) {
- _tcsncpy(ptszBaseUrl, baseUrl, MAX_PATH);
+ wcsncpy(ptszBaseUrl, baseUrl, MAX_PATH);
return (INT_PTR)pList;
}
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index 2d3923b7cd..b298f38345 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -43,9 +43,9 @@ void LoadOptions() #if MIRANDA_VER >= 0x0A00
IconItemT iconList[] =
{
- { LPGENT("Check for updates"),"check_update", IDI_MENU },
- { LPGENT("Plugin info"), "info", IDI_INFO },
- { LPGENT("Component list"),"plg_list", IDI_PLGLIST }
+ { LPGENW("Check for updates"),"check_update", IDI_MENU },
+ { LPGENW("Plugin info"), "info", IDI_INFO },
+ { LPGENW("Component list"),"plg_list", IDI_PLGLIST }
};
void InitIcoLib()
@@ -128,17 +128,17 @@ int CompareHashes(const ServListEntry *p1, const ServListEntry *p2) return _tcsicmp(p1->m_name, p2->m_name);
}
-bool ParseHashes(const TCHAR *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes)
+bool ParseHashes(const wchar_t *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes)
{
REPLACEVARSARRAY vars[2];
#if MIRANDA_VER >=0x0A00
- vars[0].key.t = L"platform";
+ vars[0].key.w = L"platform";
#ifdef _WIN64
- vars[0].value.t = L"64";
+ vars[0].value.w = L"64";
#else
- vars[0].value.t = L"32";
+ vars[0].value.w = L"32";
#endif
- vars[1].key.t = vars[1].value.t = 0;
+ vars[1].key.w = vars[1].value.w = 0;
#else
vars[0].lptzKey = L"platform";
#ifdef _WIN64
@@ -176,9 +176,9 @@ bool ParseHashes(const TCHAR *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes) DeleteFile(pFileUrl.tszDiskPath);
- TCHAR tszTmpIni[MAX_PATH] = {0};
+ wchar_t tszTmpIni[MAX_PATH] = {0};
mir_sntprintf(tszTmpIni, L"%s\\hashes.txt", g_tszTempPath);
- FILE *fp = _tfopen(tszTmpIni, L"r");
+ FILE *fp = _wfopen(tszTmpIni, L"r");
if (!fp) {
Netlib_LogfT(hNetlibUser,L"Opening %s failed", g_tszTempPath);
ShowPopup(TranslateT("Plugin Updater"), TranslateT("An error occurred while checking for new updates."), POPUP_TYPE_ERROR);
@@ -284,7 +284,7 @@ bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc) }
else {
// try to write it via PU stub
- TCHAR tszTempFile[MAX_PATH];
+ wchar_t tszTempFile[MAX_PATH];
mir_sntprintf(tszTempFile, L"%s\\pulocal.tmp", g_tszTempPath);
hFile = CreateFile(tszTempFile, GENERIC_READ | GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE) {
@@ -482,12 +482,12 @@ Cleanup: bool PrepareEscalation()
{
// First try to create a file near Miranda32.exe
- TCHAR szPath[MAX_PATH];
+ wchar_t szPath[MAX_PATH];
GetModuleFileName(NULL, szPath, _countof(szPath));
- TCHAR *ext = _tcsrchr(szPath, '.');
+ wchar_t *ext = wcsrchr(szPath, '.');
if (ext != NULL)
*ext = '\0';
- _tcscat(szPath, L".test");
+ wcscat(szPath, L".test");
HANDLE hFile = CreateFile(szPath, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE) {
// we are admins or UAC is disable, cool
@@ -501,17 +501,17 @@ bool PrepareEscalation() }
else {
// Elevate the process. Create a pipe for a stub first
- TCHAR tszPipeName[MAX_PATH];
+ wchar_t tszPipeName[MAX_PATH];
mir_sntprintf(tszPipeName, L"\\\\.\\pipe\\Miranda_Pu_%d", GetCurrentProcessId());
hPipe = CreateNamedPipe(tszPipeName, PIPE_ACCESS_DUPLEX, PIPE_READMODE_BYTE | PIPE_WAIT, 1, 1024, 1024, NMPWAIT_USE_DEFAULT_WAIT, NULL);
if (hPipe == INVALID_HANDLE_VALUE) {
hPipe = NULL;
}
else {
- TCHAR cmdLine[100], *p;
+ wchar_t cmdLine[100], *p;
GetModuleFileName(NULL, szPath, ARRAYSIZE(szPath));
- if ((p = _tcsrchr(szPath, '\\')) != 0)
- _tcscpy(p+1, L"pu_stub.exe");
+ if ((p = wcsrchr(szPath, '\\')) != 0)
+ wcscpy(p+1, L"pu_stub.exe");
mir_sntprintf(cmdLine, L"%d", GetCurrentProcessId());
// Launch a stub
@@ -540,7 +540,7 @@ bool PrepareEscalation() /////////////////////////////////////////////////////////////////////////////////////////
-int TransactPipe(int opcode, const TCHAR *p1, const TCHAR *p2)
+int TransactPipe(int opcode, const wchar_t *p1, const wchar_t *p2)
{
BYTE buf[1024];
DWORD l1 = lstrlen(p1), l2 = lstrlen(p2);
@@ -548,7 +548,7 @@ int TransactPipe(int opcode, const TCHAR *p1, const TCHAR *p2) return 0;
*(DWORD*)buf = opcode;
- TCHAR *dst = (TCHAR*)&buf[sizeof(DWORD)];
+ wchar_t *dst = (wchar_t*)&buf[sizeof(DWORD)];
lstrcpy(dst, p1);
dst += l1+1;
if (p2) {
@@ -568,7 +568,7 @@ int TransactPipe(int opcode, const TCHAR *p1, const TCHAR *p2) return dwError == ERROR_SUCCESS;
}
-int SafeCopyFile(const TCHAR *pSrc, const TCHAR *pDst)
+int SafeCopyFile(const wchar_t *pSrc, const wchar_t *pDst)
{
if (hPipe == NULL)
return CopyFile(pSrc, pDst, FALSE);
@@ -576,7 +576,7 @@ int SafeCopyFile(const TCHAR *pSrc, const TCHAR *pDst) return TransactPipe(1, pSrc, pDst);
}
-int SafeMoveFile(const TCHAR *pSrc, const TCHAR *pDst)
+int SafeMoveFile(const wchar_t *pSrc, const wchar_t *pDst)
{
if (hPipe == NULL) {
DeleteFile(pDst);
@@ -588,7 +588,7 @@ int SafeMoveFile(const TCHAR *pSrc, const TCHAR *pDst) return TransactPipe(2, pSrc, pDst);
}
-int SafeDeleteFile(const TCHAR *pFile)
+int SafeDeleteFile(const wchar_t *pFile)
{
if (hPipe == NULL)
return DeleteFile(pFile);
@@ -596,7 +596,7 @@ int SafeDeleteFile(const TCHAR *pFile) return TransactPipe(3, pFile, NULL);
}
-int SafeCreateDirectory(const TCHAR *pFolder)
+int SafeCreateDirectory(const wchar_t *pFolder)
{
if (hPipe == NULL)
return CreateDirectoryTreeT(pFolder);
@@ -604,7 +604,7 @@ int SafeCreateDirectory(const TCHAR *pFolder) return TransactPipe(4, pFolder, NULL);
}
-int SafeCreateFilePath(TCHAR *pFolder)
+int SafeCreateFilePath(wchar_t *pFolder)
{
if (hPipe == NULL) {
CreatePathToFileT(pFolder);
@@ -614,7 +614,7 @@ int SafeCreateFilePath(TCHAR *pFolder) return TransactPipe(5, pFolder, NULL);
}
-void BackupFile(TCHAR *ptszSrcFileName, TCHAR *ptszBackFileName)
+void BackupFile(wchar_t *ptszSrcFileName, wchar_t *ptszBackFileName)
{
SafeCreateFilePath(ptszBackFileName);
SafeMoveFile(ptszSrcFileName, ptszBackFileName);
diff --git a/plugins/PluginUpdater/src/checksum.cpp b/plugins/PluginUpdater/src/checksum.cpp index 48d2d9ee26..ba895515b4 100644 --- a/plugins/PluginUpdater/src/checksum.cpp +++ b/plugins/PluginUpdater/src/checksum.cpp @@ -23,7 +23,7 @@ struct MFileMapping PBYTE ptr;
HANDLE hMap, hFile;
- MFileMapping(const TCHAR* ptszFileName)
+ MFileMapping(const wchar_t* ptszFileName)
{
ptr = NULL;
hMap = NULL;
@@ -69,7 +69,7 @@ static void PatchResourcesDirectory(PIMAGE_RESOURCE_DIRECTORY pIRD, PBYTE pBase) PatchResourceEntry(pIRDE, pBase);
}
-int CalculateModuleHash(const TCHAR *filename, char *szDest)
+int CalculateModuleHash(const wchar_t *filename, char *szDest)
{
MFileMapping map(filename);
if (map.hFile == INVALID_HANDLE_VALUE)
diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h index 501363d3e2..179f0c4879 100644 --- a/plugins/PluginUpdater/src/stdafx.h +++ b/plugins/PluginUpdater/src/stdafx.h @@ -70,14 +70,14 @@ Boston, MA 02111-1307, USA. struct FILEURL
{
- TCHAR tszDownloadURL[2048];
- TCHAR tszDiskPath[MAX_PATH];
+ wchar_t tszDownloadURL[2048];
+ wchar_t tszDiskPath[MAX_PATH];
int CRCsum;
};
struct FILEINFO
{
- TCHAR tszOldName[MAX_PATH], tszNewName[MAX_PATH];
+ wchar_t tszOldName[MAX_PATH], tszNewName[MAX_PATH];
FILEURL File;
BOOL bEnabled, bDeleteOnly;
};
@@ -158,7 +158,7 @@ using namespace std; extern HINSTANCE hInst;
extern DWORD g_mirandaVersion;
-extern TCHAR g_tszRoot[MAX_PATH], g_tszTempPath[MAX_PATH];
+extern wchar_t g_tszRoot[MAX_PATH], g_tszTempPath[MAX_PATH];
extern aPopups PopupsList[POPUPS];
extern HANDLE hPipe, hNetlibUser;
#if MIRANDA_VER >= 0x0A00
@@ -199,7 +199,7 @@ struct ServListEntry mir_free(m_name);
}
- TCHAR *m_name;
+ wchar_t *m_name;
DWORD m_crc;
char m_szHash[32+1];
};
@@ -223,12 +223,12 @@ void UnloadCheck(); void UnloadListNew();
void UnloadNetlib();
-void BackupFile(TCHAR *ptszSrcFileName, TCHAR *ptszBackFileName);
+void BackupFile(wchar_t *ptszSrcFileName, wchar_t *ptszBackFileName);
-bool ParseHashes(const TCHAR *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes);
+bool ParseHashes(const wchar_t *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes);
int CompareHashes(const ServListEntry *p1, const ServListEntry *p2);
-TCHAR* GetDefaultUrl();
+wchar_t* GetDefaultUrl();
bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc);
void ShowPopup(LPCTSTR Title, LPCTSTR Text, int Number);
@@ -237,19 +237,19 @@ void __stdcall OpenPluginOptions(void*); void CheckUpdateOnStartup();
void InitTimer(void *type);
-bool unzip(const TCHAR *ptszZipFile, TCHAR *ptszDestPath, TCHAR *ptszBackPath,bool ch);
+bool unzip(const wchar_t *ptszZipFile, wchar_t *ptszDestPath, wchar_t *ptszBackPath,bool ch);
///////////////////////////////////////////////////////////////////////////////
-int CalculateModuleHash(const TCHAR *tszFileName, char *dest);
+int CalculateModuleHash(const wchar_t *tszFileName, char *dest);
BOOL IsProcessElevated();
bool PrepareEscalation();
-int SafeCreateDirectory(const TCHAR *ptszDirName);
-int SafeCopyFile(const TCHAR *ptszSrc, const TCHAR *ptszDst);
-int SafeMoveFile(const TCHAR *ptszSrc, const TCHAR *ptszDst);
-int SafeDeleteFile(const TCHAR *ptszSrc);
-int SafeCreateFilePath(TCHAR *pFolder);
+int SafeCreateDirectory(const wchar_t *ptszDirName);
+int SafeCopyFile(const wchar_t *ptszSrc, const wchar_t *ptszDst);
+int SafeMoveFile(const wchar_t *ptszSrc, const wchar_t *ptszDst);
+int SafeDeleteFile(const wchar_t *ptszSrc);
+int SafeCreateFilePath(wchar_t *pFolder);
char *StrToLower(char *str);
diff --git a/plugins/PluginUpdater/src/unzipfile.cpp b/plugins/PluginUpdater/src/unzipfile.cpp index 2a64019ada..979dcd289e 100644 --- a/plugins/PluginUpdater/src/unzipfile.cpp +++ b/plugins/PluginUpdater/src/unzipfile.cpp @@ -30,16 +30,16 @@ extern "C" void fill_fopen64_filefunc(zlib_filefunc64_def *pzlib_filefunc_def);
}
-static void PrepareFileName(TCHAR *dest, size_t destSize, const TCHAR *ptszPath, const TCHAR *ptszFileName)
+static void PrepareFileName(wchar_t *dest, size_t destSize, const wchar_t *ptszPath, const wchar_t *ptszFileName)
{
mir_sntprintf(dest, destSize, L"%s\\%s", ptszPath, ptszFileName);
- for (TCHAR *p = dest; *p; ++p)
+ for (wchar_t *p = dest; *p; ++p)
if (*p == '/')
*p = '\\';
}
-bool extractCurrentFile(unzFile uf, TCHAR *ptszDestPath, TCHAR *ptszBackPath, bool ch)
+bool extractCurrentFile(unzFile uf, wchar_t *ptszDestPath, wchar_t *ptszBackPath, bool ch)
{
unz_file_info64 file_info;
char filename[MAX_PATH], buf[8192];
@@ -56,8 +56,8 @@ bool extractCurrentFile(unzFile uf, TCHAR *ptszDestPath, TCHAR *ptszBackPath, bo if (ch && !db_get_b(NULL, DB_MODULE_FILES, StrToLower(ptrA(mir_strdup(filename))), 1))
return true;
- TCHAR tszDestFile[MAX_PATH], tszBackFile[MAX_PATH];
- TCHAR *ptszNewName = mir_utf8decodeT(filename);
+ wchar_t tszDestFile[MAX_PATH], tszBackFile[MAX_PATH];
+ wchar_t *ptszNewName = mir_utf8decodeT(filename);
if (ptszNewName == NULL)
ptszNewName = mir_a2t(filename);
@@ -77,11 +77,11 @@ bool extractCurrentFile(unzFile uf, TCHAR *ptszDestPath, TCHAR *ptszBackPath, bo PrepareFileName(tszDestFile, _countof(tszDestFile), ptszDestPath, ptszNewName);
SafeCreateFilePath(tszDestFile);
- TCHAR *ptszFile2unzip;
+ wchar_t *ptszFile2unzip;
if (hPipe == NULL) // direct mode
ptszFile2unzip = tszDestFile;
else {
- TCHAR tszTempPath[MAX_PATH];
+ wchar_t tszTempPath[MAX_PATH];
GetTempPath( _countof(tszTempPath), tszTempPath);
GetTempFileName(tszTempPath, L"PUtemp", GetCurrentProcessId(), tszBackFile);
ptszFile2unzip = tszBackFile;
@@ -120,7 +120,7 @@ bool extractCurrentFile(unzFile uf, TCHAR *ptszDestPath, TCHAR *ptszBackPath, bo return true;
}
-bool unzip(const TCHAR *ptszZipFile, TCHAR *ptszDestPath, TCHAR *ptszBackPath,bool ch)
+bool unzip(const wchar_t *ptszZipFile, wchar_t *ptszDestPath, wchar_t *ptszBackPath,bool ch)
{
bool bResult = true;
|