diff options
author | George Hazan <george.hazan@gmail.com> | 2012-09-21 09:06:12 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-09-21 09:06:12 +0000 |
commit | 9be4120a7e4210fc4f1809e9eacbfeb831c69890 (patch) | |
tree | 9f9c240aee60b3e71ac6ecbd98af770ab98e9505 /plugins/AutoRun/src/main.cpp | |
parent | 4a3cb30cbcf9dc95a813625a56cf2122cc927a31 (diff) |
fix for last char eating
git-svn-id: http://svn.miranda-ng.org/main/trunk@1619 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AutoRun/src/main.cpp')
-rw-r--r-- | plugins/AutoRun/src/main.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/AutoRun/src/main.cpp b/plugins/AutoRun/src/main.cpp index 86a58639e3..fb9272ac56 100644 --- a/plugins/AutoRun/src/main.cpp +++ b/plugins/AutoRun/src/main.cpp @@ -23,7 +23,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) return TRUE;
}
-void GetProfilePath(TCHAR *res)
+void GetProfilePath(TCHAR *res, size_t resLen)
{
TCHAR dbname[MAX_PATH], dbpath[MAX_PATH], exename[MAX_PATH];
CallService(MS_DB_GETPROFILENAMET, SIZEOF(dbname), (LPARAM)(TCHAR*) dbname);
@@ -33,7 +33,7 @@ void GetProfilePath(TCHAR *res) lstrcpyn(dbpath + lstrlen(dbpath), dbname, lstrlen(dbname)-3);
lstrcat(dbpath, _T("\\"));
lstrcat(dbpath, dbname); // path + profile name
- mir_sntprintf(res, lstrlen(exename) + lstrlen(dbpath) + 5, _T("\"%s\" \"%s\""), exename, dbpath);
+ mir_sntprintf(res, resLen, _T("\"%s\" \"%s\""), exename, dbpath);
}
static void SetAutorun(BOOL autorun)
@@ -44,7 +44,7 @@ static void SetAutorun(BOOL autorun) case TRUE:
if ( RegCreateKeyEx(ROOT_KEY, SUB_KEY, 0, NULL, 0, KEY_CREATE_SUB_KEY|KEY_SET_VALUE,NULL,&hKey,&dw) == ERROR_SUCCESS) {
TCHAR result[MAX_PATH];
- GetProfilePath(result);
+ GetProfilePath(result, SIZEOF(result));
RegSetValueEx(hKey, _T("MirandaNG"), 0, REG_SZ, (BYTE*)result, sizeof(TCHAR)*lstrlen(result));
RegCloseKey(hKey);
}
@@ -69,8 +69,8 @@ static BOOL CmpCurrentAndRegistry() if ( RegQueryValueEx(hKey, _T("MirandaNG"), NULL, NULL, (LPBYTE)dbpath, &dwBufLen) != ERROR_SUCCESS)
return FALSE;
- GetProfilePath(result);
- return lstrcmpi(result,dbpath) == 0;
+ GetProfilePath(result, SIZEOF(result));
+ return lstrcmpi(result, dbpath) == 0;
}
static INT_PTR CALLBACK DlgProcAutorunOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|