Пример #1
0
        /// <summary>
        /// Initializes a new instance of <see cref="VirtualizationEngine"/>.
        /// </summary>
        /// <param name="configurationProvider">
        /// The <see cref="IConfigurationProvider"/> to use for loading the required resources.
        /// </param>
        /// <returns></returns>
        public static VirtualizationEngine InitializeEngine(IConfigurationProvider configurationProvider)
        {
            var syncBus = new SynchronizationBus(configurationProvider);
            var engine  = new VirtualizationEngine(syncBus);

            if (!configurationProvider.ConnectionStrings.ContainsKey(ConfigurationDataType.FileSystemRoot))
            {
                throw new ConfigurationDataException(ConfigurationDataType.FileSystemRoot);
            }
            var fsProvider = new FileSystemProvider(configurationProvider.ConnectionStrings[ConfigurationDataType.FileSystemRoot],
                                                    configurationProvider.GetFileSystemEngineRules());
            var regProvider = new RegistryProvider(syncBus);

            engine._hookManager.RegisterHookProvider(new FileSystemHookProvider(fsProvider));
            engine._hookManager.RegisterHookProvider(new RegistryHookProvider(regProvider));
            return(engine);
        }
Пример #2
0
    /// <summary>
    /// Initializes the <see cref="EngineCore"/>.
    /// </summary>
    /// <param name="processSynchronizer">
    /// The <see cref="IProcessSynchronizer"/> to use for communication with the host.
    /// </param>
    public static void Initialize(IProcessSynchronizer processSynchronizer)
    {
      lock (_syncRoot)
      {
        if (_initialized) return;
        // Initialize variables.
        _currentProcessId = RemoteHooking.GetCurrentProcessId();
        _serverReporter = processSynchronizer;
        _logBus = new LogBus(processSynchronizer);
#if !SYNCLOG
        _logBus.Enabled = true;
#endif
        _engine = VirtualizationEngine.InitializeEngine(processSynchronizer);
        // Attach ProcessExit event handler.
        AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
        // Mark instance as initialized.
        _initialized = true;
        Log.Message("Successfully initialized core components.");
      }
    }
 /// <summary>
 /// Initializes a new instance of <see cref="VirtualizationEngine"/>.
 /// </summary>
 /// <param name="configurationProvider">
 /// The <see cref="IConfigurationProvider"/> to use for loading the required resources.
 /// </param>
 /// <returns></returns>
 public static VirtualizationEngine InitializeEngine(IConfigurationProvider configurationProvider)
 {
   var syncBus = new SynchronizationBus(configurationProvider);
   var engine = new VirtualizationEngine(syncBus);
   if (!configurationProvider.ConnectionStrings.ContainsKey(ConfigurationDataType.FileSystemRoot))
     throw new ConfigurationDataException(ConfigurationDataType.FileSystemRoot);
   var fsProvider = new FileSystemProvider(configurationProvider.ConnectionStrings[ConfigurationDataType.FileSystemRoot],
                                           configurationProvider.GetFileSystemEngineRules());
   var regProvider = new RegistryProvider(syncBus);
   engine._hookManager.RegisterHookProvider(new FileSystemHookProvider(fsProvider));
   engine._hookManager.RegisterHookProvider(new RegistryHookProvider(regProvider));
   return engine;
 }