Esempio n. 1
0
        protected override void EndProcessing()
        {
            uint   bytesCopied = 0;
            bool   retVal;
            string cwd = this.SessionState.Path.CurrentFileSystemLocation.Path;

            retVal = SeBackupPrivilegeUtils.CopyFile(FileUtils.expandPath(cwd, InFile), FileUtils.expandPath(cwd, OutFile), ref bytesCopied, Overwrite.ToBool());
            if (retVal)
            {
                Console.WriteLine("Copied " + bytesCopied.ToString() + " bytes");
            }
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            bool retVal;


            retVal = SeBackupPrivilegeUtils.isSeBackupPrivilegeEnabled();
            Console.WriteLine(retVal ? "Yes!" : "no");
            SeBackupPrivilegeUtils.setSeBackupPrivilege(true);
            retVal = SeBackupPrivilegeUtils.isSeBackupPrivilegeEnabled();
            Console.WriteLine(retVal ? "Yes!" : "no");
            if (!retVal)
            {
                Console.WriteLine("SeBackupPrivilege is not enabled, giving up");
                return;
            }
            uint bytesCopied = 0;

            retVal = SeBackupPrivilegeUtils.CopyFile("c:/temp/x.txt", "c:/temp/y.txt", ref bytesCopied, true);
            if (retVal)
            {
                Console.WriteLine("Copied " + bytesCopied.ToString() + " bytes");
            }
        }