From 86af3b9f5006773c3acd00493384be7483a0d4a3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 12 Jan 2013 19:49:43 +0000 Subject: the same fix for AutoRun fixes: #97 git-svn-id: http://svn.miranda-ng.org/main/trunk@3078 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AutoRun/src/main.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'plugins/AutoRun/src/main.cpp') diff --git a/plugins/AutoRun/src/main.cpp b/plugins/AutoRun/src/main.cpp index b65a22175b..7794fe0f3f 100644 --- a/plugins/AutoRun/src/main.cpp +++ b/plugins/AutoRun/src/main.cpp @@ -25,15 +25,14 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) 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); - CallService(MS_DB_GETPROFILEPATHT, SIZEOF(dbpath), (LPARAM)(TCHAR*) dbpath); - GetModuleFileName(NULL,exename, SIZEOF(exename)); - lstrcat(dbpath, _T("\\")); - lstrcpyn(dbpath + lstrlen(dbpath), dbname, lstrlen(dbname)-3); - lstrcat(dbpath, _T("\\")); - lstrcat(dbpath, dbname); // path + profile name - mir_sntprintf(res, resLen, _T("\"%s\" \"%s\""), exename, dbpath); + TCHAR dbname[MAX_PATH], exename[MAX_PATH]; + CallService(MS_DB_GETPROFILENAMET, SIZEOF(dbname), (LPARAM)dbname); + GetModuleFileName(NULL, exename, SIZEOF(exename)); + + TCHAR *p = _tcsrchr(dbname, '.'); + if (p) *p = 0; + + mir_sntprintf(res, resLen, _T("\"%s\" \"/profile:%s\""), exename, dbname); } static void SetAutorun(BOOL autorun) -- cgit v1.2.3