public void TestEXESigWrong() { #if DEBUG string Filename = Environment.ExpandEnvironmentVariables("%TEMP%\\Vulpes Clock Wrong.exe"); File.WriteAllBytes(Filename, Resources.CLOCK___Wrong); ProgramAgent.Init(); if (ProgramAgent.LoadDLLForced(SystemInfos.CPUType.EM64T) == false) { Assert.Inconclusive("Cannot load Agent supplemental DLL"); } Assert.AreEqual(false, ProgramAgent.CPP.VerifyEXESignature(Filename)); #else Assert.AreEqual(true, true); #endif }
public void TestGetDeltaStream_WebsocketWrite() { #if DEBUG if (Directory.Exists(PipeScreenData.Framebufferpath) == false) { Assert.Inconclusive("Cannot find " + PipeScreenData.Framebufferpath); return; } List <string> FileList = Directory.EnumerateFiles(PipeScreenData.Framebufferpath, "*.png", SearchOption.TopDirectoryOnly).ToList(); if (FileList == null || FileList.Count == 0) { Assert.Inconclusive("No PNG files in " + PipeScreenData.Framebufferpath); return; } ProgramAgent.Init(); if (ProgramAgent.LoadDLLForced(SystemInfos.CPUType.EM64T) == false) { Assert.Inconclusive("Cannot load Agent supplemental DLL"); } ScreenDataWS ws = new ScreenDataWS(null, "TEST"); decimal sz = 0; decimal tz = 0; ws.Ws_OnMessage(new byte[] { 0x46, 0x52, 0x53, 0x1, 0x4, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); for (int i = 0; i < FileList.Count; i++) { Stopwatch st = new Stopwatch(); st.Start(); ws.Ws_OnMessage(new byte[] { 0x46, 0x52, 0x53, 0x1, 0x4, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); st.Stop(); tz += st.ElapsedMilliseconds; sz += 0; } sz /= (decimal)FileList.Count - 1; tz /= (decimal)FileList.Count - 1; Console.WriteLine("Pictures: " + (FileList.Count - 1) + " - AVG SZ=" + sz.ToString("0.00") + " bytes - AVG TZ= " + tz.ToString("0.0000") + " ms"); Assert.AreEqual(0, 0); #else Assert.Inconclusive("Unavalible in Release"); #endif }
public void TestGetDeltaScreen_via_WCF() { #if DEBUG if (Directory.Exists(PipeScreenData.Framebufferpath) == false) { Assert.Inconclusive("Cannot find " + PipeScreenData.Framebufferpath); return; } List <string> FileList = Directory.EnumerateFiles(PipeScreenData.Framebufferpath, "*.png", SearchOption.TopDirectoryOnly).ToList(); if (FileList == null || FileList.Count == 0) { Assert.Inconclusive("No PNG files in " + PipeScreenData.Framebufferpath); return; } ProgramAgent.Init(); if (ProgramAgent.LoadDLLForced(SystemInfos.CPUType.EM64T) == false) { Assert.Inconclusive("Cannot load Agent supplemental DLL"); } decimal sz = 0; decimal tz = 0; MainScreenSystem.Ping(); for (int i = 0; i < FileList.Count; i++) { Stopwatch st = new Stopwatch(); st.Start(); byte[] d = MainScreenSystem.GetDeltaScreen2Debug(); st.Stop(); tz += st.ElapsedMilliseconds; sz += d.Length; } sz /= (decimal)FileList.Count; tz /= (decimal)FileList.Count; Console.WriteLine("Pictures: " + FileList.Count + " - AVG SZ=" + sz.ToString("0.00") + " bytes - AVG TZ= " + tz.ToString("0.0000") + " ms"); Assert.AreEqual(0, 0); #else Assert.Inconclusive("Unavalible in Release"); #endif }
static int Main() { FoxEventLog.Shutup = true; string dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (dir.EndsWith("\\") == false) { dir += "\\"; } ProgramAgent.Init(); if (ProgramAgent.LoadDLL() == false) { return(1); } if (SystemInfos.CollectSystemInfo() != 0) { return(1); } if (ApplicationCertificate.LoadCertificate() == false) { FoxEventLog.WriteEventLog("Cannot load certificate", System.Diagnostics.EventLogEntryType.Error); return(1); } if (FilesystemData.LoadCertificates() == false) { return(1); } if (FilesystemData.LoadPolicies() == false) { return(1); } FilesystemData.LoadLocalPackageData(); FilesystemData.LoadLocalPackages(); FilesystemData.LoadUserPackageData(); FilesystemData.LoadEventLogList(); FoxEventLog.Shutup = false; if (SyncPolicy.ApplyPolicy(SyncPolicy.ApplyPolicyFunction.Uninstall) == false) { return(5); } ServiceController svc = new ServiceController("FoxSDCA"); try { svc.Stop(); } catch { } int i = 0; do { i++; if (i > 120 * 4) { break; } svc.Refresh(); Thread.Sleep(1000); } while (svc.Status != ServiceControllerStatus.Stopped); #region Kill Processes foreach (Process proc in Process.GetProcesses()) { try { if (proc.MainModule.FileName.ToLower() == dir.ToLower() + "foxsdc_agent_ui.exe") { proc.Kill(); } } catch { } } foreach (Process proc in Process.GetProcesses()) { try { if (proc.MainModule.FileName.ToLower() == dir.ToLower() + "foxsdc_applyusersettings.exe") { proc.Kill(); } } catch { } } foreach (Process proc in Process.GetProcesses()) { try { if (proc.MainModule.FileName.ToLower() == dir.ToLower() + "foxsdc_agent.exe") { proc.Kill(); } } catch { } } #endregion try { RegistryKey reg = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); reg.DeleteValue("FoxSDCAgent", false); reg.DeleteValue("FoxSDCAgentApply", false); reg.Close(); } catch { } try { Process.Start(Environment.ExpandEnvironmentVariables("%systemroot%\\system32\\msiexec.exe"), "/x {A6F066EE-E795-4C65-8FE4-2D93AB52BC36} /passive"); } catch { } return(0); }
static int Main(string[] args) { foreach (string arg in args) { if (arg.ToLower() == "-nopackages") { NoPackages = true; } } FoxEventLog.Shutup = true; ProgramAgent.Init(); if (ProgramAgent.LoadDLL() == false) { return(1); } FoxEventLog.Shutup = false; #if !DEBUG List <string> Additionals = new List <string>(); Additionals.Add(Assembly.GetExecutingAssembly().Location); if (ProgramAgent.TestIntegrity(Additionals) == false) { FoxEventLog.WriteEventLog("Apply User settings: Integrity failed!", EventLogEntryType.Error, true); return(1); } #endif FoxEventLog.Shutup = true; if (SystemInfos.CollectSystemInfo() != 0) { return(1); } if (ApplicationCertificate.LoadCertificate() == false) { FoxEventLog.Shutup = false; FoxEventLog.WriteEventLog("Apply User settings: Cannot load certificate", System.Diagnostics.EventLogEntryType.Error); return(1); } FoxEventLog.Shutup = false; if (FilesystemData.LoadCertificates(true) == false) { return(1); } if (FilesystemData.LoadPolicies() == false) { return(1); } FilesystemData.LoadLocalPackageData(); FilesystemData.LoadLocalPackages(); FilesystemData.LoadUserPackageData(); FilesystemData.LoadEventLogList(); SyncPolicy.ApplyPolicy(SyncPolicy.ApplyPolicyFunction.ApplyUser); if (NoPackages == true) { return(0); } string PackagesFolder = SystemInfos.ProgramData + "Packages\\"; if (Directory.Exists(PackagesFolder) == false) { return(2); } foreach (PackagesToInstall pkg in FilesystemData.LocalPackages) { LocalPackageData lpkg = FilesystemData.FindLocalPackageFromListLatest(pkg.PackageID); if (lpkg == null) { continue; } if (pkg.Version != lpkg.Version) { continue; } PackageInstaller inst = new PackageInstaller(); string metafile = PackagesFolder + pkg.MetaFilename; if (File.Exists(metafile) == false) { continue; } string Error; PKGRecieptData Reciept; PKGStatus res; if (inst.InstallPackage(metafile, PackageCertificate.ActivePackageCerts, PackageInstaller.InstallMode.ApplyUserSettingsTest, true, out Error, out res, out Reciept) == false) { FoxEventLog.WriteEventLog("Apply User settings: The Metapackage " + pkg.MetaFilename + " cannot be tested: " + Error, System.Diagnostics.EventLogEntryType.Error); continue; } FoxEventLog.VerboseWriteEventLog("Apply User settings: Applying user settings for " + pkg.MetaFilename, EventLogEntryType.Information); if (inst.ApplyUserSettings(metafile, PackageCertificate.ActivePackageCerts, out Error, out res) == false) { FoxEventLog.WriteEventLog("Apply User settings: The Metapackage " + pkg.MetaFilename + " cannot be used to apply user settings: " + Error, System.Diagnostics.EventLogEntryType.Error); continue; } } if (RegistryData.Verbose == 1) { FoxEventLog.VerboseWriteEventLog("Apply User settings: ApplyUserSettings success for " + Environment.UserDomainName + "\\" + Environment.UserName, EventLogEntryType.Information); } return(0); }