| 940 | } |
| 941 | |
| 942 | VOID DbgkMapViewOfSection( |
| 943 | _In_ PVOID SectionObject, |
| 944 | _In_ PVOID BaseAddress, |
| 945 | _In_ PEPROCESS Process |
| 946 | ) { |
| 947 | //PTEB Teb; |
| 948 | HANDLE hFile = nullptr; |
| 949 | DBGKM_APIMSG ApiMsg; |
| 950 | PEPROCESS CurrentProcess; |
| 951 | PETHREAD CurrentThread; |
| 952 | PIMAGE_NT_HEADERS pImageHeader; |
| 953 | PEPROCESS process = Process; |
| 954 | |
| 955 | CurrentProcess = PsGetCurrentProcess(); |
| 956 | CurrentThread = PsGetCurrentThread(); |
| 957 | |
| 958 | //if (ExGetPreviousMode() == KernelMode || |
| 959 | // (CurrentThread->CrossThreadFlags & PS_CROSS_THREAD_FLAGS_HIDEFROMDBG) || |
| 960 | // process->DebugPort == nullptr) { |
| 961 | // return; |
| 962 | //} |
| 963 | |
| 964 | /*if (CurrentThread->Tcb.ApcStateIndex != 0x1) { |
| 965 | Teb = (PTEB)CurrentThread->Tcb.Teb; |
| 966 | } |
| 967 | else { |
| 968 | Teb = nullptr; |
| 969 | }*/ |
| 970 | |
| 971 | /*if (Teb != nullptr && Process == (PEPROCESS)CurrentProcess) { |
| 972 | if (!DbgkpSuppressDbgMsg(Teb)) { |
| 973 | ApiMsg.u.LoadDll.NamePointer = Teb->NtTib.ArbitraryUserPointer; |
| 974 | } |
| 975 | else { |
| 976 | return; |
| 977 | } |
| 978 | } |
| 979 | else { |
| 980 | ApiMsg.u.LoadDll.NamePointer = nullptr; |
| 981 | }*/ |
| 982 | |
| 983 | hFile = DbgkpSectionToFileHandle(SectionObject); |
| 984 | ApiMsg.u.LoadDll.FileHandle = hFile; |
| 985 | ApiMsg.u.LoadDll.BaseOfDll = BaseAddress; |
| 986 | ApiMsg.u.LoadDll.DebugInfoFileOffset = 0; |
| 987 | ApiMsg.u.LoadDll.DebugInfoSize = 0; |
| 988 | |
| 989 | __try{ |
| 990 | pImageHeader = RtlImageNtHeader(BaseAddress); |
| 991 | if (pImageHeader != nullptr) { |
| 992 | ApiMsg.u.LoadDll.DebugInfoFileOffset = pImageHeader->FileHeader.PointerToSymbolTable; |
| 993 | ApiMsg.u.LoadDll.DebugInfoSize = pImageHeader->FileHeader.NumberOfSections; |
| 994 | } |
| 995 | } |
| 996 | __except (EXCEPTION_EXECUTE_HANDLER){ |
| 997 | ApiMsg.u.LoadDll.DebugInfoFileOffset = 0; |
| 998 | ApiMsg.u.LoadDll.DebugInfoSize = 0; |
| 999 | ApiMsg.u.LoadDll.NamePointer = nullptr; |
nothing calls this directly
no test coverage detected