|
| 1 | +# KdNet Remote Desktop |
| 2 | +> This method is intended for early-stage debugging. You can connect to the target device's Windows remote desktop via KdNet to test touch, USB, etc. |
| 3 | +> References and tutorials adapted from the [WOA Project](https://github.com/WOA-Project/). |
| 4 | +
|
| 5 | +## Preparation |
| 6 | + - A device that has just had Windows deployed and has not been booted yet. |
| 7 | + - The ESP partition's ESP FLAG must have been set correctly before deploying Windows. |
| 8 | + - The phone is currently in Mass Storage Mode and connected to the PC. |
| 9 | + - You have read the [KDNET setup guide](/WindowsDebug/SetupKDNET.md) and performed the full procedure at least once. |
| 10 | + - Download `unattend.xml` from [unattend.xml](/WindowsDebug/KdNetRDP/unattend.xml). |
| 11 | + |
| 12 | +:::warning Note |
| 13 | + The unattended file only takes effect on the first boot. Make sure you have just finished deploying the system and installed drivers. |
| 14 | + - For installing Windows see [Windows installation summary](/InstallationGuides/WindowsInstallation.md). |
| 15 | + - For driver installation see [Install Drivers](/InstallationGuides/InstallDrivers.md). |
| 16 | +::: |
| 17 | + |
| 18 | +## Configure Unattended Setup |
| 19 | + - Open File Explorer and locate the system drive of the phone. |
| 20 | + - Enter `\Windows\Panther\`. |
| 21 | + - Copy the `unattend.xml` you downloaded into this folder. |
| 22 | + + Optional: you can modify the `LocalUser` in `unattend.xml` to change the created username. |
| 23 | + - Eject the disk and reboot the phone, then boot into UEFI. |
| 24 | + - Wait for the system to boot. The normal flow is: |
| 25 | + + Spinning wheel -> Getting devices ready -> Ready -> Automatic reboot |
| 26 | + - After the automatic reboot, boot UEFI again. The normal flow is: |
| 27 | + + Spinning wheel -> OOBE -> Enter desktop as user `LocalUser` |
| 28 | + - Note both steps are automated; you only need to boot UEFI twice. |
| 29 | + - If on first boot you see a "Windows could not complete the installation... click OK to restart" message, check the ESP FLAG and reinstall Windows if necessary. |
| 30 | + |
| 31 | +## Windbg Connection |
| 32 | + - Follow the KDNET setup steps in [SetupKDNET](/WindowsDebug/SetupKDNET.md#setup-bcd) to configure KDNET and connect. |
| 33 | + + If the debugger auto-breaks, click `Go` in the top-left of Windbg or type `g` and press Enter in the command line. |
| 34 | + - After the phone boots into Windows, click the `Break` button in the top-left of Windbg. In the command line area enter `!process 0 1` and press Enter, then wait for the output to finish. |
| 35 | + - Pick any process, click the blue data link after `Peb`, Windbg will execute the command and dump a lot of data. |
| 36 | +  |
| 37 | + - In the output find `USERDOMAIN` and copy the value after it. It is usually like `PHONE-XXXXX` or `DESKTOP-XXXX`. |
| 38 | +  |
| 39 | +:::tip |
| 40 | +If the selected Peb output does not contain `USERDOMAIN`, try another process's Peb. |
| 41 | +::: |
| 42 | + |
| 43 | +## RDP Connection |
| 44 | + - Open the built-in Windows Remote Desktop tool (`Remote Desktop Connection`). You can search it in the Start menu or press `Win+R` and run `mstsc`. |
| 45 | + - Enter the `USERDOMAIN` you copied in the `Computer` field and click Connect. |
| 46 | +  |
| 47 | + - The username is `LocalUser`, or whatever you set in `unattend.xml`. |
| 48 | + - There is no password; enter the username and connect. If you are warned about a certificate, ignore/accept it. |
| 49 | + - If Remote Desktop connects successfully, the setup is complete — start your debugging session! |
| 50 | +  |
| 51 | + |
| 52 | +## References |
| 53 | + - [MSDN: Answer file (unattend.xml)](https://learn.microsoft.com/zh-cn/windows-hardware/manufacture/desktop/update-windows-settings-and-scripts-create-your-own-answer-file-sxs) |
0 commit comments