본문 바로가기

Debugging/Windows

(15)
!ndiskd.pendingnbls Pending되어 있는 NBL을 확인하기 위해서는 ndiskd extension을 사용할 수 있습니다. 0: kd> !ndiskd.pendingnbls This command requires NBL tracking to be enabled on the debugee target machine. (By default, client operating systems have level 2, and servers have level 0). To enable, set this REG_DWORD value to a nonzero value on the target machine and reboot the target machine: HKLM\SYSTEM\CurrentControlSet\Services\NDIS\Pa..
!mex.us 원하는 모듈명이나 함수명을 이용하여 전체 Thread의 Call Stack을 조사하고자 할 때, "!mex.us" 를 이용할 수 있습니다. 0: kd> !mex.us -help !UniqueStacks (!us) - Like the built-in !uniqstacks except it associates thread IDs with the stack traces Usage: !UniqueStacks [-a] [-c] [-cpu] [-crash] [-d ] [-f ] [-3] [-i] [-k] [-s ] [-l] [-m] [-max ] [-nw] [-w] [-p ] [-state ] [-wr ] [-q] [-r] [-t ] [-e ] [] -a : (Kernel Only) Scans all process..
2. Testing a Sample Driver 1. Sample Driver 작성 Visual Studio를 실행(Visual Studio를 관리자 권한으로 실행해야 Cryptographic Exception 이 발생하지 않음)하고, Empty WDM Driver 프로젝트 생성 프로젝트 > Driver Files 폴더에 있는 sample.inf 파일 제거 프로젝트 선택 -> 속성 -> C/C++ -> Code Generation -> Sepctre Mitigation을 Disabled로 변경하고 다시 Build Sample Code #include NTSTATUS DriverEntry(PDRIVER_OBJECT pDrvObj, PUNICODE_STRING pRegistryPath) { pDrvObj = pDrvObj; pRegistryPath = p..
1.Configuring the remote debugging with a virtual machine 1. VM(Target) 내의 Windows Guest OS에서 Debug Mode 설정 시작 > 실행 > msconfig Boot 탭 > Advanced Options > Debug 선택, Debug port는 COM1 선택, Baud rate는 115200 선택(재부팅 하지 말고) 명령 프롬프트 관리자 권한 실행 bcdedit /set testsigning on 명령어 실행 재부팅 2. Host 에서 Symbol 폴더 생성 C:\Sym 폴더와 C:\Sym\WebSym 폴더 생성 C:\Sym 폴더는 개인적으로 Build한 코드의 symbol 저장 용도 C:\Sym\WebSym 폴더는 Windows public symbol 저장 용도 3. Host 에서 Debugger 설정 시작 > Windows Kit..
0.Setting up an environment for debugging # Windows 10 기준 Step 1: Install Visual Studio 2019 Desktop Development with C++ 선택하고 Optional에서 전부 선택 (Visual Studio가 종료된 것을 확인하고!!) Step 2. 별도로 SDK 설치(Windows 10 SDK, 버전 2004(10.0.19041.0)) https://go.microsoft.com/fwlink/?linkid=2120843 Step 3. 별도로 WDK 설치(windows 10 WDK for Windows 10 version 2004) https://go.microsoft.com/fwlink/?linkid=2128854 마지막에 Extension도 설치해야 함 # Visual Studio에서 driver ..