There is no API that gives you access to strings output through OutputDebugString
.
There are two ways of getting the data:
- Bad idea: implement the client side of the OutputDebugString protocol.
- Better idea: hook the
OutputDebugStringA
function.
The OutputDebugString
protocol only supports a single listener so the first approach isn't compatible with multiple instances of your application, other applications doing the same thing or debuggers. It would also capture output from all applications. It is not a good idea. I mention it only because it is an obvious but wrong solution.
OutputDebugStringW
is (unusually) a wrapper around OutputDebugStringA
so the latter is the function to hook. There are lots of libraries that make hooking easy so every call to OutputDebugString
will become a call to a function you define, and you can do anything you like with the data.