Tag: outputdebugstring

可以在Visual Studio的输出窗口中查看OutputDebugString的输出吗?

我正在使用C#和Visual Studio 2010。 当我使用OutputDebugString写入调试信息时,它应该出现在输出窗口中吗? 我可以在DebugView中看到OutputDebugString的输出,但我想我会在Visual Studio的Output窗口中看到它。 我看过菜单工具 ? 选项 ? 调试 ? 常规 ,输出未被重定向到立即窗口。 我还看了菜单Tools *? 选项 ? 调试 ? 输出窗口和所有常规输出设置都设置为“开”。 最后,我使用了Output窗口中的下拉列表来指定应该出现Debug消息。 如果我更改菜单工具*? 选项 ? 调试 ? 一般将输出重定向到立即窗口, OutputDebugString消息不会出现在即时窗口中。 这是我的整个测试程序: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; using System.Diagnostics; namespace OutputDebugString { class Program { [DllImport(“kernel32.dll”, CharSet = CharSet.Auto)] public static extern […]

如何从服务接收OutputDebugString?

我正在尝试使用以下代码捕获所有OutputDebugString消息(包括来自服务的消息)。 它运行正常,直到我迁移到Windows 7。 问题是,由于Windows Vista服务在低级别的Session#0中运行,有些人说它不可能捕获它们而一些它是不可能的 。 你怎么看? 是否可以通过增加一些权限来修改以下代码,以便能够从Session#0接收OutputDebugString消息? 换一种说法; 是否可以在会话#0中与会话#0共享DBWIN_BUFFER? 我想它应该是可能的,因为例如DebugView可以做到这一点,并且我看不到任何服务助手会将这些消息(例如通过命名管道)从Session#0发送到GUI正在运行的Session#1。 问题将是安全设置中的IMO。 任何人都可以建议我如何修改它们? type TODSThread = class(TThread) protected procedure Execute; override; end; … procedure TODSThread.Execute; var SharedMem: Pointer; SharedFile: THandle; WaitingResult: DWORD; SharedMessage: string; DataReadyEvent: THandle; BufferReadyEvent: THandle; SecurityAttributes: SECURITY_ATTRIBUTES; SecurityDescriptor: SECURITY_DESCRIPTOR; begin SecurityAttributes.nLength := SizeOf(SECURITY_ATTRIBUTES); SecurityAttributes.bInheritHandle := True; SecurityAttributes.lpSecurityDescriptor := @SecurityDescriptor; if not InitializeSecurityDescriptor(@SecurityDescriptor, […]