Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

111 lines
1.8 KiB

#include <windows.h>
#include "debugout.h"
INT DebugLevel = 0;
BOOL DebugFile = FALSE;
#if DEBUG
VOID PERROR (LPTSTR format, ...)
{
static TCHAR buf[256];
HANDLE hf;
DWORD dwWritten;
va_list vaMark;
if (DebugLevel <= 0)
return;
va_start(vaMark, format);
_vsntprintf(buf, 256, format, vaMark);
va_end(vaMark);
OutputDebugString(buf);
if (!DebugFile)
return;
hf = CreateFile (TEXT("c:\\clipsrv.out"),
GENERIC_WRITE,
0,
NULL,
OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (hf != INVALID_HANDLE_VALUE)
{
SetFilePointer(hf, 0, NULL, FILE_END);
WriteFile(hf, buf, lstrlen(buf), &dwWritten, NULL);
CloseHandle(hf);
}
}
#else
VOID PERROR (LPTSTR format, ...)
{
}
#endif
#ifdef DEBUG
VOID PINFO (LPTSTR format, ...)
{
static TCHAR buf[256];
HANDLE hf;
DWORD dwWritten;
va_list vaMark;
if (DebugLevel <= 1)
return;
va_start(vaMark, format);
_vsntprintf(buf, 256, format, vaMark);
va_end(vaMark);
OutputDebugString(buf);
if (!DebugFile)
return;
hf = CreateFile (TEXT("c:\\clipsrv.out"),
GENERIC_WRITE,
0,
NULL,
OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (hf != INVALID_HANDLE_VALUE)
{
SetFilePointer(hf, 0, NULL, FILE_END);
WriteFile(hf, buf, lstrlen(buf), &dwWritten, NULL);
CloseHandle(hf);
}
}
#else
VOID PINFO (LPTSTR format, ...)
{
}
#endif