Hi,
I'm using SafeGuard Lan Crypt 3.71.64.12. I would like to create a Windows Service to crypt all files from a folder using Initial encryption. In the code below (in C#) as a test, I'm trying to crypt only one file:
protected override void OnStart(string[] args) { CancellationToken cancellationToken = cancellationTokenSource.Token; mainTask = System.Threading.Tasks.Task.Factory.StartNew(() => { while (true) { ProcessStartInfo info = new ProcessStartInfo(); info.UseShellExecute = false; info.CreateNoWindow = false; info.FileName = "\\\\servidor\\Turim\\TI_\\sglcinit.exe"; info.Arguments = "\\\\servidor\\Turim\\TI_\\aaaa.xlsx -DC:\\ignore /Te {DA7D81DA-50EB-4C30-87E6-5DB31B0269F8} /V3 /LLogfile logfile.xml"; info.Verb = "runas"; info.WorkingDirectory = Path.GetDirectoryName("\\\\servidor\\Turim\\TI_"); info.UseShellExecute = false; info.RedirectStandardError = true; info.RedirectStandardOutput = true; info.LoadUserProfile = true; Process process = Process.Start(info); process.WaitForExit(5000); Thread.Sleep(10000); } }, cancellationToken); }
When I run the service, the file is not encrypting and the log file has the following information:
<DataRoot> <Date>12/02/14</Date> <Time>11:52:32</Time> <Files> <File> <Name>\\servidor\Turim\TI_\aaaa.xlsx</Name> <Result>plain</Result> </File> </Files> </DataRoot>
If I copy the same code to a console application and double click it, it works perfectly.
More details:
- I'm running the service with my user credentials in this case as 'mydomain\abandeira'
- I tried to impersonate the ProcessInfo using P/Invoke to run as 'mydomain\abandeira' (importing advapi32.dll)
- The key '{DA7D81DA-50EB-4C30-87E6-5DB31B0269F8}' is from the folder key 'TI_'
- I'm trying to run the process as Administrator (it doens't work without it too)
- I tried to run the ProcessInfo with username = 'administrator' and password without success.
- The service was installed and is running on Windows Server 2008 R2 Standard
If is not possible to use the sglcinit with windows service, How can I create a task or something that automatically crypt the files based on an interval ?
This thread was automatically locked due to age.