mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Changed debug output to use INT 2D
svn path=/trunk/; revision=938
This commit is contained in:
parent
8234dea660
commit
921363d647
5 changed files with 50 additions and 57 deletions
|
@ -1,14 +1,13 @@
|
||||||
extern void dprintf(char* fmt,...);
|
|
||||||
|
|
||||||
#define UNIMPLEMENTED dprintf("%s in %s:%d is unimplemented\n",__FUNCTION__,__FILE__,__LINE__);
|
#define UNIMPLEMENTED DbgPrint("%s in %s:%d is unimplemented\n",__FUNCTION__,__FILE__,__LINE__);
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
#define DPRINT(args...)
|
#define DPRINT(args...)
|
||||||
#else
|
#else
|
||||||
#define DPRINT(args...) do { dprintf("(NTDLL:%s:%d) ",__FILE__,__LINE__); dprintf(args); } while(0);
|
#define DPRINT(args...) do { DbgPrint("(NTDLL:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DPRINT1(args...) do { dprintf("(NTDLL:%s:%d) ",__FILE__,__LINE__); dprintf(args); } while(0);
|
#define DPRINT1(args...) do { DbgPrint("(NTDLL:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
|
||||||
|
|
||||||
#define ROUNDUP(a,b) ((((a)+(b)-1)/(b))*(b))
|
#define ROUNDUP(a,b) ((((a)+(b)-1)/(b))*(b))
|
||||||
#define ROUNDDOWN(a,b) (((a)/(b))*(b))
|
#define ROUNDDOWN(a,b) (((a)/(b))*(b))
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
/* $Id: print.c,v 1.1 2000/01/10 20:31:23 ekohl Exp $
|
/* $Id: print.c,v 1.2 2000/01/18 12:04:16 ekohl Exp $
|
||||||
*
|
*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS kernel
|
||||||
|
* FILE: lib/ntdll/dbg/print.c
|
||||||
|
* PURPOSE: Debug output
|
||||||
|
* PROGRAMMER: Eric Kohl
|
||||||
|
* UPDATE HISTORY:
|
||||||
|
* Created 28/12/1999
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
|
@ -8,30 +14,36 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* FUNCTIONS ***************************************************************/
|
||||||
|
|
||||||
|
ULONG DbgService (ULONG Service, PVOID Context1, PVOID Context2);
|
||||||
|
__asm__ ("\n\t.global _DbgService\n\t"
|
||||||
|
"_DbgService:\n\t"
|
||||||
|
"mov 4(%esp), %eax\n\t"
|
||||||
|
"mov 8(%esp), %ecx\n\t"
|
||||||
|
"mov 12(%esp), %edx\n\t"
|
||||||
|
"int $0x2D\n\t"
|
||||||
|
"ret\n\t");
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
DbgPrint (PCH Format, ...)
|
DbgPrint(PCH Format, ...)
|
||||||
{
|
{
|
||||||
CHAR Buffer[512];
|
ANSI_STRING DebugString;
|
||||||
va_list ap;
|
CHAR Buffer[512];
|
||||||
UNICODE_STRING UnicodeString;
|
va_list ap;
|
||||||
ANSI_STRING AnsiString;
|
|
||||||
|
|
||||||
va_start (ap, Format);
|
/* init ansi string */
|
||||||
vsprintf (Buffer, Format, ap);
|
DebugString.Buffer = Buffer;
|
||||||
va_end (ap);
|
DebugString.MaximumLength = 512;
|
||||||
|
|
||||||
RtlInitAnsiString (&AnsiString,
|
va_start (ap, Format);
|
||||||
Buffer);
|
DebugString.Length = _vsnprintf (Buffer, 512, Format, ap);
|
||||||
RtlAnsiStringToUnicodeString (&UnicodeString,
|
va_end (ap);
|
||||||
&AnsiString,
|
|
||||||
TRUE);
|
|
||||||
|
|
||||||
/* FIXME: send string to debugging subsystem */
|
DbgService (1, &DebugString, NULL);
|
||||||
NtDisplayString (&UnicodeString);
|
|
||||||
|
|
||||||
RtlFreeUnicodeString (&UnicodeString);
|
return (ULONG)DebugString.Length;
|
||||||
|
|
||||||
return (strlen (Buffer));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: startup.c,v 1.14 1999/12/30 01:51:38 dwelch Exp $
|
/* $Id: startup.c,v 1.15 2000/01/18 12:04:31 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -109,7 +109,7 @@ VOID LdrStartup(PPEB Peb,
|
||||||
PEDosHeader->e_lfanew == 0L ||
|
PEDosHeader->e_lfanew == 0L ||
|
||||||
*(PULONG)((PUCHAR)ImageBase + PEDosHeader->e_lfanew) != IMAGE_PE_MAGIC)
|
*(PULONG)((PUCHAR)ImageBase + PEDosHeader->e_lfanew) != IMAGE_PE_MAGIC)
|
||||||
{
|
{
|
||||||
dprintf("Image has bad header\n");
|
DbgPrint("Image has bad header\n");
|
||||||
ZwTerminateProcess(NULL,STATUS_UNSUCCESSFUL);
|
ZwTerminateProcess(NULL,STATUS_UNSUCCESSFUL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ VOID LdrStartup(PPEB Peb,
|
||||||
|
|
||||||
if (EntryPoint == NULL)
|
if (EntryPoint == NULL)
|
||||||
{
|
{
|
||||||
dprintf("Failed to initialize image\n");
|
DbgPrint("Failed to initialize image\n");
|
||||||
ZwTerminateProcess(NtCurrentProcess(),STATUS_UNSUCCESSFUL);
|
ZwTerminateProcess(NtCurrentProcess(),STATUS_UNSUCCESSFUL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,10 +134,10 @@ VOID LdrStartup(PPEB Peb,
|
||||||
Status = CsrConnectToServer();
|
Status = CsrConnectToServer();
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
dprintf("Failed to connect to csrss.exe: expect trouble\n");
|
DbgPrint("Failed to connect to csrss.exe: expect trouble\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// dprintf("Transferring control to image at %x\n",EntryPoint);
|
// DbgPrint("Transferring control to image at %x\n",EntryPoint);
|
||||||
Status = EntryPoint(Peb);
|
Status = EntryPoint(Peb);
|
||||||
ZwTerminateProcess(NtCurrentProcess(),Status);
|
ZwTerminateProcess(NtCurrentProcess(),Status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: utils.c,v 1.22 1999/12/26 15:50:46 dwelch Exp $
|
/* $Id: utils.c,v 1.23 2000/01/18 12:04:31 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -138,7 +138,7 @@ NTSTATUS LdrLoadDll (PDLL* Dll,
|
||||||
);
|
);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
dprintf("Dll open of %s failed: Status = 0x%08x\n",
|
DbgPrint("Dll open of %s failed: Status = 0x%08x\n",
|
||||||
fqname, Status);
|
fqname, Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ NTSTATUS LdrLoadDll (PDLL* Dll,
|
||||||
);
|
);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
dprintf("NTDLL.LDR: map view of section failed (Status %x)\n",
|
DbgPrint("NTDLL.LDR: map view of section failed (Status %x)\n",
|
||||||
Status);
|
Status);
|
||||||
ZwClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
return(Status);
|
return(Status);
|
||||||
|
@ -458,7 +458,7 @@ LdrGetExportByOrdinal (
|
||||||
Module->BaseAddress,
|
Module->BaseAddress,
|
||||||
ExportDir->AddressOfFunctions
|
ExportDir->AddressOfFunctions
|
||||||
);
|
);
|
||||||
dprintf(
|
DbgPrint(
|
||||||
"LdrGetExportByOrdinal(Ordinal %d) = %x\n",
|
"LdrGetExportByOrdinal(Ordinal %d) = %x\n",
|
||||||
Ordinal,
|
Ordinal,
|
||||||
ExFunctions[ExOrdinals[Ordinal - ExportDir->Base]]
|
ExFunctions[ExOrdinals[Ordinal - ExportDir->Base]]
|
||||||
|
@ -549,7 +549,7 @@ LdrGetExportByName (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintf("LdrGetExportByName() = failed to find %s\n",SymbolName);
|
DbgPrint("LdrGetExportByName() = failed to find %s\n",SymbolName);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -777,7 +777,7 @@ static NTSTATUS LdrFixupImports(PIMAGE_NT_HEADERS NTHeaders,
|
||||||
);
|
);
|
||||||
if ((*ImportAddressList) == NULL)
|
if ((*ImportAddressList) == NULL)
|
||||||
{
|
{
|
||||||
dprintf("Failed to import %s\n", pName);
|
DbgPrint("Failed to import %s\n", pName);
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -852,7 +852,7 @@ PEPFUNC LdrPEStartup (PVOID ImageBase,
|
||||||
Status = LdrPerformRelocations(NTHeaders, ImageBase);
|
Status = LdrPerformRelocations(NTHeaders, ImageBase);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
dprintf("LdrPerformRelocations() failed\n");
|
DbgPrint("LdrPerformRelocations() failed\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -868,7 +868,7 @@ PEPFUNC LdrPEStartup (PVOID ImageBase,
|
||||||
Status = LdrFixupImports(NTHeaders, ImageBase);
|
Status = LdrFixupImports(NTHeaders, ImageBase);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
dprintf("LdrFixupImports() failed\n");
|
DbgPrint("LdrFixupImports() failed\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/*
|
/* $Id: dllmain.c,v 1.6 2000/01/18 12:04:45 ekohl Exp $
|
||||||
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/ntdll/main/dllmain.c
|
* FILE: lib/ntdll/main/dllmain.c
|
||||||
|
@ -11,25 +12,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ntdll/ntdll.h>
|
#include <ntdll/ntdll.h>
|
||||||
|
|
||||||
void dprintf(char* fmt,...)
|
|
||||||
{
|
|
||||||
char buffer[512];
|
|
||||||
va_list ap;
|
|
||||||
WCHAR bufferw[512];
|
|
||||||
UNICODE_STRING UnicodeString;
|
|
||||||
ULONG i;
|
|
||||||
|
|
||||||
va_start(ap, fmt);
|
|
||||||
vsprintf(buffer, fmt, ap);
|
|
||||||
for (i=0; buffer[i] != 0; i++)
|
|
||||||
{
|
|
||||||
bufferw[i] = buffer[i];
|
|
||||||
}
|
|
||||||
bufferw[i] = 0;
|
|
||||||
RtlInitUnicodeString(&UnicodeString, bufferw);
|
|
||||||
NtDisplayString(&UnicodeString);
|
|
||||||
va_end(ap);
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL WINAPI DllMainCRTStartup(HINSTANCE hinstDll,
|
BOOL WINAPI DllMainCRTStartup(HINSTANCE hinstDll,
|
||||||
DWORD fdwReason,
|
DWORD fdwReason,
|
||||||
|
|
Loading…
Reference in a new issue