summaryrefslogtreecommitdiff
path: root/plugins/AssocMgr
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/AssocMgr')
-rw-r--r--plugins/AssocMgr/src/assoclist.cpp42
-rw-r--r--plugins/AssocMgr/src/assoclist.h4
-rw-r--r--plugins/AssocMgr/src/dde.cpp30
-rw-r--r--plugins/AssocMgr/src/main.cpp8
-rw-r--r--plugins/AssocMgr/src/reg.cpp146
-rw-r--r--plugins/AssocMgr/src/reg.h24
-rw-r--r--plugins/AssocMgr/src/test.cpp16
-rw-r--r--plugins/AssocMgr/src/utils.cpp4
-rw-r--r--plugins/AssocMgr/src/utils.h4
9 files changed, 139 insertions, 139 deletions
diff --git a/plugins/AssocMgr/src/assoclist.cpp b/plugins/AssocMgr/src/assoclist.cpp
index 59d85c22be..7713166680 100644
--- a/plugins/AssocMgr/src/assoclist.cpp
+++ b/plugins/AssocMgr/src/assoclist.cpp
@@ -32,14 +32,14 @@ static HANDLE hServiceAddFile, hServiceRemoveFile, hServiceAddUrl, hServiceRemov
typedef struct
{
char *pszClassName; // class name as used in registry and db
- TCHAR *pszDescription;
+ wchar_t *pszDescription;
HINSTANCE hInstance; // allowed to be NULL for miranda32.exe
WORD nIconResID;
char *pszService;
WORD flags; // set of FTDF_* and UTDF_* flags
char *pszFileExt; // file type: NULL for url type
char *pszMimeType; // file type: allowed to be NULL
- TCHAR *pszVerbDesc; // file type: allowed to be NULL
+ wchar_t *pszVerbDesc; // file type: allowed to be NULL
} ASSOCDATA;
static ASSOCDATA *pAssocList; // protected by csAssocList
@@ -58,7 +58,7 @@ static BOOL IsAssocEnabled(const ASSOCDATA *assoc)
static void SetAssocEnabled(const ASSOCDATA *assoc, BOOL fEnabled)
{
char szSetting[MAXMODULELABELLENGTH];
- TCHAR szDLL[MAX_PATH], szBuf[MAX_PATH];
+ wchar_t szDLL[MAX_PATH], szBuf[MAX_PATH];
mir_snprintf(szSetting, "enabled_%s", assoc->pszClassName);
db_set_b(NULL, "AssocMgr", szSetting, (BYTE)fEnabled);
// dll name for uninstall
@@ -87,7 +87,7 @@ void CleanupAssocEnabledSettings(void)
DBVARIANT dbv;
int i;
HANDLE hFile;
- TCHAR szDLL[MAX_PATH];
+ wchar_t szDLL[MAX_PATH];
char szSetting[MAXMODULELABELLENGTH];
// delete old enabled_* settings if associated plugin no longer present
@@ -264,9 +264,9 @@ static int ReplaceImageListAssocIcon(HIMAGELIST himl, const ASSOCDATA *assoc, in
// the return value does not need to be freed
// this function assumes it has got the csAssocList mutex
-static TCHAR* GetAssocTypeDesc(const ASSOCDATA *assoc)
+static wchar_t* GetAssocTypeDesc(const ASSOCDATA *assoc)
{
- static TCHAR szDesc[32];
+ static wchar_t szDesc[32];
if (assoc->pszFileExt == NULL)
mir_sntprintf(szDesc, L"%hs:", assoc->pszClassName);
else
@@ -283,7 +283,7 @@ static BOOL IsAssocRegistered(const ASSOCDATA *assoc)
fUseMainCmdLine = (assoc->pszService == NULL);
// class
- TCHAR *pszRunCmd = MakeRunCommand(fUseMainCmdLine, !fUseMainCmdLine);
+ wchar_t *pszRunCmd = MakeRunCommand(fUseMainCmdLine, !fUseMainCmdLine);
if (pszRunCmd != NULL)
fSuccess = IsRegClass(assoc->pszClassName, pszRunCmd);
mir_free(pszRunCmd); // does NULL check
@@ -299,7 +299,7 @@ static BOOL IsAssocRegistered(const ASSOCDATA *assoc)
static BOOL EnsureAssocRegistered(const ASSOCDATA *assoc)
{
BOOL fSuccess = FALSE, fIsUrl, fUseMainCmdLine;
- TCHAR *pszIconLoc, *pszRunCmd, *pszDdeCmd, *pszAppFileName;
+ wchar_t *pszIconLoc, *pszRunCmd, *pszDdeCmd, *pszAppFileName;
fIsUrl = (assoc->pszFileExt == NULL);
fUseMainCmdLine = (assoc->pszService == NULL);
@@ -344,13 +344,13 @@ static BOOL EnsureAssocRegistered(const ASSOCDATA *assoc)
static BOOL UnregisterAssoc(const ASSOCDATA *assoc)
{
BOOL fIsUrl, fUseMainCmdLine;
- TCHAR *pszAppFileName;
+ wchar_t *pszAppFileName;
fIsUrl = (assoc->pszFileExt == NULL);
fUseMainCmdLine = (assoc->pszService == NULL);
// class might have been registered by another instance
- TCHAR *pszRunCmd = MakeRunCommand(fUseMainCmdLine, !fUseMainCmdLine);
+ wchar_t *pszRunCmd = MakeRunCommand(fUseMainCmdLine, !fUseMainCmdLine);
if (pszRunCmd != NULL && !IsRegClass(assoc->pszClassName, pszRunCmd)) {
mir_free(pszRunCmd);
return TRUE; // succeed anyway
@@ -393,7 +393,7 @@ typedef struct
// ownership of pszClassName, pszFileExt, pszVerbDesc and pszMimeType is transfered
// to the storage list on success
-static BOOL AddNewAssocItem_Worker(char *pszClassName, const TYPEDESCHEAD *tdh, char *pszFileExt, TCHAR *pszVerbDesc, char *pszMimeType)
+static BOOL AddNewAssocItem_Worker(char *pszClassName, const TYPEDESCHEAD *tdh, char *pszFileExt, wchar_t *pszVerbDesc, char *pszMimeType)
{
ASSOCDATA *pAssocListBuf, *assoc;
@@ -486,7 +486,7 @@ static INT_PTR ServiceAddNewFileType(WPARAM, LPARAM lParam)
char *pszFileExt = mir_strdup(ftd->pszFileExt);
char *pszClassName = MakeFileClassName(ftd->pszFileExt);
if (pszFileExt != NULL && pszClassName != NULL) {
- TCHAR *pszVerbDesc = s2t(ftd->ptszVerbDesc, ftd->flags&FTDF_UNICODE, TRUE); // does NULL check
+ wchar_t *pszVerbDesc = s2t(ftd->ptszVerbDesc, ftd->flags&FTDF_UNICODE, TRUE); // does NULL check
char *pszMimeType = mir_strdup(ftd->pszMimeType); // does NULL check
if (AddNewAssocItem_Worker(pszClassName, (TYPEDESCHEAD*)ftd, pszFileExt, pszVerbDesc, pszMimeType))
// no need to free pszClassName, pszFileExt, pszVerbDesc and pszMimeType,
@@ -546,7 +546,7 @@ static INT_PTR ServiceRemoveUrlType(WPARAM, LPARAM lParam)
/************************* Open Handler ***************************/
-static BOOL InvokeHandler_Worker(const char *pszClassName, const TCHAR *pszParam, INT_PTR *res)
+static BOOL InvokeHandler_Worker(const char *pszClassName, const wchar_t *pszParam, INT_PTR *res)
{
void *pvParam;
char *pszService;
@@ -578,13 +578,13 @@ static BOOL InvokeHandler_Worker(const char *pszClassName, const TCHAR *pszParam
return TRUE;
}
-INT_PTR InvokeFileHandler(const TCHAR *pszFileName)
+INT_PTR InvokeFileHandler(const wchar_t *pszFileName)
{
char *pszClassName, *pszFileExt;
INT_PTR res = CALLSERVICE_NOTFOUND;
// find extension
- TCHAR *p = (TCHAR*)_tcsrchr(pszFileName, _T('.'));
+ wchar_t *p = (wchar_t*)wcsrchr(pszFileName, '.');
if (p != NULL) {
pszFileExt = t2a(p);
if (pszFileExt != NULL) {
@@ -603,7 +603,7 @@ INT_PTR InvokeFileHandler(const TCHAR *pszFileName)
return res;
}
-INT_PTR InvokeUrlHandler(const TCHAR *pszUrl)
+INT_PTR InvokeUrlHandler(const wchar_t *pszUrl)
{
char *pszClassName, *pszProtoPrefix, *p;
INT_PTR res = CALLSERVICE_NOTFOUND;
@@ -611,7 +611,7 @@ INT_PTR InvokeUrlHandler(const TCHAR *pszUrl)
// find prefix
pszProtoPrefix = t2a(pszUrl);
if (pszProtoPrefix != NULL) {
- p = strchr(pszProtoPrefix, _T(':'));
+ p = strchr(pszProtoPrefix, ':');
if (p != NULL) {
*(++p) = 0; // remove trailing :
// class name
@@ -743,7 +743,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara
CheckDlgButton(hwndDlg, IDC_ONLYWHILERUNNING, (BOOL)db_get_b(NULL, "AssocMgr", "OnlyWhileRunning", SETTING_ONLYWHILERUNNING_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
// autostart
- TCHAR *pszRunCmd = MakeRunCommand(TRUE, TRUE);
+ wchar_t *pszRunCmd = MakeRunCommand(TRUE, TRUE);
if (pszRunCmd != NULL) {
CheckDlgButton(hwndDlg, IDC_AUTOSTART, IsRegRunEntry(L"MirandaNG", pszRunCmd) ? BST_CHECKED : BST_UNCHECKED);
mir_free(pszRunCmd);
@@ -892,7 +892,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara
PostMessage(hwndDlg, M_REFRESH_ICONS, 0, 0);
// autostart
- TCHAR *pszRunCmd = MakeRunCommand(TRUE, TRUE);
+ wchar_t *pszRunCmd = MakeRunCommand(TRUE, TRUE);
fRegFailed = FALSE;
if (pszRunCmd != NULL) {
fEnabled = IsDlgButtonChecked(hwndDlg, IDC_AUTOSTART);
@@ -953,7 +953,7 @@ void InitAssocList(void)
// register open-with app
{
- TCHAR *pszAppFileName, *pszIconLoc, *pszRunCmd;
+ wchar_t *pszAppFileName, *pszIconLoc, *pszRunCmd;
pszIconLoc = MakeIconLocation(NULL, 0);
// miranda32.exe
@@ -1025,7 +1025,7 @@ void UninitAssocList(void)
// unregister open-with app
if (fOnlyWhileRunning) {
- TCHAR *pszAppFileName;
+ wchar_t *pszAppFileName;
// miranda32.exe
pszAppFileName = MakeAppFileName(TRUE);
if (pszAppFileName != NULL)
diff --git a/plugins/AssocMgr/src/assoclist.h b/plugins/AssocMgr/src/assoclist.h
index 5e8806b828..fafbbdf097 100644
--- a/plugins/AssocMgr/src/assoclist.h
+++ b/plugins/AssocMgr/src/assoclist.h
@@ -26,8 +26,8 @@ void CleanupMimeTypeAddedSettings(void);
/* Assoc List Utils */
BOOL IsRegisteredAssocItem(const char *pszClassName);
/* Open Handler */
-INT_PTR InvokeFileHandler(const TCHAR *pszFileName);
-INT_PTR InvokeUrlHandler(const TCHAR *pszUrl);
+INT_PTR InvokeFileHandler(const wchar_t *pszFileName);
+INT_PTR InvokeUrlHandler(const wchar_t *pszUrl);
/* Misc */
void InitAssocList(void);
void UninitAssocList(void);
diff --git a/plugins/AssocMgr/src/dde.cpp b/plugins/AssocMgr/src/dde.cpp
index 35fd6a9e28..aca64350e7 100644
--- a/plugins/AssocMgr/src/dde.cpp
+++ b/plugins/AssocMgr/src/dde.cpp
@@ -32,7 +32,7 @@ static HANDLE hHookModulesLoaded, hHookPreShutdown;
// pszFilePath needs to be allocated using mir_alloc()
static void __stdcall FileActionAsync(void *param)
{
- TCHAR *pszFilePath = (TCHAR*)param;
+ wchar_t *pszFilePath = (wchar_t*)param;
/* invoke main handler */
switch (InvokeFileHandler(pszFilePath)) { /* pszFilePath is always a long path name */
case 0: /* success */ break;
@@ -48,7 +48,7 @@ static void __stdcall FileActionAsync(void *param)
// pszUrl needs to be allocated using mir_alloc()
static void __stdcall UrlActionAsync(void *param)
{
- TCHAR *pszUrl = (TCHAR*)param;
+ wchar_t *pszUrl = (wchar_t*)param;
/* invoke main handler */
switch (InvokeUrlHandler(pszUrl)) {
case 0: /* success */ break;
@@ -68,16 +68,16 @@ static void __stdcall UrlActionAsync(void *param)
// returned pointer points into a substring of ppszString
// returns an empty string if the string does not have enough arguments
-static TCHAR* GetExecuteParam(TCHAR **ppszString)
+static wchar_t* GetExecuteParam(wchar_t **ppszString)
{
- bool fQuoted = (**ppszString == _T('"'));
- TCHAR *pszParam = *ppszString;
+ bool fQuoted = (**ppszString == '"');
+ wchar_t *pszParam = *ppszString;
if (fQuoted)
pszParam++;
- TCHAR *p = _tcschr(pszParam, (TCHAR)(fQuoted ? _T('"') : _T(',')));
+ wchar_t *p = wcschr(pszParam, (wchar_t)(fQuoted ? '"' : ','));
if (p != NULL) {
*(p++) = 0;
- if (fQuoted && *p == _T(',')) p++;
+ if (fQuoted && *p == ',') p++;
}
else p = &pszParam[mir_tstrlen(pszParam)];
*ppszString = p;
@@ -108,10 +108,10 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd, UINT msg, WPARAM wParam, LPA
if (UnpackDDElParam(msg, lParam, NULL, (PUINT_PTR)&hCommand)) {
/* ANSI execute command can't happen for shell */
if (IsWindowUnicode((HWND)wParam)) {
- TCHAR *pszCommand = (TCHAR*)GlobalLock(hCommand);
+ wchar_t *pszCommand = (wchar_t*)GlobalLock(hCommand);
if (pszCommand != NULL) {
- TCHAR *pszAction = GetExecuteParam(&pszCommand);
- TCHAR *pszArg = GetExecuteParam(&pszCommand);
+ wchar_t *pszAction = GetExecuteParam(&pszCommand);
+ wchar_t *pszArg = GetExecuteParam(&pszCommand);
if (pszArg != NULL) {
/* we are inside miranda here, we make it async so the shell does
* not timeout regardless what the plugins try to do. */
@@ -161,14 +161,14 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd, UINT msg, WPARAM wParam, LPA
}
// CloseHandle() the return value
-static HANDLE StartupMainProcess(TCHAR *pszDatabasePath)
+static HANDLE StartupMainProcess(wchar_t *pszDatabasePath)
{
- TCHAR *p, szPath[MAX_PATH];
+ wchar_t *p, szPath[MAX_PATH];
/* we are inside RunDll32 here */
if (!GetModuleFileName(hInst, szPath, _countof(szPath))) return NULL;
- p = _tcsrchr(szPath, _T('\\'));
- if (p != NULL) { *p = 0; p = _tcsrchr(szPath, _T('\\')); }
+ p = wcsrchr(szPath, '\\');
+ if (p != NULL) { *p = 0; p = wcsrchr(szPath, '\\'); }
if (p == NULL) return NULL;
mir_tstrcpy(++p, L"miranda32.exe");
@@ -187,7 +187,7 @@ extern "C" {
#endif
// entry point for RunDll32, this is also WaitForDDEW
- __declspec(dllexport) void CALLBACK WaitForDDE(HWND, HINSTANCE, TCHAR *pszCmdLine, int)
+ __declspec(dllexport) void CALLBACK WaitForDDE(HWND, HINSTANCE, wchar_t *pszCmdLine, int)
{
HANDLE pHandles[2];
DWORD dwTick;
diff --git a/plugins/AssocMgr/src/main.cpp b/plugins/AssocMgr/src/main.cpp
index 516a933cec..4f0c116c36 100644
--- a/plugins/AssocMgr/src/main.cpp
+++ b/plugins/AssocMgr/src/main.cpp
@@ -45,13 +45,13 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
return TRUE;
}
-static void InstallFile(const TCHAR *pszFileName,const TCHAR *pszDestSubDir)
+static void InstallFile(const wchar_t *pszFileName,const wchar_t *pszDestSubDir)
{
- TCHAR szFileFrom[MAX_PATH+1],szFileTo[MAX_PATH+1];
+ wchar_t szFileFrom[MAX_PATH+1],szFileTo[MAX_PATH+1];
if (!GetModuleFileName(hInst, szFileFrom, _countof(szFileFrom) - (int)mir_tstrlen(pszFileName)))
return;
- TCHAR *p = _tcsrchr(szFileFrom,_T('\\'));
+ wchar_t *p = wcsrchr(szFileFrom,'\\');
if (p != NULL)
*(++p) = 0;
mir_tstrcat(szFileFrom,pszFileName); /* buffer safe */
@@ -63,7 +63,7 @@ static void InstallFile(const TCHAR *pszFileName,const TCHAR *pszDestSubDir)
if (!GetModuleFileName(NULL, szFileTo, _countof(szFileTo)-(int)mir_tstrlen(pszDestSubDir)-(int)mir_tstrlen(pszFileName)))
return;
- p = _tcsrchr(szFileTo,_T('\\'));
+ p = wcsrchr(szFileTo,'\\');
if (p)
*(++p)=0;
mir_tstrcat(szFileTo,pszDestSubDir); /* buffer safe */
diff --git a/plugins/AssocMgr/src/reg.cpp b/plugins/AssocMgr/src/reg.cpp
index 6822fdbddc..3f079b7810 100644
--- a/plugins/AssocMgr/src/reg.cpp
+++ b/plugins/AssocMgr/src/reg.cpp
@@ -29,7 +29,7 @@ extern HINSTANCE hInst;
static __inline LONG regchk(LONG res, const char *pszFunc, const void *pszInfo, BOOL fInfoUnicode, const char *pszFile, unsigned int nLine)
{
if (res != ERROR_SUCCESS && res != ERROR_FILE_NOT_FOUND && res != ERROR_NO_MORE_ITEMS) {
- TCHAR szMsg[1024], *pszInfo2;
+ wchar_t szMsg[1024], *pszInfo2;
char *pszErr;
pszErr = GetWinErrorDescription(res);
pszInfo2 = s2t(pszInfo, fInfoUnicode, FALSE); /* does NULL check */
@@ -123,13 +123,13 @@ static BOOL IsFileClassName(char *pszClassName, char **ppszFileExt)
}
// mir_free() the return value
-TCHAR *MakeRunCommand(BOOL fMirExe,BOOL fFixedDbProfile)
+wchar_t *MakeRunCommand(BOOL fMirExe,BOOL fFixedDbProfile)
{
- TCHAR szDbFile[MAX_PATH], szExe[MAX_PATH], *pszFmt;
+ wchar_t szDbFile[MAX_PATH], szExe[MAX_PATH], *pszFmt;
if (fFixedDbProfile) {
if ( CallService(MS_DB_GETPROFILENAMET, _countof(szDbFile), (LPARAM)szDbFile))
return NULL;
- TCHAR *p = _tcsrchr(szDbFile, '.');
+ wchar_t *p = wcsrchr(szDbFile, '.');
if (p)
*p = 0;
}
@@ -148,31 +148,31 @@ TCHAR *MakeRunCommand(BOOL fMirExe,BOOL fFixedDbProfile)
GetShortPathName(szExe, szExe, _countof(szExe));
/* surround by quotes if failed */
size_t len = mir_tstrlen(szExe);
- if ( _tcschr(szExe,_T(' ')) != NULL && (len+2) < _countof(szExe)) {
- memmove(szExe, szExe+1, (len+1)*sizeof(TCHAR));
- szExe[len+2] = szExe[0] = _T('\"');
+ if ( wcschr(szExe,' ') != NULL && (len+2) < _countof(szExe)) {
+ memmove(szExe, szExe+1, (len+1)*sizeof(wchar_t));
+ szExe[len+2] = szExe[0] = '\"';
szExe[len+3] = 0;
}
}
- TCHAR tszBuffer[1024];
+ wchar_t tszBuffer[1024];
mir_sntprintf(tszBuffer, pszFmt, szExe, szDbFile);
return mir_tstrdup(tszBuffer);
}
-static BOOL IsValidRunCommand(const TCHAR *pszRunCmd)
+static BOOL IsValidRunCommand(const wchar_t *pszRunCmd)
{
- TCHAR *buf,*pexe,*pargs;
- TCHAR szFullExe[MAX_PATH],*pszFilePart;
- buf=mir_tstrcpy((TCHAR*)_alloca((mir_tstrlen(pszRunCmd)+1)*sizeof(TCHAR)),pszRunCmd);
+ wchar_t *buf,*pexe,*pargs;
+ wchar_t szFullExe[MAX_PATH],*pszFilePart;
+ buf=mir_tstrcpy((wchar_t*)_alloca((mir_tstrlen(pszRunCmd)+1)*sizeof(wchar_t)),pszRunCmd);
/* split into executable path and arguments */
- if (buf[0]==_T('\"')) {
- pargs=_tcschr(&buf[1],_T('\"'));
+ if (buf[0]=='\"') {
+ pargs=wcschr(&buf[1],'\"');
if (pargs!=NULL) *(pargs++)=0;
pexe=&buf[1];
- if (*pargs==_T(' ')) ++pargs;
+ if (*pargs==' ') ++pargs;
} else {
- pargs=_tcschr(buf,_T(' '));
+ pargs=wcschr(buf,' ');
if (pargs!=NULL) *pargs=0;
pexe=buf;
}
@@ -180,12 +180,12 @@ static BOOL IsValidRunCommand(const TCHAR *pszRunCmd)
if (pszFilePart!=NULL)
if (!mir_tstrcmpi(pszFilePart,L"rundll32.exe") || !mir_tstrcmpi(pszFilePart,L"rundll.exe")) {
/* split into dll path and arguments */
- if (pargs[0]==_T('\"')) {
+ if (pargs[0]=='\"') {
++pargs;
- pexe=_tcschr(&pargs[1],_T('\"'));
+ pexe=wcschr(&pargs[1],'\"');
if (pexe!=NULL) *pexe=0;
} else {
- pexe=_tcschr(pargs,_T(','));
+ pexe=wcschr(pargs,',');
if (pexe!=NULL) *pexe=0;
}
return SearchPath(NULL,pargs,L".dll",0,NULL,NULL)!=0;
@@ -196,12 +196,12 @@ static BOOL IsValidRunCommand(const TCHAR *pszRunCmd)
}
// mir_free() the return value
-TCHAR *MakeIconLocation(HMODULE hModule,WORD nIconResID)
+wchar_t *MakeIconLocation(HMODULE hModule,WORD nIconResID)
{
- TCHAR szModule[MAX_PATH],*pszIconLoc=NULL;
+ wchar_t szModule[MAX_PATH],*pszIconLoc=NULL;
int cch;
if ((cch=GetModuleFileName(hModule,szModule,_countof(szModule))) != 0) {
- pszIconLoc=(TCHAR*)mir_alloc((cch+=8)*sizeof(TCHAR));
+ pszIconLoc=(wchar_t*)mir_alloc((cch+=8)*sizeof(wchar_t));
if (pszIconLoc!=NULL)
mir_sntprintf(pszIconLoc, cch, L"%s,%i", szModule, -(int)nIconResID); /* id may be 0, buffer safe */
}
@@ -209,11 +209,11 @@ TCHAR *MakeIconLocation(HMODULE hModule,WORD nIconResID)
}
// mir_free() the return value
-TCHAR *MakeAppFileName(BOOL fMirExe)
+wchar_t *MakeAppFileName(BOOL fMirExe)
{
- TCHAR szExe[MAX_PATH],*psz;
+ wchar_t szExe[MAX_PATH],*psz;
if (GetModuleFileName(fMirExe?NULL:hInst,szExe,_countof(szExe))) {
- psz=_tcsrchr(szExe,_T('\\'));
+ psz=wcsrchr(szExe,'\\');
if (psz!=NULL) ++psz;
else psz=szExe;
return mir_tstrdup(psz);
@@ -223,15 +223,15 @@ TCHAR *MakeAppFileName(BOOL fMirExe)
/************************* Helpers ********************************/
-static LONG DeleteRegSubTree(HKEY hKey,const TCHAR *pszSubKey)
+static LONG DeleteRegSubTree(HKEY hKey,const wchar_t *pszSubKey)
{
LONG res;
DWORD nMaxSubKeyLen,cchSubKey;
- TCHAR *pszSubKeyBuf;
+ wchar_t *pszSubKeyBuf;
HKEY hSubKey;
if ((res=RegOpenKeyEx(hKey,pszSubKey,0,KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS|DELETE,&hSubKey))==ERROR_SUCCESS) {
if ((res=RegQueryInfoKey(hSubKey,NULL,NULL,NULL,NULL,&nMaxSubKeyLen,NULL,NULL,NULL,NULL,NULL,NULL))==ERROR_SUCCESS) {
- pszSubKeyBuf=(TCHAR*)mir_alloc((nMaxSubKeyLen+1)*sizeof(TCHAR));
+ pszSubKeyBuf=(wchar_t*)mir_alloc((nMaxSubKeyLen+1)*sizeof(wchar_t));
if (pszSubKeyBuf==NULL) res=ERROR_NOT_ENOUGH_MEMORY;
while(!res) {
cchSubKey=nMaxSubKeyLen+1;
@@ -248,42 +248,42 @@ static LONG DeleteRegSubTree(HKEY hKey,const TCHAR *pszSubKey)
}
// hMainKey must have been opened with KEY_CREATE_SUB_KEY access right
-static LONG SetRegSubKeyStrDefValue(HKEY hMainKey,const TCHAR *pszSubKey,const TCHAR *pszVal)
+static LONG SetRegSubKeyStrDefValue(HKEY hMainKey,const wchar_t *pszSubKey,const wchar_t *pszVal)
{
HKEY hSubKey;
LONG res=RegCreateKeyEx(hMainKey,pszSubKey,0,NULL,0,KEY_SET_VALUE|KEY_QUERY_VALUE,NULL,&hSubKey,NULL);
if (!res) {
- res=RegSetValueEx(hSubKey,NULL,0,REG_SZ,(BYTE*)pszVal,(int)(mir_tstrlen(pszVal)+1)*sizeof(TCHAR));
+ res=RegSetValueEx(hSubKey,NULL,0,REG_SZ,(BYTE*)pszVal,(int)(mir_tstrlen(pszVal)+1)*sizeof(wchar_t));
RegCloseKey(hSubKey);
}
return res;
}
// hKey must have been opened with KEY_SET_VALUE access right
-static void SetRegStrPrefixValue(HKEY hKey,const TCHAR *pszValPrefix,const TCHAR *pszVal)
+static void SetRegStrPrefixValue(HKEY hKey,const wchar_t *pszValPrefix,const wchar_t *pszVal)
{
- size_t dwSize = (mir_tstrlen(pszVal)+mir_tstrlen(pszValPrefix)+1)*sizeof(TCHAR);
- TCHAR *pszStr = (TCHAR*)_alloca(dwSize);
+ size_t dwSize = (mir_tstrlen(pszVal)+mir_tstrlen(pszValPrefix)+1)*sizeof(wchar_t);
+ wchar_t *pszStr = (wchar_t*)_alloca(dwSize);
mir_tstrcat(mir_tstrcpy(pszStr, pszValPrefix), pszVal); /* buffer safe */
RegSetValueEx(hKey, NULL, 0, REG_SZ, (BYTE*)pszStr, (int)dwSize);
}
// hKey must have been opened with KEY_QUERY_VALUE access right
// mir_free() the return value
-static TCHAR *GetRegStrValue(HKEY hKey,const TCHAR *pszValName)
+static wchar_t *GetRegStrValue(HKEY hKey,const wchar_t *pszValName)
{
- TCHAR *pszVal,*pszVal2;
+ wchar_t *pszVal,*pszVal2;
DWORD dwSize,dwType;
/* get size */
- if (!RegQueryValueEx(hKey,pszValName,NULL,NULL,NULL,&dwSize) && dwSize>sizeof(TCHAR)) {
- pszVal=(TCHAR*)mir_alloc(dwSize+sizeof(TCHAR));
+ if (!RegQueryValueEx(hKey,pszValName,NULL,NULL,NULL,&dwSize) && dwSize>sizeof(wchar_t)) {
+ pszVal=(wchar_t*)mir_alloc(dwSize+sizeof(wchar_t));
if (pszVal!=NULL) {
/* get value */
if (!RegQueryValueEx(hKey,pszValName,NULL,&dwType,(BYTE*)pszVal,&dwSize)) {
- pszVal[dwSize/sizeof(TCHAR)]=0;
+ pszVal[dwSize/sizeof(wchar_t)]=0;
if (dwType==REG_EXPAND_SZ) {
dwSize=MAX_PATH;
- pszVal2=(TCHAR*)mir_alloc(dwSize*sizeof(TCHAR));
+ pszVal2=(wchar_t*)mir_alloc(dwSize*sizeof(wchar_t));
if (ExpandEnvironmentStrings(pszVal,pszVal2,dwSize)) {
mir_free(pszVal);
return pszVal2;
@@ -299,10 +299,10 @@ static TCHAR *GetRegStrValue(HKEY hKey,const TCHAR *pszValName)
}
// hKey must have been opened with KEY_QUERY_VALUE access right
-static BOOL IsRegStrValue(HKEY hKey,const TCHAR *pszValName,const TCHAR *pszCmpVal)
+static BOOL IsRegStrValue(HKEY hKey,const wchar_t *pszValName,const wchar_t *pszCmpVal)
{
BOOL fSame=FALSE;
- TCHAR *pszVal=GetRegStrValue(hKey,pszValName);
+ wchar_t *pszVal=GetRegStrValue(hKey,pszValName);
if (pszVal!=NULL) {
fSame=!mir_tstrcmp(pszVal,pszCmpVal);
mir_free(pszVal);
@@ -311,11 +311,11 @@ static BOOL IsRegStrValue(HKEY hKey,const TCHAR *pszValName,const TCHAR *pszCmpV
}
// hKey must have been opened with KEY_QUERY_VALUE access right
-static BOOL IsRegStrValueA(HKEY hKey,const TCHAR *pszValName,const char *pszCmpVal)
+static BOOL IsRegStrValueA(HKEY hKey,const wchar_t *pszValName,const char *pszCmpVal)
{
BOOL fSame=FALSE;
char *pszValA;
- TCHAR *pszVal=GetRegStrValue(hKey,pszValName);
+ wchar_t *pszVal=GetRegStrValue(hKey,pszValName);
if (pszVal!=NULL) {
pszValA=t2a(pszVal);
if (pszValA!=NULL)
@@ -373,7 +373,7 @@ static void BackupRegTree_Worker(HKEY hKey,const char *pszSubKey,struct BackupRe
DWORD index,cchName,dwType,cbData;
BYTE *pData;
char *pszName;
- register TCHAR *ptszName;
+ register wchar_t *ptszName;
DWORD nDbPrefixLen;
if ((res=RegOpenKeyExA(hKey,pszSubKey,0,KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS,&hKey))==ERROR_SUCCESS) {
if ((res=RegQueryInfoKey(hKey,NULL,NULL,NULL,NULL,&nMaxSubKeyLen,NULL,NULL,&nMaxValNameLen,&nMaxValSize,NULL,NULL))==ERROR_SUCCESS) {
@@ -472,7 +472,7 @@ static LONG RestoreRegTree(HKEY hKey,const char *pszSubKey,const char *pszDbPref
/* key hierachy */
pkeys=mir_strcpy((char*)_alloca(mir_strlen(pszSuffix)+1),pszSuffix);
pnext=pkeys;
- while((pnext=strchr(pnext+1,_T('\\')))!=NULL) pslash=pnext;
+ while((pnext=strchr(pnext+1,'\\'))!=NULL) pslash=pnext;
if (pslash!=NULL) {
/* create subkey */
*(pslash++)=0;
@@ -581,7 +581,7 @@ void CleanupRegTreeBackupSettings(void)
// pszIconLoc, pszVerbDesc and pszDdeCmd are allowed to be NULL
// call GetLastError() on error to get more error details
-BOOL AddRegClass(const char *pszClassName,const TCHAR *pszTypeDescription,const TCHAR *pszIconLoc,const TCHAR *pszAppName,const TCHAR *pszRunCmd,const TCHAR *pszDdeCmd,const TCHAR *pszDdeApp,const TCHAR *pszDdeTopic,const TCHAR *pszVerbDesc,BOOL fBrowserAutoOpen,BOOL fUrlProto,BOOL fIsShortcut)
+BOOL AddRegClass(const char *pszClassName,const wchar_t *pszTypeDescription,const wchar_t *pszIconLoc,const wchar_t *pszAppName,const wchar_t *pszRunCmd,const wchar_t *pszDdeCmd,const wchar_t *pszDdeApp,const wchar_t *pszDdeTopic,const wchar_t *pszVerbDesc,BOOL fBrowserAutoOpen,BOOL fUrlProto,BOOL fIsShortcut)
{
LONG res;
HKEY hRootKey,hClassKey,hShellKey,hVerbKey,hDdeKey;
@@ -601,7 +601,7 @@ BOOL AddRegClass(const char *pszClassName,const TCHAR *pszTypeDescription,const
if (fUrlProto) BackupRegTree(hRootKey,pszClassName,"bak_");
/* type description */
if (fUrlProto) SetRegStrPrefixValue(hClassKey,L"URL:",pszTypeDescription);
- else RegSetValueEx(hClassKey,NULL,0,REG_SZ,(BYTE*)pszTypeDescription,(int)(mir_tstrlen(pszTypeDescription)+1)*sizeof(TCHAR));
+ else RegSetValueEx(hClassKey,NULL,0,REG_SZ,(BYTE*)pszTypeDescription,(int)(mir_tstrlen(pszTypeDescription)+1)*sizeof(wchar_t));
/* default icon */
if (pszIconLoc!=NULL) SetRegSubKeyStrDefValue(hClassKey,L"DefaultIcon",pszIconLoc);
/* url protocol */
@@ -624,21 +624,21 @@ BOOL AddRegClass(const char *pszClassName,const TCHAR *pszTypeDescription,const
/* shell */
if ((res=RegCreateKeyEx(hClassKey,L"shell",0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY,NULL,&hShellKey,NULL))==ERROR_SUCCESS) {
/* default verb (when empty "open" is used) */
- RegSetValueEx(hShellKey,NULL,0,REG_SZ,(BYTE*)L"open",5*sizeof(TCHAR));
+ RegSetValueEx(hShellKey,NULL,0,REG_SZ,(BYTE*)L"open",5*sizeof(wchar_t));
/* verb */
if ((res=RegCreateKeyEx(hShellKey,L"open",0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY|DELETE,NULL,&hVerbKey,NULL))==ERROR_SUCCESS) {
/* verb description */
if (pszVerbDesc==NULL) RegDeleteValue(hVerbKey,NULL);
- else RegSetValueEx(hVerbKey,NULL,0,REG_SZ,(BYTE*)pszVerbDesc,(int)(mir_tstrlen(pszVerbDesc)+1)*sizeof(TCHAR));
+ else RegSetValueEx(hVerbKey,NULL,0,REG_SZ,(BYTE*)pszVerbDesc,(int)(mir_tstrlen(pszVerbDesc)+1)*sizeof(wchar_t));
/* friendly appname (mui string) */
- RegSetValueEx(hVerbKey,L"FriendlyAppName",0,REG_SZ,(BYTE*)pszAppName,(int)(mir_tstrlen(pszAppName)+1)*sizeof(TCHAR));
+ RegSetValueEx(hVerbKey,L"FriendlyAppName",0,REG_SZ,(BYTE*)pszAppName,(int)(mir_tstrlen(pszAppName)+1)*sizeof(wchar_t));
/* command */
SetRegSubKeyStrDefValue(hVerbKey,L"command",pszRunCmd);
/* ddeexec */
if (pszDdeCmd!=NULL) {
if (!RegCreateKeyEx(hVerbKey,L"ddeexec",0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY|DELETE,NULL,&hDdeKey,NULL)) {
/* command */
- RegSetValueEx(hDdeKey,NULL,0,REG_SZ,(BYTE*)pszDdeCmd,(int)(mir_tstrlen(pszDdeCmd)+1)*sizeof(TCHAR));
+ RegSetValueEx(hDdeKey,NULL,0,REG_SZ,(BYTE*)pszDdeCmd,(int)(mir_tstrlen(pszDdeCmd)+1)*sizeof(wchar_t));
/* application */
SetRegSubKeyStrDefValue(hDdeKey,L"application",pszDdeApp);
/* topic */
@@ -679,7 +679,7 @@ BOOL RemoveRegClass(const char *pszClassName)
{
LONG res;
HKEY hRootKey,hClassKey,hShellKey,hVerbKey;
- TCHAR *ptszClassName,*ptszPrevRunCmd;
+ wchar_t *ptszClassName,*ptszPrevRunCmd;
/* try to open interactive user's classes key */
if (RegOpenKeyEx(HKEY_CURRENT_USER,L"Software\\Classes",0,DELETE,&hRootKey))
@@ -729,7 +729,7 @@ BOOL RemoveRegClass(const char *pszClassName)
* registered and thus be overwritten by multiple applications.
*/
-BOOL IsRegClass(const char *pszClassName,const TCHAR *pszRunCmd)
+BOOL IsRegClass(const char *pszClassName,const wchar_t *pszRunCmd)
{
BOOL fSuccess=FALSE;
HKEY hClassKey,hShellKey,hVerbKey,hCmdKey;
@@ -766,7 +766,7 @@ HICON LoadRegClassSmallIcon(const char *pszClassName)
{
HICON hIcon=NULL;
HKEY hClassKey,hIconKey;
- TCHAR *pszIconLoc,*p;
+ wchar_t *pszIconLoc,*p;
/* using the merged view classes key for reading */
/* class */
@@ -776,10 +776,10 @@ HICON LoadRegClassSmallIcon(const char *pszClassName)
/* extract icon */
pszIconLoc=GetRegStrValue(hIconKey,NULL);
if (pszIconLoc!=NULL) {
- p=_tcsrchr(pszIconLoc,_T(','));
+ p=wcsrchr(pszIconLoc,',');
if (p!=NULL) {
*(p++)=0;
- ExtractIconEx(pszIconLoc,_ttoi(p),NULL,&hIcon,1);
+ ExtractIconEx(pszIconLoc,_wtoi(p),NULL,&hIcon,1);
}
mir_free(pszIconLoc);
}
@@ -822,7 +822,7 @@ BOOL AddRegFileExt(const char *pszFileExt,const char *pszClassName,const char *p
/* remove any no-open flag */
RegDeleteValue(hExtKey,L"NoOpen");
/* open with progids */
- TCHAR *pszPrevClass=GetRegStrValue(hExtKey,NULL);
+ wchar_t *pszPrevClass=GetRegStrValue(hExtKey,NULL);
if (pszPrevClass!=NULL && !IsRegStrValueA(hExtKey,NULL,pszClassName))
if (!RegCreateKeyEx(hExtKey,L"OpenWithProgids",0,NULL,0,KEY_SET_VALUE,NULL,&hOpenWithKey,NULL)) {
/* previous class (backup) */
@@ -835,7 +835,7 @@ BOOL AddRegFileExt(const char *pszFileExt,const char *pszClassName,const char *p
/* mime type e.g. "application/x-icq" */
if (pszMimeType!=NULL) RegSetValueExA(hExtKey, "Content Type", 0, REG_SZ, (BYTE*)pszMimeType, (int)mir_strlen(pszMimeType)+1);
/* perceived type e.g. text (WinXP+) */
- if (fIsText) RegSetValueEx(hExtKey,L"PerceivedType",0,REG_SZ,(BYTE*)L"text",5*sizeof(TCHAR));
+ if (fIsText) RegSetValueEx(hExtKey,L"PerceivedType",0,REG_SZ,(BYTE*)L"text",5*sizeof(wchar_t));
RegCloseKey(hExtKey);
}
@@ -848,7 +848,7 @@ void RemoveRegFileExt(const char *pszFileExt,const char *pszClassName)
{
HKEY hRootKey,hExtKey,hSubKey;
DWORD nOpenWithCount;
- TCHAR *pszPrevClassName=NULL;
+ wchar_t *pszPrevClassName=NULL;
BOOL fRestored=FALSE;
/* try to open interactive user's classes key */
@@ -980,7 +980,7 @@ void RemoveRegMimeType(const char *pszMimeType,const char *pszFileExt)
*/
// pszDdeCmd is allowed to be NULL
-void AddRegOpenWith(const TCHAR *pszAppFileName,BOOL fAllowOpenWith,const TCHAR *pszAppName,const TCHAR *pszIconLoc,const TCHAR *pszRunCmd,const TCHAR *pszDdeCmd,const TCHAR *pszDdeApp,const TCHAR *pszDdeTopic)
+void AddRegOpenWith(const wchar_t *pszAppFileName,BOOL fAllowOpenWith,const wchar_t *pszAppName,const wchar_t *pszIconLoc,const wchar_t *pszRunCmd,const wchar_t *pszDdeCmd,const wchar_t *pszDdeApp,const wchar_t *pszDdeTopic)
{
HKEY hRootKey,hAppsKey,hExeKey,hShellKey,hVerbKey,hDdeKey;
@@ -993,7 +993,7 @@ void AddRegOpenWith(const TCHAR *pszAppFileName,BOOL fAllowOpenWith,const TCHAR
/* filename */
if (!RegCreateKeyEx(hAppsKey,pszAppFileName,0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY,NULL,&hExeKey,NULL)) {
/* appname */
- RegSetValueEx(hExeKey,NULL,0,REG_SZ,(BYTE*)pszAppName,(int)(mir_tstrlen(pszAppName)+1)*sizeof(TCHAR));
+ RegSetValueEx(hExeKey,NULL,0,REG_SZ,(BYTE*)pszAppName,(int)(mir_tstrlen(pszAppName)+1)*sizeof(wchar_t));
/* no open-with flag */
if (fAllowOpenWith) RegDeleteValue(hExeKey,L"NoOpenWith");
else RegSetValueEx(hExeKey,L"NoOpenWith",0,REG_SZ,NULL,0);
@@ -1002,18 +1002,18 @@ void AddRegOpenWith(const TCHAR *pszAppFileName,BOOL fAllowOpenWith,const TCHAR
/* shell */
if (!RegCreateKeyEx(hExeKey,L"shell",0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY,NULL,&hShellKey,NULL)) {
/* default verb (when empty "open" is used) */
- RegSetValueEx(hShellKey,NULL,0,REG_SZ,(BYTE*)L"open",5*sizeof(TCHAR));
+ RegSetValueEx(hShellKey,NULL,0,REG_SZ,(BYTE*)L"open",5*sizeof(wchar_t));
/* verb */
if (!RegCreateKeyEx(hShellKey,L"open",0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY,NULL,&hVerbKey,NULL)) {
/* friendly appname (mui string) */
- RegSetValueEx(hVerbKey,L"FriendlyAppName",0,REG_SZ,(BYTE*)pszAppName,(int)(mir_tstrlen(pszAppName)+1)*sizeof(TCHAR));
+ RegSetValueEx(hVerbKey,L"FriendlyAppName",0,REG_SZ,(BYTE*)pszAppName,(int)(mir_tstrlen(pszAppName)+1)*sizeof(wchar_t));
/* command */
SetRegSubKeyStrDefValue(hVerbKey,L"command",pszRunCmd);
/* ddeexec */
if (pszDdeCmd!=NULL)
if (!RegCreateKeyEx(hVerbKey,L"ddeexec",0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY,NULL,&hDdeKey,NULL)) {
/* command */
- RegSetValueEx(hDdeKey,NULL,0,REG_SZ,(BYTE*)pszDdeCmd,(int)(mir_tstrlen(pszDdeCmd)+1)*sizeof(TCHAR));
+ RegSetValueEx(hDdeKey,NULL,0,REG_SZ,(BYTE*)pszDdeCmd,(int)(mir_tstrlen(pszDdeCmd)+1)*sizeof(wchar_t));
/* application */
SetRegSubKeyStrDefValue(hDdeKey,L"application",pszDdeApp);
/* topic */
@@ -1033,7 +1033,7 @@ void AddRegOpenWith(const TCHAR *pszAppFileName,BOOL fAllowOpenWith,const TCHAR
RegCloseKey(hRootKey);
}
-void RemoveRegOpenWith(const TCHAR *pszAppFileName)
+void RemoveRegOpenWith(const wchar_t *pszAppFileName)
{
HKEY hRootKey,hAppsKey,hExeKey,hShellKey,hVerbKey,hDdeKey;
@@ -1084,7 +1084,7 @@ void RemoveRegOpenWith(const TCHAR *pszAppFileName)
* Tell the "Open With..." dialog we support a given file extension.
*/
-void AddRegOpenWithExtEntry(const TCHAR *pszAppFileName,const char *pszFileExt,const TCHAR *pszFileDesc)
+void AddRegOpenWithExtEntry(const wchar_t *pszAppFileName,const char *pszFileExt,const wchar_t *pszFileDesc)
{
HKEY hRootKey,hAppsKey,hExeKey,hTypesKey;
@@ -1098,10 +1098,10 @@ void AddRegOpenWithExtEntry(const TCHAR *pszAppFileName,const char *pszFileExt,c
if (!RegOpenKeyEx(hAppsKey,pszAppFileName,0,KEY_CREATE_SUB_KEY,&hExeKey)) {
/* supported types */
if (!RegCreateKeyEx(hExeKey,L"SupportedTypes",0,NULL,0,KEY_SET_VALUE,NULL,&hTypesKey,NULL)) {
- TCHAR *ptszFileExt;
+ wchar_t *ptszFileExt;
ptszFileExt=a2t(pszFileExt);
if (ptszFileExt!=NULL)
- RegSetValueEx(hTypesKey,ptszFileExt,0,REG_SZ,(BYTE*)pszFileDesc,(int)(mir_tstrlen(pszFileDesc)+1)*sizeof(TCHAR));
+ RegSetValueEx(hTypesKey,ptszFileExt,0,REG_SZ,(BYTE*)pszFileDesc,(int)(mir_tstrlen(pszFileDesc)+1)*sizeof(wchar_t));
mir_free(ptszFileExt); /* does NULL check */
RegCloseKey(hTypesKey);
}
@@ -1114,7 +1114,7 @@ void AddRegOpenWithExtEntry(const TCHAR *pszAppFileName,const char *pszFileExt,c
RegCloseKey(hRootKey);
}
-void RemoveRegOpenWithExtEntry(const TCHAR *pszAppFileName,const char *pszFileExt)
+void RemoveRegOpenWithExtEntry(const wchar_t *pszAppFileName,const char *pszFileExt)
{
HKEY hRootKey,hAppsKey,hExeKey,hTypesKey;
@@ -1146,7 +1146,7 @@ void RemoveRegOpenWithExtEntry(const TCHAR *pszAppFileName,const char *pszFileEx
* Add Miranda to the autostart list in the registry.
*/
-BOOL AddRegRunEntry(const TCHAR *pszAppName,const TCHAR *pszRunCmd)
+BOOL AddRegRunEntry(const wchar_t *pszAppName,const wchar_t *pszRunCmd)
{
BOOL fSuccess=FALSE;
HKEY hRunKey;
@@ -1154,13 +1154,13 @@ BOOL AddRegRunEntry(const TCHAR *pszAppName,const TCHAR *pszRunCmd)
/* run */
if (!RegCreateKeyEx(HKEY_CURRENT_USER,L"Software\\Microsoft\\Windows\\CurrentVersion\\Run",0,NULL,0,KEY_SET_VALUE,NULL,&hRunKey,NULL)) {
/* appname */
- fSuccess=!RegSetValueEx(hRunKey,pszAppName,0,REG_SZ,(BYTE*)pszRunCmd,(int)(mir_tstrlen(pszRunCmd)+1)*sizeof(TCHAR));
+ fSuccess=!RegSetValueEx(hRunKey,pszAppName,0,REG_SZ,(BYTE*)pszRunCmd,(int)(mir_tstrlen(pszRunCmd)+1)*sizeof(wchar_t));
RegCloseKey(hRunKey);
}
return fSuccess;
}
-BOOL RemoveRegRunEntry(const TCHAR *pszAppName,const TCHAR *pszRunCmd)
+BOOL RemoveRegRunEntry(const wchar_t *pszAppName,const wchar_t *pszRunCmd)
{
HKEY hRunKey;
@@ -1179,7 +1179,7 @@ BOOL RemoveRegRunEntry(const TCHAR *pszAppName,const TCHAR *pszRunCmd)
* Check if the autostart item belongs to the current instance of Miranda.
*/
-BOOL IsRegRunEntry(const TCHAR *pszAppName,const TCHAR *pszRunCmd)
+BOOL IsRegRunEntry(const wchar_t *pszAppName,const wchar_t *pszRunCmd)
{
BOOL fState=FALSE;
HKEY hRunKey;
diff --git a/plugins/AssocMgr/src/reg.h b/plugins/AssocMgr/src/reg.h
index f593221b8e..69e3810ecd 100644
--- a/plugins/AssocMgr/src/reg.h
+++ b/plugins/AssocMgr/src/reg.h
@@ -22,9 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/* Backup to DB */
void CleanupRegTreeBackupSettings(void);
/* Class */
-BOOL AddRegClass(const char *pszClassName,const TCHAR *pszTypeDescription,const TCHAR *pszIconLoc,const TCHAR *pszAppName,const TCHAR *pszRunCmd,const TCHAR *pszDdeCmd,const TCHAR *pszDdeApp,const TCHAR *pszDdeTopic,const TCHAR *pszVerbDesc,BOOL fBrowserAutoOpen,BOOL fUrlProto,BOOL fIsShortcut);
+BOOL AddRegClass(const char *pszClassName,const wchar_t *pszTypeDescription,const wchar_t *pszIconLoc,const wchar_t *pszAppName,const wchar_t *pszRunCmd,const wchar_t *pszDdeCmd,const wchar_t *pszDdeApp,const wchar_t *pszDdeTopic,const wchar_t *pszVerbDesc,BOOL fBrowserAutoOpen,BOOL fUrlProto,BOOL fIsShortcut);
BOOL RemoveRegClass(const char *pszClassName);
-BOOL IsRegClass(const char *pszClassName,const TCHAR *pszRunCmd);
+BOOL IsRegClass(const char *pszClassName,const wchar_t *pszRunCmd);
HICON LoadRegClassSmallIcon(const char *pszClassName);
/* Extension */
BOOL AddRegFileExt(const char *pszFileExt,const char *pszClassName,const char *pszMimeType,BOOL fIsText);
@@ -34,18 +34,18 @@ BOOL IsRegFileExt(const char *pszFileExt,const char *pszClassName);
BOOL AddRegMimeType(const char *pszMimeType,const char *pszFileExt);
void RemoveRegMimeType(const char *pszMimeType,const char *pszFileExt);
/* Open-With App */
-void AddRegOpenWith(const TCHAR *pszAppFileName,BOOL fAllowOpenWith,const TCHAR *pszAppName,const TCHAR *pszIconLoc,const TCHAR *pszRunCmd,const TCHAR *pszDdeCmd,const TCHAR *pszDdeApp,const TCHAR *pszDdeTopic);
-void RemoveRegOpenWith(const TCHAR *pszAppFileName);
-void AddRegOpenWithExtEntry(const TCHAR *pszAppFileName,const char *pszFileExt,const TCHAR *pszFileDesc);
-void RemoveRegOpenWithExtEntry(const TCHAR *pszAppFileName,const char *pszFileExt);
+void AddRegOpenWith(const wchar_t *pszAppFileName,BOOL fAllowOpenWith,const wchar_t *pszAppName,const wchar_t *pszIconLoc,const wchar_t *pszRunCmd,const wchar_t *pszDdeCmd,const wchar_t *pszDdeApp,const wchar_t *pszDdeTopic);
+void RemoveRegOpenWith(const wchar_t *pszAppFileName);
+void AddRegOpenWithExtEntry(const wchar_t *pszAppFileName,const char *pszFileExt,const wchar_t *pszFileDesc);
+void RemoveRegOpenWithExtEntry(const wchar_t *pszAppFileName,const char *pszFileExt);
/* Autostart */
-BOOL AddRegRunEntry(const TCHAR *pszAppName,const TCHAR *pszRunCmd);
-BOOL RemoveRegRunEntry(const TCHAR *pszAppName,const TCHAR *pszRunCmd);
-BOOL IsRegRunEntry(const TCHAR *pszAppName,const TCHAR *pszRunCmd);
+BOOL AddRegRunEntry(const wchar_t *pszAppName,const wchar_t *pszRunCmd);
+BOOL RemoveRegRunEntry(const wchar_t *pszAppName,const wchar_t *pszRunCmd);
+BOOL IsRegRunEntry(const wchar_t *pszAppName,const wchar_t *pszRunCmd);
/* Strings */
char *MakeFileClassName(const char *pszFileExt);
char *MakeUrlClassName(const char *pszUrl);
-TCHAR *MakeRunCommand(BOOL fMirExe,BOOL fFixedDbProfile);
-TCHAR *MakeIconLocation(HMODULE hModule,WORD nIconResID);
-TCHAR *MakeAppFileName(BOOL fMirExe); \ No newline at end of file
+wchar_t *MakeRunCommand(BOOL fMirExe,BOOL fFixedDbProfile);
+wchar_t *MakeIconLocation(HMODULE hModule,WORD nIconResID);
+wchar_t *MakeAppFileName(BOOL fMirExe);
diff --git a/plugins/AssocMgr/src/test.cpp b/plugins/AssocMgr/src/test.cpp
index 0980a3cd2d..f0d60e6276 100644
--- a/plugins/AssocMgr/src/test.cpp
+++ b/plugins/AssocMgr/src/test.cpp
@@ -36,7 +36,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern HINSTANCE hInst;
/* a copy of those in m_assocmgr.h, as we did not #include those helpers */
-__inline static int AssocMgr_AddNewFileTypeT(const char *ext, const char *mime, const TCHAR *desc, const TCHAR *verb, HINSTANCE hinst, UINT iconid, const char *service, DWORD flags)
+__inline static int AssocMgr_AddNewFileTypeT(const char *ext, const char *mime, const wchar_t *desc, const wchar_t *verb, HINSTANCE hinst, UINT iconid, const char *service, DWORD flags)
{
FILETYPEDESC ftd;
ftd.cbSize = sizeof(FILETYPEDESC);
@@ -117,7 +117,7 @@ static int ServiceParseAimLink(WPARAM, LPARAM lParam)
acs.psr = &psr;
memset(&psr, 0, sizeof(PROTOSEARCHRESULT));
psr.cbSize = sizeof(PROTOSEARCHRESULT);
- psr.nick.t = sn;
+ psr.nick.w = sn;
CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs);
}
return 0;
@@ -311,7 +311,7 @@ static void MessageIcqUser(ICQFILEINFO *info)
static int IcqOpenFile(WPARAM wParam, LPARAM lParam)
{
- TCHAR *pszFile = (TCHAR*)lParam; /* TCHAR is specified on AssocMgr_AddNewFileTypeT() */
+ wchar_t *pszFile = (wchar_t*)lParam; /* wchar_t is specified on AssocMgr_AddNewFileTypeT() */
FILE *fp;
ICQFILEINFO info;
char line[4096], *sep;
@@ -331,7 +331,7 @@ static int IcqOpenFile(WPARAM wParam, LPARAM lParam)
LastName=
*/
if (pszFile == NULL) return 1; /* sanity check */
- fp = _tfopen(pszFile, L"rt");
+ fp = _wfopen(pszFile, L"rt");
if (fp == NULL) return 1; /* open failed */
info.type = 0;
while (!feof(fp)) {
@@ -438,7 +438,7 @@ static int ServiceParseYmsgrLink(WPARAM wParam, LPARAM lParam)
acs.psr = &psr;
memset(&psr, 0, sizeof(PROTOSEARCHRESULT));
psr.cbSize = sizeof(PROTOSEARCHRESULT);
- psr.nick.t = id;
+ psr.nick.w = id;
CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs);
}
return 0;
@@ -553,8 +553,8 @@ static int ServiceParseMsnimLink(WPARAM wParam, LPARAM lParam)
acs.psr = &psr;
memset(&psr, 0, sizeof(PROTOSEARCHRESULT));
psr.cbSize = sizeof(PROTOSEARCHRESULT);
- psr.nick.t = email;
- psr.email.t = email;
+ psr.nick.w = email;
+ psr.email.w = email;
CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs);
}
return 0;
@@ -749,7 +749,7 @@ static int ServiceParseXmppURI(WPARAM wParam, LPARAM lParam)
acs.psr = &psr;
memset(&psr, 0, sizeof(PROTOSEARCHRESULT));
psr.cbSize = sizeof(PROTOSEARCHRESULT);
- psr.nick.t = jid;
+ psr.nick.w = jid;
CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs);
}
return 0;
diff --git a/plugins/AssocMgr/src/utils.cpp b/plugins/AssocMgr/src/utils.cpp
index 7f8ec8fbf2..494dd298c5 100644
--- a/plugins/AssocMgr/src/utils.cpp
+++ b/plugins/AssocMgr/src/utils.cpp
@@ -65,7 +65,7 @@ char* u2a(const WCHAR *pszUnicode,BOOL fMirCp)
}
// mir_free() the return value
-TCHAR* s2t(const void *pszStr,DWORD fUnicode,BOOL fMirCp)
+wchar_t* s2t(const void *pszStr,DWORD fUnicode,BOOL fMirCp)
{
if(fUnicode) return mir_wstrdup((WCHAR*)pszStr);
@@ -74,7 +74,7 @@ TCHAR* s2t(const void *pszStr,DWORD fUnicode,BOOL fMirCp)
}
// mir_free() the return value
-void* t2s(const TCHAR *pszStr,DWORD fUnicode,BOOL fMirCp)
+void* t2s(const wchar_t *pszStr,DWORD fUnicode,BOOL fMirCp)
{
if (!fUnicode) return (void*)u2a(pszStr,fMirCp);
diff --git a/plugins/AssocMgr/src/utils.h b/plugins/AssocMgr/src/utils.h
index e795450cc5..3db6bf09e6 100644
--- a/plugins/AssocMgr/src/utils.h
+++ b/plugins/AssocMgr/src/utils.h
@@ -22,8 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/* String Conv */
WCHAR* a2u(const char *pszAnsi,BOOL fMirCp);
char* u2a(const WCHAR *pszUnicode,BOOL fMirCp);
-TCHAR* s2t(const void *pszStr,DWORD fUnicode,BOOL fMirCp);
-void* t2s(const TCHAR *pszStr,DWORD fUnicode,BOOL fMirCp);
+wchar_t* s2t(const void *pszStr,DWORD fUnicode,BOOL fMirCp);
+void* t2s(const wchar_t *pszStr,DWORD fUnicode,BOOL fMirCp);
#define t2a(s) u2a(s,FALSE)
#define a2t(s) a2u(s,FALSE)