//---------------------------------------------------------------------------- // // Copyright (c) Intel Corporation, 2011 All Rights Reserved. // //---------------------------------------------------------------------------- using System; using System.IO; using System.Runtime.InteropServices; using Common.Utils; using Intel.Manageability; using Intel.Manageability.Exceptions; namespace AgentPresenceLocalSample { class Program { [DllImport("kernel32.dll", CallingConvention = CallingConvention.StdCall)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool SetDefaultDllDirectories(int directoryFlags); static void Main(string[] args) { // set default dll lookup directory to system SetDefaultDllDirectories(0x00000800); //LOAD_LIBRARY_SEARCH_SYSTEM32 IAMTInstance amt = null; ConnectionInfoEX ci = null; try { // Check if JSON path was provided as an argument. If not, default path would be used. try { ci = ProgramInput.DeserializeJsonToStruct(args.Length > 0 ? args[0] : null); } catch (IOException e) { Console.WriteLine($"Could not read argument file: {e.Message}"); return; } amt = AMTInstanceFactory.CreateEX(ci); } catch (ManageabilityException e) { Console.WriteLine(e.Message); return; } // Start Presence. AgentPresenceLocalFunctionality.Start(amt, "MyAgent"); Console.WriteLine("Press enter to stop the agent"); Console.ReadLine(); // Shutdown Presence. AgentPresenceLocalFunctionality.Shutdown(amt, "MyAgent"); } } }