コード例 #1
0
        public static bool AdjustTokenPrivileges(IntPtr TokenHandle, bool DisableAllPrivileges, out TokenPrivileges NewState, int BufferLength, out TokenPrivileges PreviousState, out int ReturnLength, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_AdjustTokenPrivileges(TokenHandle, DisableAllPrivileges, out NewState, BufferLength, out PreviousState, out ReturnLength));
            }

            bool             returnValue = PInvoke_AdjustTokenPrivileges(TokenHandle, DisableAllPrivileges, out NewState, BufferLength, out PreviousState, out ReturnLength);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(AdjustTokenPrivileges),
                callerName,
                returnValue,
                false,
                nameof(TokenHandle), TokenHandle,
                nameof(DisableAllPrivileges), DisableAllPrivileges,
                nameof(NewState), NewState,
                nameof(BufferLength), BufferLength,
                nameof(PreviousState), PreviousState,
                nameof(ReturnLength), ReturnLength
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="hProcess"></param>
        /// <param name="lpThreadAttributes"></param>
        /// <param name="dwStackSize"></param>
        /// <param name="lpStartAddress"></param>
        /// <param name="lpParameter"></param>
        /// <param name="dwCreationFlags"></param>
        /// <param name="lpThreadId"></param>
        /// <returns></returns>
        public static IntPtr CreateRemoteThread(IntPtr hProcess, IntPtr lpThreadAttributes, int dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, int dwCreationFlags, IntPtr lpThreadId, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_CreateRemoteThread(hProcess, lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId));
            }

            IntPtr           returnValue = PInvoke_CreateRemoteThread(hProcess, lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(CreateRemoteThread),
                callerName,
                returnValue,
                IntPtr.Zero,
                nameof(hProcess), hProcess,
                nameof(lpThreadAttributes), lpThreadAttributes,
                nameof(dwStackSize), dwStackSize,
                nameof(lpStartAddress), lpStartAddress,
                nameof(lpParameter), lpParameter,
                nameof(dwCreationFlags), dwCreationFlags,
                nameof(lpThreadId), lpThreadId
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #3
0
        public static bool LookupAccountSid(string lpSystemName, IntPtr Sid, string Name, out int cchName, string ReferencedDomainName, out int cchReferencedDomainName, out SidNameUse peUse, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_LookupAccountSid(lpSystemName, Sid, Name, out cchName, ReferencedDomainName, out cchReferencedDomainName, out peUse));
            }

            bool             returnValue = PInvoke_LookupAccountSid(lpSystemName, Sid, Name, out cchName, ReferencedDomainName, out cchReferencedDomainName, out peUse);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(LookupAccountSid),
                callerName,
                returnValue,
                false,
                nameof(lpSystemName), lpSystemName,
                nameof(Sid), Sid,
                nameof(Name), Name,
                nameof(cchName), cchName,
                nameof(ReferencedDomainName), ReferencedDomainName,
                nameof(cchReferencedDomainName), cchReferencedDomainName,
                nameof(peUse), peUse
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="lpApplicationName"></param>
        /// <param name="lpCommandLine"></param>
        /// <param name="lpProcessAttributes"></param>
        /// <param name="lpThreadAttributes"></param>
        /// <param name="bInheritHandle"></param>
        /// <param name="dwCreationFlags"></param>
        /// <param name="lpEnvironment"></param>
        /// <param name="lpCurrentDirectory"></param>
        /// <param name="lpStartupInfo"></param>
        /// <param name="lpProcessInformation"></param>
        /// <returns></returns>
        public static bool CreateProcess(string lpApplicationName, string lpCommandLine, IntPtr lpProcessAttributes, IntPtr lpThreadAttributes, bool bInheritHandle, int dwCreationFlags, IntPtr lpEnvironment, string lpCurrentDirectory, IntPtr lpStartupInfo, IntPtr lpProcessInformation, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_CreateProcess(lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandle, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation));
            }

            bool             returnValue = PInvoke_CreateProcess(lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandle, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(CreateProcess),
                callerName,
                returnValue,
                false,
                nameof(lpApplicationName), lpApplicationName,
                nameof(lpCommandLine), lpCommandLine,
                nameof(lpProcessAttributes), lpProcessAttributes,
                nameof(lpThreadAttributes), lpThreadAttributes,
                nameof(bInheritHandle), bInheritHandle,
                nameof(dwCreationFlags), dwCreationFlags,
                nameof(lpEnvironment), lpEnvironment,
                nameof(lpCurrentDirectory), lpCurrentDirectory,
                nameof(lpStartupInfo), lpStartupInfo,
                nameof(lpProcessInformation), lpProcessInformation
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static bool FreeConsole([CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_FreeConsole());
            }

            bool             returnValue = PInvoke_FreeConsole();
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(FreeConsole),
                callerName,
                returnValue,
                false
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ProcessHandle"></param>
        /// <param name="BaseAddress"></param>
        /// <param name="InfoClass"></param>
        /// <param name="Info"></param>
        /// <param name="InfoLength"></param>
        /// <param name="ReturnLength"></param>
        /// <returns></returns>
        public static NTSTATUS NtClose(IntPtr Handle, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_NtClose(Handle));
            }

            NTSTATUS         returnValue = PInvoke_NtClose(Handle);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(NtClose),
                callerName,
                returnValue,
                nameof(Handle), Handle
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="lpModuleName"></param>
        /// <returns></returns>
        public static IntPtr GetModuleHandle(string lpModuleName, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_GetModuleHandle(lpModuleName));
            }

            IntPtr           returnValue = PInvoke_GetModuleHandle(lpModuleName);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(GetModuleHandle),
                callerName,
                returnValue,
                IntPtr.Zero,
                nameof(lpModuleName), lpModuleName
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #8
0
        public static bool EmptyWorkingSet(IntPtr hProcess, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_EmptyWorkingSet(hProcess));
            }

            bool             returnValue = PInvoke_EmptyWorkingSet(hProcess);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(EmptyWorkingSet),
                callerName,
                returnValue,
                false,
                nameof(hProcess), hProcess
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="lpOutputString"></param>
        public static void OutputDebugString(string lpOutputString, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                PInvoke_OutputDebugString(lpOutputString);
                return;
            }

            PInvoke_OutputDebugString(lpOutputString);
            PInvokeDebugInfo debugInfo = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(GetSystemDirectory),
                callerName,
                null,
                null,
                nameof(lpOutputString), lpOutputString
                );

            PInvokeDebugger.SafeCapture(debugInfo);
        }
