From 71075325316ab03e65df92711df6c1b8a3d7dfa6 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Thu, 14 Oct 2010 22:53:20 +0000 Subject: [PATCH] [BUG_FIXED] Due to UAC issue, under vista and windows 7, the usage of doLocalConf.xml is not allowed if Notepad++ is installed in "program files" directory. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@680 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/installer/packageAll.bat | 8 -------- PowerEditor/src/Parameters.cpp | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/PowerEditor/installer/packageAll.bat b/PowerEditor/installer/packageAll.bat index 291671697..ca202daaa 100644 --- a/PowerEditor/installer/packageAll.bat +++ b/PowerEditor/installer/packageAll.bat @@ -29,14 +29,10 @@ copy /Y ..\bin\change.log .\zipped.package.release\unicode\ If ErrorLevel 1 PAUSE copy /Y ..\src\config.model.xml .\zipped.package.release\unicode\ If ErrorLevel 1 PAUSE -copy /Y ..\src\config.model.xml .\zipped.package.release\unicode\config.xml -If ErrorLevel 1 PAUSE copy /Y ..\src\langs.model.xml .\zipped.package.release\unicode\ If ErrorLevel 1 PAUSE copy /Y ..\src\stylers.model.xml .\zipped.package.release\unicode\ If ErrorLevel 1 PAUSE -copy /Y ..\src\stylers.model.xml .\zipped.package.release\unicode\stylers.xml -If ErrorLevel 1 PAUSE copy /Y ..\src\contextMenu.xml .\zipped.package.release\unicode\ If ErrorLevel 1 PAUSE copy /Y ..\src\shortcuts.xml .\zipped.package.release\unicode\ @@ -82,14 +78,10 @@ copy /Y ..\bin\change.log .\zipped.package.release\ansi\ If ErrorLevel 1 PAUSE copy /Y ..\src\config.model.xml .\zipped.package.release\ansi\ If ErrorLevel 1 PAUSE -copy /Y ..\src\config.model.xml .\zipped.package.release\ansi\config.xml -If ErrorLevel 1 PAUSE copy /Y ..\src\langs.model.xml .\zipped.package.release\ansi\ If ErrorLevel 1 PAUSE copy /Y ..\src\stylers.model.xml .\zipped.package.release\ansi\ If ErrorLevel 1 PAUSE -copy /Y ..\src\stylers.model.xml .\zipped.package.release\ansi\stylers.xml -If ErrorLevel 1 PAUSE copy /Y ..\src\contextMenu.xml .\zipped.package.release\ansi\ If ErrorLevel 1 PAUSE copy /Y ..\src\shortcuts.xml .\zipped.package.release\ansi\ diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index c2e2c95e8..c640600a5 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -758,6 +758,28 @@ bool NppParameters::load() // Test if localConf.xml exist bool isLocal = (PathFileExists(localConfPath.c_str()) == TRUE); + // Under vista and windows 7, the usage of doLocalConf.xml is not allowed + // if Notepad++ is installed in "program files" directory, because of UAC + if (isLocal) + { + // We check if OS is Vista or above + if (_winVersion >= WV_VISTA) + { + ITEMIDLIST *pidl; + SHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidl); + TCHAR progPath[MAX_PATH]; + SHGetPathFromIDList(pidl, progPath); + TCHAR nppDirLocation[MAX_PATH]; + lstrcpy(nppDirLocation, _nppPath.c_str()); + ::PathRemoveFileSpec(nppDirLocation); + //printStr(progPath); + //printStr(nppDirLocation); + + if (lstrcmp(progPath, nppDirLocation) == 0) + isLocal = false; + } + } + if (isLocal) { _userPath = _nppPath;