示例#1
0
 internal static extern IntPtr PInvoke_VirtualAllocEx(IntPtr hProcess, IntPtr lpBaseAddress, int dwSize, MemoryAllocationTypes flAllocationType, MemoryProtections flProtect);
示例#2
0
 internal static extern bool PInvoke_VirtualProtectEx(IntPtr hProcess, IntPtr lpBaseAddress, int dwSize, MemoryProtections flNewProtect, out MemoryProtections lpflOldProtect);
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="hProcess"></param>
        /// <param name="lpBaseAddress"></param>
        /// <param name="dwSize"></param>
        /// <param name="flAllocationType"></param>
        /// <param name="flProtect"></param>
        /// <returns></returns>
        public static IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr lpBaseAddress, int dwSize, MemoryAllocationTypes flAllocationType, MemoryProtections flProtect, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_VirtualAllocEx(hProcess, lpBaseAddress, dwSize, flAllocationType, flProtect));
            }

            IntPtr           returnValue = PInvoke_VirtualAllocEx(hProcess, lpBaseAddress, dwSize, flAllocationType, flProtect);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(VirtualAllocEx),
                callerName,
                returnValue,
                IntPtr.Zero,
                nameof(hProcess), hProcess,
                nameof(lpBaseAddress), lpBaseAddress,
                nameof(dwSize), dwSize,
                nameof(flAllocationType), flAllocationType,
                nameof(flProtect), flProtect
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
示例#4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="hProcess"></param>
        /// <param name="lpBaseAddress"></param>
        /// <param name="dwSize"></param>
        /// <param name="flNewProtect"></param>
        /// <param name="lpflOldProtect"></param>
        /// <returns></returns>
        public static bool VirtualProtectEx(IntPtr hProcess, IntPtr lpBaseAddress, int dwSize, MemoryProtections flNewProtect, out MemoryProtections lpflOldProtect, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_VirtualProtectEx(hProcess, lpBaseAddress, dwSize, flNewProtect, out lpflOldProtect));
            }

            bool             returnValue = PInvoke_VirtualProtectEx(hProcess, lpBaseAddress, dwSize, flNewProtect, out lpflOldProtect);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(VirtualProtectEx),
                callerName,
                returnValue,
                false,
                nameof(hProcess), hProcess,
                nameof(lpBaseAddress), lpBaseAddress,
                nameof(dwSize), dwSize,
                nameof(flNewProtect), flNewProtect,
                nameof(lpflOldProtect), lpflOldProtect
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
示例#5
0
 internal static extern NTSTATUS PInvoke_NtProtectVirtualMemory(IntPtr ProcessHandle, IntPtr BaseAddress, uint Length, MemoryProtections NewProtection, out MemoryProtections OldProtection);
示例#6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ProcessHandle"></param>
        /// <param name="BaseAddress"></param>
        /// <param name="Length"></param>
        /// <param name="NewProtection"></param>
        /// <param name="OldProtection"></param>
        /// <returns></returns>
        public static NTSTATUS NtProtectVirtualMemory(IntPtr ProcessHandle, IntPtr BaseAddress, uint Length, MemoryProtections NewProtection, out MemoryProtections OldProtection, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_NtProtectVirtualMemory(ProcessHandle, BaseAddress, Length, NewProtection, out OldProtection));
            }

            NTSTATUS         returnValue = PInvoke_NtProtectVirtualMemory(ProcessHandle, BaseAddress, Length, NewProtection, out OldProtection);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(NtProtectVirtualMemory),
                callerName,
                returnValue,
                nameof(ProcessHandle), ProcessHandle,
                nameof(BaseAddress), BaseAddress,
                nameof(Length), Length,
                nameof(NewProtection), NewProtection,
                nameof(OldProtection), OldProtection
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
示例#7
0
 internal static extern IntPtr VirtualAlloc(
     IntPtr lpAddress,
     UIntPtr dwSize,
     AllocationTypes flAllocationType,
     MemoryProtections flProtect);
示例#8
0
 public static extern bool VirtualProtectEx(IntPtr hProcess, IntPtr lpAddress,
                                            IntPtr dwSize, MemoryProtections flNewProtect, out MemoryProtections lpflOldProtect);
示例#9
0
 public static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, IntPtr dwSize, AllocationTypes flAllocationTypes, MemoryProtections flProtect);