コード例 #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="hObject"></param>
        /// <returns></returns>
        public static bool CloseHandle(IntPtr hObject, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_CloseHandle(hObject));
            }

            bool             returnValue = PInvoke_CloseHandle(hObject);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(CloseHandle),
                callerName,
                returnValue,
                true,
                nameof(hObject), hObject
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dwProcessId"></param>
        /// <returns></returns>
        public static bool AttachConsole(int dwProcessId, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_AttachConsole(dwProcessId));
            }

            bool             returnValue = PInvoke_AttachConsole(dwProcessId);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(AttachConsole),
                callerName,
                returnValue,
                false,
                nameof(dwProcessId), dwProcessId
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="hLibModule"></param>
        /// <returns></returns>
        public static bool FreeLibrary(IntPtr hLibModule, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_FreeLibrary(hLibModule));
            }

            bool             returnValue = PInvoke_FreeLibrary(hLibModule);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(FreeLibrary),
                callerName,
                returnValue,
                IntPtr.Zero,
                nameof(hLibModule), hLibModule
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="LinkHandle"></param>
        /// <param name="LinkTarget"></param>
        /// <param name="ReturnLength"></param>
        /// <returns></returns>
        public static NTSTATUS NtOpenSymbolicLinkObject(IntPtr LinkHandle, AccessMask Access, IntPtr ObjectAttributes, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_NtOpenSymbolicLinkObject(LinkHandle, Access, ObjectAttributes));
            }

            NTSTATUS         returnValue = PInvoke_NtOpenSymbolicLinkObject(LinkHandle, Access, ObjectAttributes);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(NtOpenSymbolicLinkObject),
                callerName,
                returnValue,
                nameof(LinkHandle), LinkHandle,
                nameof(Access), Access,
                nameof(ObjectAttributes), ObjectAttributes
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="lpBuffer"></param>
        /// <param name="uSize"></param>
        /// <returns></returns>
        public static int GetWindowsDirectory(StringBuilder lpBuffer, int uSize, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_GetWindowsDirectory(lpBuffer, uSize));
            }

            int returnValue            = PInvoke_GetWindowsDirectory(lpBuffer, uSize);
            PInvokeDebugInfo debugInfo = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(GetWindowsDirectory),
                callerName,
                returnValue,
                0,
                nameof(lpBuffer), lpBuffer,
                nameof(uSize), uSize
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="hSnapshot"></param>
        /// <param name="pe32"></param>
        /// <returns></returns>
        public static bool Process32First(IntPtr hSnapshot, ref ProcessEntry32 pe32, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_Process32First(hSnapshot, ref pe32));
            }

            bool             returnValue = PInvoke_Process32First(hSnapshot, ref pe32);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(Process32First),
                callerName,
                returnValue,
                false,
                nameof(hSnapshot), hSnapshot,
                nameof(pe32), pe32
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="hProcess"></param>
        /// <param name="bIs64WowProcess"></param>
        /// <returns></returns>
        public static bool IsWow64Process(IntPtr hProcess, out bool bIs64WowProcess, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_IsWow64Process(hProcess, out bIs64WowProcess));
            }

            bool             returnValue = PInvoke_IsWow64Process(hProcess, out bIs64WowProcess);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(IsWow64Process),
                callerName,
                returnValue,
                false,
                nameof(hProcess), hProcess,
                nameof(bIs64WowProcess), bIs64WowProcess
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="LinkHandle"></param>
        /// <param name="LinkTarget"></param>
        /// <param name="ReturnLength"></param>
        /// <returns></returns>
        public static NTSTATUS NtQuerySymbolicLinkObject(IntPtr LinkHandle, IntPtr LinkTarget, out uint ReturnLength, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_NtQuerySymbolicLinkObject(LinkHandle, LinkTarget, out ReturnLength));
            }

            NTSTATUS         returnValue = PInvoke_NtQuerySymbolicLinkObject(LinkHandle, LinkTarget, out ReturnLength);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(NtQuerySymbolicLinkObject),
                callerName,
                returnValue,
                nameof(LinkHandle), LinkHandle,
                nameof(LinkTarget), LinkTarget,
                nameof(ReturnLength), ReturnLength
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #18
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="hProcess"></param>
        /// <param name="dwExitCode"></param>
        /// <returns></returns>
        public static bool TerminateProcess(IntPtr hProcess, int dwExitCode, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_TerminateProcess(hProcess, dwExitCode));
            }

            bool             returnValue = PInvoke_TerminateProcess(hProcess, dwExitCode);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(TerminateProcess),
                callerName,
                returnValue,
                false,
                nameof(hProcess), hProcess,
                nameof(dwExitCode), dwExitCode
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dwFlags"></param>
        /// <param name="dwProcessId"></param>
        /// <returns></returns>
        public static IntPtr CreateToolhelp32Snapshot(SnapshotFlags dwFlags, int dwProcessId, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_CreateToolhelp32Snapshot(dwFlags, dwProcessId));
            }

            IntPtr           returnValue = PInvoke_CreateToolhelp32Snapshot(dwFlags, dwProcessId);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(CreateToolhelp32Snapshot),
                callerName,
                returnValue,
                IntPtr.Zero,
                nameof(dwFlags), dwFlags,
                nameof(dwProcessId), dwProcessId
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #20
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="hObject"></param>
        /// <param name="dwMilliseconds"></param>
        /// <returns></returns>
        public static WaitResult WaitForSingleObject(IntPtr hObject, int dwMilliseconds, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_WaitForSingleObject(hObject, dwMilliseconds));
            }

            WaitResult       returnValue = PInvoke_WaitForSingleObject(hObject, dwMilliseconds);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(WaitForSingleObject),
                callerName,
                returnValue,
                WaitResult.Failed,
                nameof(hObject), hObject,
                nameof(dwMilliseconds), dwMilliseconds
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #21
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="hModule"></param>
        /// <param name="lpProcedureName"></param>
        /// <returns></returns>
        public static IntPtr GetProcAddress(IntPtr hModule, string lpProcedureName, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_GetProcAddress(hModule, lpProcedureName));
            }

            IntPtr           returnValue = PInvoke_GetProcAddress(hModule, lpProcedureName);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(GetProcAddress),
                callerName,
                returnValue,
                IntPtr.Zero,
                nameof(hModule), hModule,
                nameof(lpProcedureName), lpProcedureName
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #22
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="hSnapshot"></param>
        /// <param name="me32"></param>
        /// <returns></returns>
        public static bool Module32Next(IntPtr hSnapshot, ref ModuleEntry32 me32, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_Module32Next(hSnapshot, ref me32));
            }

            bool             returnValue = PInvoke_Module32Next(hSnapshot, ref me32);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(Module32Next),
                callerName,
                returnValue,
                false,
                nameof(hSnapshot), hSnapshot,
                nameof(me32), me32
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #23
0
        public static bool LookupPrivilegeValue(string lpSystemName, string lpName, out Luid Luid, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_LookupPrivilegeValue(lpSystemName, lpName, out Luid));
            }

            bool             returnValue = PInvoke_LookupPrivilegeValue(lpSystemName, lpName, out Luid);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(LookupPrivilegeValue),
                callerName,
                returnValue,
                false,
                nameof(lpSystemName), lpSystemName,
                nameof(lpName), lpName,
                nameof(Luid), Luid
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #24
0
        public static bool OpenProcessToken(IntPtr ProcessHandle, TokenAccess Access, out IntPtr TokenHandle, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_OpenProcessToken(ProcessHandle, Access, out TokenHandle));
            }

            bool             returnValue = PInvoke_OpenProcessToken(ProcessHandle, Access, out TokenHandle);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(OpenProcessToken),
                callerName,
                returnValue,
                false,
                nameof(ProcessHandle), ProcessHandle,
                nameof(Access), Access,
                nameof(TokenHandle), TokenHandle
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #25
0
        public static int GetProcessImageFileName(IntPtr hProcess, StringBuilder lpImageFileName, int nSize, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_GetProcessImageFileName(hProcess, lpImageFileName, nSize));
            }

            int returnValue            = PInvoke_GetProcessImageFileName(hProcess, lpImageFileName, nSize);
            PInvokeDebugInfo debugInfo = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(GetProcessImageFileName),
                callerName,
                returnValue,
                0,
                nameof(hProcess), hProcess,
                nameof(lpImageFileName), lpImageFileName,
                nameof(nSize), nSize
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #26
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ProcessHandle"></param>
        /// <param name="Access"></param>
        /// <param name="ObjectAttributes"></param>
        /// <param name="Cid"></param>
        /// <returns></returns>
        public static NTSTATUS NtOpenProcess(ref IntPtr ProcessHandle, ProcessAccess Access, ref ObjectAttributes ObjectAttributes, ref ClientId Cid, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_NtOpenProcess(ref ProcessHandle, Access, ref ObjectAttributes, ref Cid));
            }

            NTSTATUS         returnValue = PInvoke_NtOpenProcess(ref ProcessHandle, Access, ref ObjectAttributes, ref Cid);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(NtOpenProcess),
                callerName,
                returnValue,
                nameof(ProcessHandle), ProcessHandle,
                nameof(Access), Access,
                nameof(ObjectAttributes), ObjectAttributes,
                nameof(Cid), Cid
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #27
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="InfoClass"></param>
        /// <param name="Info"></param>
        /// <param name="InfoLength"></param>
        /// <param name="ReturnLength"></param>
        /// <returns></returns>
        public static NTSTATUS NtQuerySystemInformation(SystemInformationClass InfoClass, IntPtr Info, uint InfoLength, out uint ReturnLength, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_NtQuerySystemInformation(InfoClass, Info, InfoLength, out ReturnLength));
            }

            NTSTATUS         returnValue = PInvoke_NtQuerySystemInformation(InfoClass, Info, InfoLength, out ReturnLength);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(NtQuerySystemInformation),
                callerName,
                returnValue,
                nameof(InfoClass), InfoClass,
                nameof(Info), Info,
                nameof(InfoLength), InfoLength,
                nameof(ReturnLength), ReturnLength
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #28
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="lpDeviceName"></param>
        /// <param name="lpTargetPath"></param>
        /// <param name="ucchMax"></param>
        /// <returns></returns>
        public static int QueryDosDevice(string lpDeviceName, string lpTargetPath, int ucchMax, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_QueryDosDevice(lpDeviceName, lpTargetPath, ucchMax));
            }

            int returnValue            = PInvoke_QueryDosDevice(lpDeviceName, lpTargetPath, ucchMax);
            PInvokeDebugInfo debugInfo = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(QueryDosDevice),
                callerName,
                returnValue,
                0,
                nameof(lpDeviceName), lpDeviceName,
                nameof(lpTargetPath), lpTargetPath,
                nameof(ucchMax), ucchMax
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #29
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dwAccess"></param>
        /// <param name="bInherit"></param>
        /// <param name="dwProcessId"></param>
        /// <returns></returns>
        public static IntPtr OpenProcess(ProcessAccess dwAccess, bool bInherit, int dwProcessId, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_OpenProcess(dwAccess, bInherit, dwProcessId));
            }

            IntPtr           returnValue = PInvoke_OpenProcess(dwAccess, bInherit, dwProcessId);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(OpenProcess),
                callerName,
                returnValue,
                IntPtr.Zero,
                nameof(dwAccess), dwAccess,
                nameof(bInherit), bInherit,
                nameof(dwProcessId), dwProcessId
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }
コード例 #30
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="hProcess"></param>
        /// <param name="lpBaseAddress"></param>
        /// <param name="dwSize"></param>
        /// <param name="flFreeType"></param>
        /// <returns></returns>
        public static bool VirtualFreeEx(IntPtr hProcess, IntPtr lpBaseAddress, int dwSize, MemoryAllocationTypes flFreeType, [CallerMemberName] string callerName = "")
        {
            if (!PInvokeDebugger.LoggingEnabled)
            {
                return(PInvoke_VirtualFreeEx(hProcess, lpBaseAddress, dwSize, flFreeType));
            }

            bool             returnValue = PInvoke_VirtualFreeEx(hProcess, lpBaseAddress, dwSize, flFreeType);
            PInvokeDebugInfo debugInfo   = PInvokeDebugInfo.TraceDebugInfo(
                ModuleName,
                nameof(VirtualFreeEx),
                callerName,
                returnValue,
                false,
                nameof(hProcess), hProcess,
                nameof(lpBaseAddress), lpBaseAddress,
                nameof(dwSize), dwSize,
                nameof(flFreeType), flFreeType
                );

            PInvokeDebugger.SafeCapture(debugInfo);
            return(returnValue);
        }