Reference article:
1, http://www.abin.cn/?p=263
2, HTTPS://SUPPORT.MICROSOFT.COM/ZH-CN/KB/824344/ZH-CN
Step 1:
Method One: Use the WinDbg global flag to set the command Gflags.exe settings, the image file in the dialog box to set the name of the service to debug, debugger Select the path to set the debugger; (Note: I'm actually working on it, This place is set debugger when a write registry error occurs, uninstalling the 360 software solves the problem. )
Method Two: Use Registry Editor to open the registry path: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options, Add a primary key, named the service name to be debugged, such as MyService.exe, and then create a new string value under the primary key, named "Debugger", with the value of the debugger path;
Step 2:
To set up the services to be debugged interact with the desktop:
(1) Open "Administrative Tools", select "Services", open the Service Management window, select the name of the service ready to debug, right click to select "Properties", select "Login", tick "allow service to interact with desktop";
(2) Using Registry Editor, open the registry path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services \servicename (the service name to debug), select "Type", Modify its value to: the original value or 0x00000100 (if the original value is: 0x00000010 or 0x00000100 =0x00000110);
Step 3:
Set the service startup time-out (system defaults to 30 seconds), start Registry Editor, open the registry path: HKEY_LOCAL_MACHINE\System \currentcontrolset\control, new DWORD Value " ServicesPipeTimeout ", whose value is the time-out to set, such as setting 24 hours, the value is 86400000 milliseconds;
Step 4:
Start the service ready to debug, open "Administrative Tools", select "Services", open the Service Management window, select the name of the service ready for debugging, right click to select "Start"
Step 5:
After launching the Interactive Message service window will pop up, click "View Message" to go directly to the debugging;
Windows Service Program debugging method-start direct into debug