diff options
Diffstat (limited to 'plugins/AssocMgr')
-rw-r--r-- | plugins/AssocMgr/src/assoclist.cpp | 101 | ||||
-rw-r--r-- | plugins/AssocMgr/src/dde.cpp | 41 | ||||
-rw-r--r-- | plugins/AssocMgr/src/main.cpp | 4 | ||||
-rw-r--r-- | plugins/AssocMgr/src/reg.cpp | 35 | ||||
-rw-r--r-- | plugins/AssocMgr/src/test.cpp | 3 |
5 files changed, 75 insertions, 109 deletions
diff --git a/plugins/AssocMgr/src/assoclist.cpp b/plugins/AssocMgr/src/assoclist.cpp index 38810f1675..a1dce06bdf 100644 --- a/plugins/AssocMgr/src/assoclist.cpp +++ b/plugins/AssocMgr/src/assoclist.cpp @@ -171,10 +171,8 @@ void CleanupMimeTypeAddedSettings(void) static UINT nNotifyTimerID; /* protected by csNotifyTimer */
static CRITICAL_SECTION csNotifyTimer;
-static void CALLBACK NotifyTimerProc(HWND hwnd, UINT msg, UINT_PTR nTimerID, DWORD dwTime)
+static void CALLBACK NotifyTimerProc(HWND hwnd, UINT, UINT_PTR nTimerID, DWORD)
{
- UNREFERENCED_PARAMETER(msg);
- UNREFERENCED_PARAMETER(dwTime);
EnterCriticalSection(&csNotifyTimer);
KillTimer(hwnd, nTimerID);
if(nNotifyTimerID == nTimerID) /* might be stopped previously */
@@ -272,8 +270,10 @@ static int ReplaceImageListAssocIcon(HIMAGELIST himl, const ASSOCDATA *assoc, in static TCHAR* GetAssocTypeDesc(const ASSOCDATA *assoc)
{
static TCHAR szDesc[32];
- if(assoc->pszFileExt == NULL) mir_sntprintf(szDesc, SIZEOF(szDesc), TranslateT("%hs:"), assoc->pszClassName);
- else mir_sntprintf(szDesc, SIZEOF(szDesc), TranslateT("%hs files"), assoc->pszFileExt);
+ if(assoc->pszFileExt == NULL)
+ mir_sntprintf(szDesc, SIZEOF(szDesc), _T("%hs:"), assoc->pszClassName);
+ else
+ mir_sntprintf(szDesc, SIZEOF(szDesc), TranslateT("%hs files"), assoc->pszFileExt);
return szDesc;
}
@@ -281,13 +281,12 @@ static TCHAR* GetAssocTypeDesc(const ASSOCDATA *assoc) static BOOL IsAssocRegistered(const ASSOCDATA *assoc)
{
BOOL fSuccess = FALSE, fIsUrl, fUseMainCmdLine;
- TCHAR *pszRunCmd;
fIsUrl = (assoc->pszFileExt == NULL);
fUseMainCmdLine = (assoc->pszService == NULL);
/* class */
- pszRunCmd = MakeRunCommand(fUseMainCmdLine, !fUseMainCmdLine);
+ TCHAR *pszRunCmd = MakeRunCommand(fUseMainCmdLine, !fUseMainCmdLine);
if(pszRunCmd!= NULL)
fSuccess = IsRegClass(assoc->pszClassName, pszRunCmd);
mir_free(pszRunCmd); /* does NULL check */
@@ -348,13 +347,13 @@ static BOOL EnsureAssocRegistered(const ASSOCDATA *assoc) static BOOL UnregisterAssoc(const ASSOCDATA *assoc)
{
BOOL fIsUrl, fUseMainCmdLine;
- TCHAR *pszAppFileName, *pszRunCmd;
+ TCHAR *pszAppFileName;
fIsUrl = (assoc->pszFileExt == NULL);
fUseMainCmdLine = (assoc->pszService == NULL);
/* class might have been registered by another instance */
- pszRunCmd = MakeRunCommand(fUseMainCmdLine, !fUseMainCmdLine);
+ TCHAR *pszRunCmd = MakeRunCommand(fUseMainCmdLine, !fUseMainCmdLine);
if(pszRunCmd!= NULL && !IsRegClass(assoc->pszClassName, pszRunCmd)) {
mir_free(pszRunCmd);
return TRUE; /* succeed anyway */
@@ -399,11 +398,10 @@ typedef struct { static BOOL AddNewAssocItem_Worker(char *pszClassName, const TYPEDESCHEAD *tdh, char *pszFileExt, TCHAR *pszVerbDesc, char *pszMimeType)
{
ASSOCDATA *pAssocListBuf, *assoc;
- int index;
/* is already in list? */
EnterCriticalSection(&csAssocList);
- index = FindAssocItem(pszClassName);
+ int index = FindAssocItem(pszClassName);
if(index!= -1) return FALSE;
/* resize storage array */
@@ -447,11 +445,10 @@ static BOOL AddNewAssocItem_Worker(char *pszClassName, const TYPEDESCHEAD *tdh, static BOOL RemoveAssocItem_Worker(const char *pszClassName)
{
ASSOCDATA *pAssocListBuf, *assoc;
- int index;
/* find index */
EnterCriticalSection(&csAssocList);
- index = FindAssocItem(pszClassName);
+ int index = FindAssocItem(pszClassName);
if(index == -1) {
LeaveCriticalSection(&csAssocList);
return FALSE;
@@ -509,13 +506,10 @@ static INT_PTR ServiceAddNewFileType(WPARAM, LPARAM lParam) return 3;
}
-static INT_PTR ServiceRemoveFileType(WPARAM wParam, LPARAM lParam)
+static INT_PTR ServiceRemoveFileType(WPARAM, LPARAM lParam)
{
- char *pszClassName;
- UNREFERENCED_PARAMETER(wParam);
-
if ((char*)lParam == NULL) return 2;
- pszClassName = MakeFileClassName((char*)lParam);
+ char *pszClassName = MakeFileClassName((char*)lParam);
if(pszClassName!= NULL)
if(RemoveAssocItem_Worker(pszClassName)) {
mir_free(pszClassName);
@@ -525,11 +519,9 @@ static INT_PTR ServiceRemoveFileType(WPARAM wParam, LPARAM lParam) return 3;
}
-static INT_PTR ServiceAddNewUrlType(WPARAM wParam, LPARAM lParam)
+static INT_PTR ServiceAddNewUrlType(WPARAM, LPARAM lParam)
{
const URLTYPEDESC *utd = (URLTYPEDESC*)lParam;
- char *pszClassName;
- UNREFERENCED_PARAMETER(wParam);
if(utd->cbSize < sizeof(URLTYPEDESC))
return 1;
@@ -538,7 +530,7 @@ static INT_PTR ServiceAddNewUrlType(WPARAM wParam, LPARAM lParam) if(utd->pszProtoPrefix == NULL || utd->pszProtoPrefix[lstrlenA(utd->pszProtoPrefix)-1]!= ':')
return 2;
- pszClassName = MakeUrlClassName(utd->pszProtoPrefix);
+ char *pszClassName = MakeUrlClassName(utd->pszProtoPrefix);
if(pszClassName!= NULL)
if(AddNewAssocItem_Worker(pszClassName, (TYPEDESCHEAD*)utd, NULL, NULL, NULL))
/* no need to free pszClassName, as its
@@ -548,13 +540,10 @@ static INT_PTR ServiceAddNewUrlType(WPARAM wParam, LPARAM lParam) return 3;
}
-static INT_PTR ServiceRemoveUrlType(WPARAM wParam, LPARAM lParam)
+static INT_PTR ServiceRemoveUrlType(WPARAM, LPARAM lParam)
{
- char *pszClassName;
- UNREFERENCED_PARAMETER(wParam);
-
if ((char*)lParam == NULL) return 2;
- pszClassName = MakeUrlClassName((char*)lParam);
+ char *pszClassName = MakeUrlClassName((char*)lParam);
if(pszClassName!= NULL)
if(RemoveAssocItem_Worker(pszClassName)) {
mir_free(pszClassName);
@@ -570,17 +559,15 @@ static BOOL InvokeHandler_Worker(const char *pszClassName, const TCHAR *pszParam {
void *pvParam;
char *pszService;
- int index;
- ASSOCDATA *assoc;
/* find it in list */
EnterCriticalSection(&csAssocList);
- index = FindAssocItem(pszClassName);
+ int index = FindAssocItem(pszClassName);
if(index == -1) {
LeaveCriticalSection(&csAssocList);
return FALSE;
}
- assoc = &pAssocList[index];
+ ASSOCDATA *assoc = &pAssocList[index];
/* no service specified? correct registry to use main commandline */
if(assoc->pszService == NULL) {
EnsureAssocRegistered(assoc);
@@ -606,11 +593,10 @@ static BOOL InvokeHandler_Worker(const char *pszClassName, const TCHAR *pszParam INT_PTR InvokeFileHandler(const TCHAR *pszFileName)
{
char *pszClassName, *pszFileExt;
- TCHAR *p;
INT_PTR res = CALLSERVICE_NOTFOUND;
/* find extension */
- p = (TCHAR*)_tcsrchr(pszFileName, _T('.'));
+ TCHAR *p = (TCHAR*)_tcsrchr(pszFileName, _T('.'));
if(p!= NULL) {
pszFileExt = t2a(p);
if(pszFileExt!= NULL) {
@@ -675,14 +661,14 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara {
switch(msg) {
case WM_INITDIALOG:
- { HWND hwndList;
+ {
HIMAGELIST himl;
LVITEM lvi;
ASSOCDATA *assoc;
int i;
TranslateDialogDefault(hwndDlg);
CoInitialize(NULL);
- hwndList = GetDlgItem(hwndDlg, IDC_ASSOCLIST);
+ HWND hwndList = GetDlgItem(hwndDlg, IDC_ASSOCLIST);
ListView_SetUnicodeFormat(hwndList, TRUE);
@@ -778,12 +764,11 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara }
case WM_SETTINGCHANGE:
case M_REFRESH_ICONS:
- { LVITEM lvi;
- HIMAGELIST himl;
+ {
+ LVITEM lvi;
ASSOCDATA *assoc;
- HWND hwndList;
- hwndList = GetDlgItem(hwndDlg, IDC_ASSOCLIST);
- himl = ListView_GetImageList(hwndList, LVSIL_SMALL);
+ HWND hwndList = GetDlgItem(hwndDlg, IDC_ASSOCLIST);
+ HIMAGELIST himl = ListView_GetImageList(hwndList, LVSIL_SMALL);
/* enum items */
lvi.iSubItem = 0;
lvi.mask = LVIF_PARAM|LVIF_IMAGE;
@@ -826,12 +811,14 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara return TRUE;
case WM_NOTIFY:
- { NMHDR *nmhdr = (NMHDR*)lParam;
+ {
+ NMHDR *nmhdr = (NMHDR*)lParam;
switch(nmhdr->idFrom) {
case IDC_ASSOCLIST:
switch(nmhdr->code) {
case LVN_DELETEITEM: /* also called on WM_DESTROY */
- { LVITEM lvi;
+ {
+ LVITEM lvi;
lvi.mask = LVIF_PARAM;
lvi.iSubItem = 0;
lvi.iItem = ((NMLISTVIEW*)lParam)->iItem;
@@ -852,7 +839,8 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara * bug should not be present using WinVista and higher */
switch(((NMLVKEYDOWN*)lParam)->wVKey) {
case VK_UP:
- { LVITEM lvi;
+ {
+ LVITEM lvi;
lvi.iSubItem = 0;
lvi.mask = LVIF_PARAM;
lvi.iItem = ListView_GetNextItem(nmhdr->hwndFrom, -1, LVNI_FOCUSED);
@@ -868,7 +856,8 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara break;
}
case VK_PRIOR:
- { LVITEM lvi;
+ {
+ LVITEM lvi;
lvi.iSubItem = 0;
lvi.mask = LVIF_PARAM;
lvi.iItem = ListView_GetNextItem(nmhdr->hwndFrom, -1, LVNI_FOCUSED);
@@ -891,7 +880,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara case 0:
switch(nmhdr->code) {
case PSN_APPLY:
- { HWND hwndList;
+ {
LVITEM lvi;
BOOL fEnabled, fRegFailed = FALSE;
ASSOCDATA *assoc;
@@ -900,7 +889,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara db_set_b(NULL, "AssocMgr", "OnlyWhileRunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONLYWHILERUNNING)!= 0));
/* save enabled assoc items */
- hwndList = GetDlgItem(hwndDlg, IDC_ASSOCLIST);
+ HWND hwndList = GetDlgItem(hwndDlg, IDC_ASSOCLIST);
lvi.iSubItem = 0;
lvi.mask = LVIF_PARAM;
EnterCriticalSection(&csAssocList);
@@ -912,8 +901,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara /* re-register registery keys */
if(fEnabled?!EnsureAssocRegistered(assoc):!UnregisterAssoc(assoc)) {
- char *pszErr;
- pszErr = GetWinErrorDescription(GetLastError());
+ char *pszErr = GetWinErrorDescription(GetLastError());
ShowInfoMessage(NIIF_ERROR, Translate("File association error"), Translate("There was an error writing to the registry to modify the file/url associations.\nReason: %s"), (pszErr!= NULL)?pszErr:Translate("Unknown"));
mir_free(pszErr); /* does NULL check */
fRegFailed = TRUE; /* just show one time */
@@ -922,11 +910,9 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara LeaveCriticalSection(&csAssocList);
NotifyAssocChange(TRUE);
PostMessage(hwndDlg, M_REFRESH_ICONS, 0, 0);
- if(fRegFailed) {
- }
/* autostart */
- { TCHAR *pszRunCmd;
- pszRunCmd = MakeRunCommand(TRUE, TRUE);
+ {
+ TCHAR *pszRunCmd = MakeRunCommand(TRUE, TRUE);
fRegFailed = FALSE;
if(pszRunCmd!= NULL) {
fEnabled = IsDlgButtonChecked(hwndDlg, IDC_AUTOSTART);
@@ -951,7 +937,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara return FALSE;
}
-static int AssocListOptInit(WPARAM wParam, LPARAM lParam)
+static int AssocListOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.hInstance = hInst;
@@ -992,7 +978,8 @@ void InitAssocList(void) InitializeCriticalSection(&csNotifyTimer);
/* register open-with app */
- { TCHAR *pszAppFileName, *pszIconLoc, *pszRunCmd;
+ {
+ TCHAR *pszAppFileName, *pszIconLoc, *pszRunCmd;
pszIconLoc = MakeIconLocation(NULL, 0);
// miranda32.exe
@@ -1014,7 +1001,8 @@ void InitAssocList(void) }
/* default items */
- { FILETYPEDESC ftd;
+ {
+ FILETYPEDESC ftd;
ftd.cbSize = sizeof(FILETYPEDESC);
ftd.pszFileExt = ".dat";
ftd.pszMimeType = NULL;
@@ -1032,7 +1020,6 @@ void UninitAssocList(void) {
BYTE fOnlyWhileRunning;
ASSOCDATA *assoc;
- int i;
/* Options */
UnhookEvent(hHookOptInit);
@@ -1045,7 +1032,7 @@ void UninitAssocList(void) /* Assoc List */
fOnlyWhileRunning = db_get_b(NULL, "AssocMgr", "OnlyWhileRunning", SETTING_ONLYWHILERUNNING_DEFAULT);
- for(i = 0;i<nAssocListCount;++i) {
+ for(int i = 0;i<nAssocListCount;++i) {
assoc = &pAssocList[i];
/* remove registry keys */
diff --git a/plugins/AssocMgr/src/dde.cpp b/plugins/AssocMgr/src/dde.cpp index c187630910..71e719e760 100644 --- a/plugins/AssocMgr/src/dde.cpp +++ b/plugins/AssocMgr/src/dde.cpp @@ -89,9 +89,9 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd,UINT msg,WPARAM wParam,LPARAM {
switch(msg) {
case WM_DDE_INITIATE:
- { ATOM hSzApp,hSzTopic;
- hSzApp=LOWORD(lParam); /* no UnpackDDElParam() here */
- hSzTopic=HIWORD(lParam);
+ {
+ ATOM hSzApp=LOWORD(lParam); /* no UnpackDDElParam() here */
+ ATOM hSzTopic=HIWORD(lParam);
if ((hSzApp==GlobalFindAtom(DDEAPP) && hSzTopic==GlobalFindAtom(DDETOPIC)) || !hSzApp) {
hSzApp=GlobalAddAtom(DDEAPP);
hSzTopic=GlobalAddAtom(DDETOPIC);
@@ -104,15 +104,14 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd,UINT msg,WPARAM wParam,LPARAM return 0;
}
case WM_DDE_EXECUTE: /* posted message */
- { HGLOBAL hCommand;
+ {
+ HGLOBAL hCommand;
TCHAR *pszCommand;
DDEACK ack;
ZeroMemory(&ack,sizeof(ack));
if(UnpackDDElParam(msg,lParam,NULL,(PUINT_PTR)&hCommand)) {
-
/* ANSI execute command can't happen for shell */
if(IsWindowUnicode((HWND)wParam)) {
-
pszCommand = (TCHAR*)GlobalLock(hCommand);
if(pszCommand!=NULL) {
TCHAR *pszAction,*pszArg;
@@ -147,7 +146,8 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd,UINT msg,WPARAM wParam,LPARAM case WM_DDE_UNADVISE:
case WM_DDE_POKE:
/* fail safely for those to avoid memory leak in lParam */
- { ATOM hSzItem;
+ {
+ ATOM hSzItem;
DDEACK ack;
ZeroMemory(&ack,sizeof(ack));
if(UnpackDDElParam(msg,lParam,NULL,(PUINT_PTR)&hSzItem)) {
@@ -167,8 +167,6 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd,UINT msg,WPARAM wParam,LPARAM static HANDLE StartupMainProcess(TCHAR *pszDatabasePath)
{
TCHAR *p,szPath[MAX_PATH];
- PROCESS_INFORMATION pi;
- STARTUPINFO si;
/* we are inside RunDll32 here */
if (!GetModuleFileName(hInst,szPath,SIZEOF(szPath))) return NULL;
@@ -178,7 +176,9 @@ static HANDLE StartupMainProcess(TCHAR *pszDatabasePath) lstrcpy(++p,_T("miranda32.exe"));
/* inherit startup data from RunDll32 process */
+ STARTUPINFO si;
GetStartupInfo(&si);
+ PROCESS_INFORMATION pi;
if (!CreateProcess(szPath,pszDatabasePath,NULL,NULL,TRUE,GetPriorityClass(GetCurrentProcess()),NULL,NULL,&si,&pi))
return NULL;
CloseHandle(pi.hThread);
@@ -190,13 +190,10 @@ extern "C" { #endif
// entry point for RunDll32, this is also WaitForDDEW
-__declspec(dllexport) void CALLBACK WaitForDDE(HWND hwnd,HINSTANCE hinstExe,TCHAR *pszCmdLine,int nCmdShow)
+__declspec(dllexport) void CALLBACK WaitForDDE(HWND,HINSTANCE,TCHAR *pszCmdLine,int)
{
HANDLE pHandles[2];
DWORD dwTick;
- UNREFERENCED_PARAMETER(hinstExe);
- UNREFERENCED_PARAMETER(nCmdShow); /* obeys nCmdShow using GetStartupInfo() */
- UNREFERENCED_PARAMETER(hwnd);
/* wait for dde window to be available (avoiding race condition) */
pHandles[0]=CreateEvent(NULL,TRUE,FALSE,WNDCLASS_DDEMSGWINDOW);
@@ -224,24 +221,18 @@ __declspec(dllexport) void CALLBACK WaitForDDE(HWND hwnd,HINSTANCE hinstExe,TCHA /************************* Misc ***********************************/
-static int DdePreShutdown(WPARAM wParam,LPARAM lParam)
+static int DdePreShutdown(WPARAM,LPARAM)
{
- UNREFERENCED_PARAMETER(wParam);
- UNREFERENCED_PARAMETER(lParam);
/* dde needs to be stopped before any plugins are unloaded */
if(hwndDdeMsg!=NULL) DestroyWindow(hwndDdeMsg);
UnregisterClass(WNDCLASS_DDEMSGWINDOW,hInst);
return 0;
}
-static int DdeModulesLoaded2(WPARAM wParam,LPARAM lParam)
+static int DdeModulesLoaded2(WPARAM,LPARAM)
{
- WNDCLASS wcl;
- HANDLE hEvent;
- UNREFERENCED_PARAMETER(wParam);
- UNREFERENCED_PARAMETER(lParam);
-
/* create message window */
+ WNDCLASS wcl;
wcl.lpfnWndProc=DdeMessageWindow;
wcl.cbClsExtra=0;
wcl.cbWndExtra=0;
@@ -257,7 +248,7 @@ static int DdeModulesLoaded2(WPARAM wParam,LPARAM lParam) hwndDdeMsg=CreateWindow(WNDCLASS_DDEMSGWINDOW,NULL,0,0,0,0,0,NULL,NULL,hInst,NULL);
/* make known dde startup code is passed */
- hEvent=OpenEvent(EVENT_MODIFY_STATE,FALSE,WNDCLASS_DDEMSGWINDOW);
+ HANDLE hEvent=OpenEvent(EVENT_MODIFY_STATE,FALSE,WNDCLASS_DDEMSGWINDOW);
if(hEvent!=NULL) {
SetEvent(hEvent);
CloseHandle(hEvent);
@@ -269,10 +260,8 @@ static int DdeModulesLoaded2(WPARAM wParam,LPARAM lParam) return 0;
}
-static int DdeModulesLoaded(WPARAM wParam,LPARAM lParam)
+static int DdeModulesLoaded(WPARAM,LPARAM)
{
- UNREFERENCED_PARAMETER(wParam);
- UNREFERENCED_PARAMETER(lParam);
/* dde needs to be loaded after all the other plugins got loaded,
* hook again to get the latest position in chain */
UnhookEvent(hHookModulesLoaded);
diff --git a/plugins/AssocMgr/src/main.cpp b/plugins/AssocMgr/src/main.cpp index 58a65f5fbb..a40c0ecd34 100644 --- a/plugins/AssocMgr/src/main.cpp +++ b/plugins/AssocMgr/src/main.cpp @@ -76,10 +76,8 @@ static void InstallFile(const TCHAR *pszFileName,const TCHAR *pszDestSubDir) }
}
-static int AssocMgrModulesLoaded(WPARAM wParam,LPARAM lParam)
+static int AssocMgrModulesLoaded(WPARAM,LPARAM)
{
- UNREFERENCED_PARAMETER(wParam);
- UNREFERENCED_PARAMETER(lParam);
InitTest();
return 0;
}
diff --git a/plugins/AssocMgr/src/reg.cpp b/plugins/AssocMgr/src/reg.cpp index 9737094980..9fa97d0e61 100644 --- a/plugins/AssocMgr/src/reg.cpp +++ b/plugins/AssocMgr/src/reg.cpp @@ -251,8 +251,7 @@ static LONG DeleteRegSubTree(HKEY hKey,const TCHAR *pszSubKey) static LONG SetRegSubKeyStrDefValue(HKEY hMainKey,const TCHAR *pszSubKey,const TCHAR *pszVal)
{
HKEY hSubKey;
- LONG res;
- res=RegCreateKeyEx(hMainKey,pszSubKey,0,NULL,0,KEY_SET_VALUE|KEY_QUERY_VALUE,NULL,&hSubKey,NULL);
+ 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,(lstrlen(pszVal)+1)*sizeof(TCHAR));
RegCloseKey(hSubKey);
@@ -263,10 +262,8 @@ static LONG SetRegSubKeyStrDefValue(HKEY hMainKey,const TCHAR *pszSubKey,const T // hKey must have been opened with KEY_SET_VALUE access right
static void SetRegStrPrefixValue(HKEY hKey,const TCHAR *pszValPrefix,const TCHAR *pszVal)
{
- TCHAR *pszStr;
- DWORD dwSize;
- dwSize=(lstrlen(pszVal)+lstrlen(pszValPrefix)+1)*sizeof(TCHAR);
- pszStr=(TCHAR*)mir_alloc(dwSize);
+ DWORD dwSize=(lstrlen(pszVal)+lstrlen(pszValPrefix)+1)*sizeof(TCHAR);
+ TCHAR *pszStr=(TCHAR*)mir_alloc(dwSize);
if (pszStr==NULL) return;
lstrcat(lstrcpy(pszStr,pszValPrefix),pszVal); /* buffer safe */
RegSetValueEx(hKey,NULL,0,REG_SZ,(BYTE*)pszStr,dwSize);
@@ -307,8 +304,7 @@ static TCHAR *GetRegStrValue(HKEY hKey,const TCHAR *pszValName) static BOOL IsRegStrValue(HKEY hKey,const TCHAR *pszValName,const TCHAR *pszCmpVal)
{
BOOL fSame=FALSE;
- TCHAR *pszVal;
- pszVal=GetRegStrValue(hKey,pszValName);
+ TCHAR *pszVal=GetRegStrValue(hKey,pszValName);
if (pszVal!=NULL) {
fSame=!lstrcmp(pszVal,pszCmpVal);
mir_free(pszVal);
@@ -320,9 +316,8 @@ static BOOL IsRegStrValue(HKEY hKey,const TCHAR *pszValName,const TCHAR *pszCmpV static BOOL IsRegStrValueA(HKEY hKey,const TCHAR *pszValName,const char *pszCmpVal)
{
BOOL fSame=FALSE;
- TCHAR *pszVal;
char *pszValA;
- pszVal=GetRegStrValue(hKey,pszValName);
+ TCHAR *pszVal=GetRegStrValue(hKey,pszValName);
if (pszVal!=NULL) {
pszValA=t2a(pszVal);
if (pszValA!=NULL)
@@ -457,22 +452,21 @@ static void BackupRegTree(HKEY hKey,const char *pszSubKey,const char *pszDbPrefi static LONG RestoreRegTree(HKEY hKey,const char *pszSubKey,const char *pszDbPrefix)
{
- char **ppszSettings,*pszSuffix,*pszPrefixWithSubKey;
- int nSettingsCount,i,nDbPrefixLen,nPrefixWithSubKeyLen;
+ char **ppszSettings,*pszSuffix;
+ int nSettingsCount,i;
char *pslash=NULL,*pnext,*pkeys;
char *pszValName;
WCHAR *pwszValName;
HKEY hSubKey;
DWORD dwType,cbData;
BYTE *pData;
- LONG res;
- nDbPrefixLen=lstrlenA(pszDbPrefix);
- nPrefixWithSubKeyLen=nDbPrefixLen+lstrlenA(pszSubKey)+1;
- pszPrefixWithSubKey=(char*)mir_alloc(nPrefixWithSubKeyLen+1);
+ int nDbPrefixLen=lstrlenA(pszDbPrefix);
+ int nPrefixWithSubKeyLen=nDbPrefixLen+lstrlenA(pszSubKey)+1;
+ char *pszPrefixWithSubKey=(char*)mir_alloc(nPrefixWithSubKeyLen+1);
if (pszPrefixWithSubKey==NULL) return ERROR_OUTOFMEMORY;
lstrcatA(lstrcatA(lstrcpyA(pszPrefixWithSubKey,pszDbPrefix),pszSubKey),"\\"); /* buffer safe */
- res=ERROR_NO_MORE_ITEMS;
+ LONG res=ERROR_NO_MORE_ITEMS;
if (pszPrefixWithSubKey!=NULL) {
if (EnumDbPrefixSettings("AssocMgr",pszPrefixWithSubKey,&ppszSettings,&nSettingsCount)) {
for(i=0;i<nSettingsCount;++i) {
@@ -515,10 +509,10 @@ static LONG RestoreRegTree(HKEY hKey,const char *pszSubKey,const char *pszDbPref static void DeleteRegTreeBackup(const char *pszSubKey,const char *pszDbPrefix)
{
- char **ppszSettings,*pszPrefixWithSubKey;
+ char **ppszSettings;
int nSettingsCount,i;
- pszPrefixWithSubKey=(char*)mir_alloc(lstrlenA(pszDbPrefix)+lstrlenA(pszSubKey)+2);
+ char *pszPrefixWithSubKey=(char*)mir_alloc(lstrlenA(pszDbPrefix)+lstrlenA(pszSubKey)+2);
if (pszPrefixWithSubKey==NULL) return;
lstrcatA(lstrcatA(lstrcpyA(pszPrefixWithSubKey,pszDbPrefix),pszSubKey),"\\"); /* buffer safe */
if (pszPrefixWithSubKey!=NULL) {
@@ -914,13 +908,12 @@ BOOL AddRegFileExt(const char *pszFileExt,const char *pszClassName,const char *p /* file ext */
if (!RegCreateKeyExA(hRootKey,pszFileExt,0,NULL,0,KEY_SET_VALUE|KEY_QUERY_VALUE|KEY_CREATE_SUB_KEY,NULL,&hExtKey,NULL)) {
- TCHAR *pszPrevClass;
/* backup previous app */
BackupRegTree(hRootKey,pszFileExt,"bak_");
/* remove any no-open flag */
RegDeleteValue(hExtKey,_T("NoOpen"));
/* open with progids */
- pszPrevClass=GetRegStrValue(hExtKey,NULL);
+ TCHAR *pszPrevClass=GetRegStrValue(hExtKey,NULL);
if (pszPrevClass!=NULL && !IsRegStrValueA(hExtKey,NULL,pszClassName))
if (!RegCreateKeyEx(hExtKey,_T("OpenWithProgids"),0,NULL,0,KEY_SET_VALUE,NULL,&hOpenWithKey,NULL)) {
/* previous class (backup) */
diff --git a/plugins/AssocMgr/src/test.cpp b/plugins/AssocMgr/src/test.cpp index 924e215c11..f4b20c277c 100644 --- a/plugins/AssocMgr/src/test.cpp +++ b/plugins/AssocMgr/src/test.cpp @@ -83,10 +83,9 @@ static __inline void aim_gchat_joinrequest(const char *room, int exchange) { roo static HANDLE hHookModulesLoaded;
static HANDLE hServiceParseLink;
-static int ServiceParseAimLink(WPARAM wParam,LPARAM lParam)
+static int ServiceParseAimLink(WPARAM,LPARAM lParam)
{
char *arg=(char*)lParam;
- UNREFERENCED_PARAMETER(wParam);
if(arg==NULL) return 1; /* sanity check */
/* skip leading prefix */
arg=strchr(arg,':');
|