[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
This commit is contained in:
Don Ho 2010-10-14 22:53:20 +00:00
parent 52edd1eb16
commit 7107532531
2 changed files with 22 additions and 8 deletions

View File

@ -29,14 +29,10 @@ copy /Y ..\bin\change.log .\zipped.package.release\unicode\
If ErrorLevel 1 PAUSE If ErrorLevel 1 PAUSE
copy /Y ..\src\config.model.xml .\zipped.package.release\unicode\ copy /Y ..\src\config.model.xml .\zipped.package.release\unicode\
If ErrorLevel 1 PAUSE 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\ copy /Y ..\src\langs.model.xml .\zipped.package.release\unicode\
If ErrorLevel 1 PAUSE If ErrorLevel 1 PAUSE
copy /Y ..\src\stylers.model.xml .\zipped.package.release\unicode\ copy /Y ..\src\stylers.model.xml .\zipped.package.release\unicode\
If ErrorLevel 1 PAUSE 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\ copy /Y ..\src\contextMenu.xml .\zipped.package.release\unicode\
If ErrorLevel 1 PAUSE If ErrorLevel 1 PAUSE
copy /Y ..\src\shortcuts.xml .\zipped.package.release\unicode\ 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 If ErrorLevel 1 PAUSE
copy /Y ..\src\config.model.xml .\zipped.package.release\ansi\ copy /Y ..\src\config.model.xml .\zipped.package.release\ansi\
If ErrorLevel 1 PAUSE 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\ copy /Y ..\src\langs.model.xml .\zipped.package.release\ansi\
If ErrorLevel 1 PAUSE If ErrorLevel 1 PAUSE
copy /Y ..\src\stylers.model.xml .\zipped.package.release\ansi\ copy /Y ..\src\stylers.model.xml .\zipped.package.release\ansi\
If ErrorLevel 1 PAUSE 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\ copy /Y ..\src\contextMenu.xml .\zipped.package.release\ansi\
If ErrorLevel 1 PAUSE If ErrorLevel 1 PAUSE
copy /Y ..\src\shortcuts.xml .\zipped.package.release\ansi\ copy /Y ..\src\shortcuts.xml .\zipped.package.release\ansi\

View File

@ -758,6 +758,28 @@ bool NppParameters::load()
// Test if localConf.xml exist // Test if localConf.xml exist
bool isLocal = (PathFileExists(localConfPath.c_str()) == TRUE); 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) if (isLocal)
{ {
_userPath = _nppPath; _userPath = _nppPath;