Exemple #1
0
        public static MemoryMappedFile WriteToFile(string fileName, HookInfo info)
        {
            var mmf = MemoryMappedFile.CreateNew(fileName, ItemSize * (2 + info.MessagesToHook.Length));
            var mmv = mmf.CreateViewAccessor();
            byte* buffer = null;
            mmv.SafeMemoryMappedViewHandle.AcquirePointer(ref buffer);
            int* target = (int*)buffer;

            WriteInt(ref target, info.ProcessId);
            WriteArray(ref target, info.MessagesToHook);

            mmv.Dispose();
            return mmf;
        }
Exemple #2
0
 private MemoryMappedFile WriteSettings()
 {
     HookInfo inf = new HookInfo();
     inf.ProcessId = System.Diagnostics.Process.GetCurrentProcess().Id;
     inf.MessagesToHook = _handles.SelectMany(h => h.Value.HadledMessages).Cast<int>().ToArray();
     return HookInfoSerializator.WriteToFile(SettingFileName, inf);
 }
Exemple #3
0
        private static MemoryMappedFile WriteSettings()
        {
            const string SettingFileName = "HookMmfSettings";

            HookInfo inf = new HookInfo();
            inf.ProcessId = 0; // System.Diagnostics.Process.GetCurrentProcess().Id;
            inf.MessagesToHook = new[]{
                (int)WinApi.Messages.WM_COPYDATA,
                (int)WinApi.Messages.WM_KEYDOWN
            };
            return HookInfoSerializator.WriteToFile(SettingFileName, inf);
        }