MCPcopy Create free account
hub / github.com/BeneficialCode/WinArk / NtSetInformationDebugObject

Function NtSetInformationDebugObject

KernelLibrary/kDbgSys.cpp:1943–2021  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1941}
1942
1943NTSTATUS NtSetInformationDebugObject(
1944 _In_ HANDLE DebugObjectHandle,
1945 _In_ DEBUG_OBJECT_INFORMATION_CLASS DebugObjectInformationClass,
1946 _In_ PVOID DebugInformation,
1947 _In_ ULONG DebugInformationLength,
1948 _Out_opt_ PULONG ReturnLength
1949) {
1950 KPROCESSOR_MODE PreviousMode;
1951 ULONG Flags;
1952 NTSTATUS status;
1953 PDEBUG_OBJECT DebugObject;
1954
1955 PreviousMode = ExGetPreviousMode();
1956
1957 __try {
1958 if (PreviousMode != KernelMode) {
1959 if (DebugInformationLength) {
1960 ProbeForRead(DebugInformation, DebugInformationLength,
1961 sizeof(ULONG));
1962 if (ARGUMENT_PRESENT(ReturnLength)) {
1963 ProbeForWriteUlong(ReturnLength);
1964 }
1965 }
1966 }
1967 if (ARGUMENT_PRESENT(ReturnLength)) {
1968 *ReturnLength = 0;
1969 }
1970
1971 switch (DebugObjectInformationClass) {
1972 case DebugObjectFlagsInformation:
1973 {
1974 if (DebugInformationLength != sizeof(ULONG)) {
1975 if (ARGUMENT_PRESENT(ReturnLength)) {
1976 *ReturnLength = sizeof(ULONG);
1977 }
1978 return STATUS_INFO_LENGTH_MISMATCH;
1979 }
1980 Flags = *(PULONG)DebugInformation;
1981
1982 break;
1983 }
1984 default:
1985 return STATUS_INVALID_PARAMETER;
1986 }
1987 }
1988 __except (EXCEPTION_EXECUTE_HANDLER) {
1989 return GetExceptionCode();
1990 }
1991
1992 switch (DebugObjectInformationClass)
1993 {
1994 case DebugObjectFlagsInformation:
1995 {
1996 if (Flags & ~DEBUG_KILL_ON_CLOSE) {
1997 return STATUS_INVALID_PARAMETER;
1998 }
1999 status = ObReferenceObjectByHandle(DebugObjectHandle,
2000 DEBUG_OBJECT_SET_INFORMATION,

Callers

nothing calls this directly

Calls 1

ProbeForWriteUlongFunction · 0.85

Tested by

no test coverage detected