mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 06:46:06 +00:00
add a --process parameter to redirect stdout to dbgout
usage: dbgprint --process version_winetest.exe svn path=/trunk/; revision=35920
This commit is contained in:
parent
0f370b9bf7
commit
a073152ea9
1 changed files with 40 additions and 20 deletions
|
@ -5,11 +5,13 @@
|
||||||
* FILE: tools/dbgprint/dbgprint.c
|
* FILE: tools/dbgprint/dbgprint.c
|
||||||
* PURPOSE: outputs a text via DbgPrint API
|
* PURPOSE: outputs a text via DbgPrint API
|
||||||
* PROGRAMMERS: Johannes Anderwald (johannes.anderwald@student.tugraz.at)
|
* PROGRAMMERS: Johannes Anderwald (johannes.anderwald@student.tugraz.at)
|
||||||
|
* Christoph von Wittich (Christoph_vW@ReactOS.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int _tmain(int argc, TCHAR ** argv)
|
int _tmain(int argc, TCHAR ** argv)
|
||||||
{
|
{
|
||||||
|
@ -29,30 +31,48 @@ int _tmain(int argc, TCHAR ** argv)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = HeapAlloc(GetProcessHeap(), 0, (bufsize+1) * sizeof(TCHAR));
|
if (_tcsstr(argv[1], "--process") && (argc == 3))
|
||||||
if (!buf)
|
|
||||||
{
|
{
|
||||||
return -1;
|
char psBuffer[128];
|
||||||
}
|
FILE *pPipe;
|
||||||
|
|
||||||
offset = 0;
|
pPipe = _tpopen(argv[2], "r");
|
||||||
for(i = 1; i < argc; i++)
|
if (pPipe != NULL)
|
||||||
{
|
|
||||||
int length = _tcslen(argv[i]);
|
|
||||||
_tcsncpy(&buf[offset], argv[i], length);
|
|
||||||
offset += length;
|
|
||||||
if (i + 1 < argc)
|
|
||||||
{
|
{
|
||||||
buf[offset] = _T(' ');
|
while(fgets(psBuffer, 128, pPipe))
|
||||||
|
{
|
||||||
|
OutputDebugStringA(psBuffer);
|
||||||
|
}
|
||||||
|
_pclose(pPipe);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
buf[offset] = _T('\n');
|
|
||||||
buf[offset+1] = _T('\0');
|
|
||||||
}
|
|
||||||
offset++;
|
|
||||||
}
|
}
|
||||||
OutputDebugString(buf);
|
else
|
||||||
HeapFree(GetProcessHeap(), 0, buf);
|
{
|
||||||
|
buf = HeapAlloc(GetProcessHeap(), 0, (bufsize+1) * sizeof(TCHAR));
|
||||||
|
if (!buf)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
offset = 0;
|
||||||
|
for(i = 1; i < argc; i++)
|
||||||
|
{
|
||||||
|
int length = _tcslen(argv[i]);
|
||||||
|
_tcsncpy(&buf[offset], argv[i], length);
|
||||||
|
offset += length;
|
||||||
|
if (i + 1 < argc)
|
||||||
|
{
|
||||||
|
buf[offset] = _T(' ');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buf[offset] = _T('\n');
|
||||||
|
buf[offset+1] = _T('\0');
|
||||||
|
}
|
||||||
|
offset++;
|
||||||
|
}
|
||||||
|
OutputDebugString(buf);
|
||||||
|
HeapFree(GetProcessHeap(), 0, buf);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue