summaryrefslogtreecommitdiff
path: root/shared/symlink_target.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:09:45 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:09:45 +0200
commit88c8801298cbf6fec9cdce254c7b3cb9e066a421 (patch)
tree35a35acf48eb227bac30abc8f87ea9b1c3c57b68 /shared/symlink_target.h
parent3.12 (diff)
downloadFreeFileSync-88c8801298cbf6fec9cdce254c7b3cb9e066a421.tar.gz
FreeFileSync-88c8801298cbf6fec9cdce254c7b3cb9e066a421.tar.bz2
FreeFileSync-88c8801298cbf6fec9cdce254c7b3cb9e066a421.zip
3.13
Diffstat (limited to 'shared/symlink_target.h')
-rw-r--r--shared/symlink_target.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/shared/symlink_target.h b/shared/symlink_target.h
index c68d5229..358f2913 100644
--- a/shared/symlink_target.h
+++ b/shared/symlink_target.h
@@ -1,7 +1,7 @@
// **************************************************************************
// * This file is part of the FreeFileSync project. It is distributed under *
// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
-// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) *
+// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) *
// **************************************************************************
//
#ifndef SYMLINK_WIN_H_INCLUDED
@@ -17,6 +17,7 @@
#ifdef FFS_WIN
#include <wx/msw/wrapwin.h> //includes "windows.h"
#include "WinIoCtl.h"
+#include "privilege.h"
#include "long_path_prefix.h"
#elif defined FFS_LINUX
@@ -60,7 +61,7 @@ typedef struct _REPARSE_DATA_BUFFER
namespace
{
- //retrieve raw target data of symlink or junction
+//retrieve raw target data of symlink or junction
Zstring getSymlinkRawTargetString(const Zstring& linkPath) //throw (FileError)
{
using ffs3::zToWx;
@@ -68,6 +69,13 @@ Zstring getSymlinkRawTargetString(const Zstring& linkPath) //throw (FileError)
#ifdef FFS_WIN
//FSCTL_GET_REPARSE_POINT: http://msdn.microsoft.com/en-us/library/aa364571(VS.85).aspx
+ try //setting privileges requires admin rights! This shall not cause an error in user mode!
+ {
+ //allow access to certain symbolic links/junctions
+ ffs3::Privileges::getInstance().ensureActive(SE_BACKUP_NAME); //throw FileError()
+ }
+ catch (...) {}
+
const HANDLE hLink = ::CreateFile(ffs3::applyLongPathPrefix(linkPath).c_str(),
GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
@@ -111,7 +119,7 @@ Zstring getSymlinkRawTargetString(const Zstring& linkPath) //throw (FileError)
else if (reparseData.ReparseTag == IO_REPARSE_TAG_MOUNT_POINT)
{
output = Zstring(reparseData.MountPointReparseBuffer.PathBuffer + reparseData.MountPointReparseBuffer.SubstituteNameOffset / sizeof(WCHAR),
- reparseData.MountPointReparseBuffer.SubstituteNameLength / sizeof(WCHAR));
+ reparseData.MountPointReparseBuffer.SubstituteNameLength / sizeof(WCHAR));
}
else
{
bgstack15