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.

146 lines
3.8 KiB

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name:
  4. startrx.c
  5. Abstract:
  6. This module contains the support routines to start and initialize the RDBSS
  7. Author:
  8. Joe Linn (JoeLinn) 21-jul-94
  9. Revision History:
  10. --*/
  11. #include "precomp.h"
  12. #pragma hdrstop
  13. #include <stdlib.h>
  14. #include <stdio.h>
  15. #include "string.h"
  16. #include <stdarg.h>
  17. BOOLEAN RxGlobalTraceSuppress = FALSE;
  18. //.............sigh
  19. NTSTATUS
  20. SmbCeBuildSmbHeader(
  21. PSMB_EXCHANGE pExchange,
  22. UCHAR SmbCommand,
  23. PVOID pBuffer,
  24. ULONG BufferLength,
  25. PULONG pBufferConsumed)
  26. {
  27. PNT_SMB_HEADER NtSmbHeader = (PNT_SMB_HEADER)pBuffer;
  28. RtlZeroMemory(NtSmbHeader,sizeof(NT_SMB_HEADER));
  29. *(PULONG)(&NtSmbHeader->Protocol) = SMB_HEADER_PROTOCOL;
  30. NtSmbHeader->Command = SMB_COM_NO_ANDX_COMMAND;
  31. SmbPutUshort (&NtSmbHeader->Pid, MRXSMB_PROCESS_ID_ZERO);
  32. SmbPutUshort (&NtSmbHeader->Mid, MRXSMB_MULTIPLX_ID_ZERO);
  33. SmbPutUshort (&NtSmbHeader->Uid, MRXSMB_USER_ID_ZERO);
  34. SmbPutUshort (&NtSmbHeader->Tid, MRXSMB_TREE_ID_ZERO);
  35. *pBufferConsumed = sizeof(SMB_HEADER);
  36. return(STATUS_SUCCESS);
  37. }
  38. ULONG
  39. DbgPrint(
  40. PCHAR Format,
  41. ...
  42. )
  43. {
  44. va_list arglist;
  45. UCHAR Buffer[512];
  46. ULONG retval;
  47. //
  48. // Format the output into a buffer and then print it.
  49. //
  50. //printf("Here in debgprint\n");
  51. va_start(arglist, Format);
  52. retval = _vsnprintf(Buffer, sizeof(Buffer), Format, arglist);
  53. //*(Buffer+retval) = 0;
  54. printf("%s",Buffer);
  55. return(retval);
  56. }
  57. BOOLEAN
  58. RxDbgTraceActualNew (
  59. IN ULONG NewMask,
  60. IN OUT PDEBUG_TRACE_CONTROLPOINT ControlPoint
  61. )
  62. //we aren't fancy in this test stub........just return print it out no matter what!
  63. {
  64. /*
  65. This routine has the responsibility to determine if a particular dbgprint is going to be printed and ifso to
  66. fiddle with the indent. so the return value is whether to print; it is also used for just fiddling with the indent
  67. by setting the highoredr bit of the mask.
  68. The Mask is now very complicated owing to the large number of dbgprints i'm trying to control...sigh.
  69. The low order byte is the controlpoint....usually the file. each controlpoint has a current level associated
  70. with it. if the level of a a debugtrace is less that then current control level then the debug is printed.
  71. The next byte is the level of this particular call; again if the level is <= the current level for the control
  72. you get printed. The next byte is the indent. indents are only processed if printing is done.
  73. */
  74. #if DBG
  75. LONG Indent = ((NewMask>>RxDT_INDENT_SHIFT)&RxDT_INDENT_MASK) - RxDT_INDENT_EXCESS;
  76. LONG LevelOfThisWrite = (NewMask) & RxDT_LEVEL_MASK;
  77. BOOLEAN PrintIt = (NewMask&RxDT_SUPPRESS_PRINT)==0;
  78. BOOLEAN OverrideReturn = (NewMask&RxDT_OVERRIDE_RETURN)!=0;
  79. return PrintIt||OverrideReturn;
  80. #else
  81. return(FALSE);
  82. #endif
  83. }
  84. RDBSS_EXPORTS Junk;
  85. PRDBSS_EXPORTS MRxSmbRxImports;
  86. VOID
  87. __cdecl
  88. main(
  89. int argc,
  90. char *argv[]
  91. )
  92. {
  93. printf("Calling stufferdebug\n");
  94. //signal to assert login that we're in usermode
  95. MRxSmbRxImports = &Junk;
  96. MRxSmbRxImports->pRxNetNameTable = NULL;
  97. MRxSmbStufferDebug("");
  98. }
  99. #define Dbg (DEBUG_TRACE_ALWAYS)
  100. VOID
  101. RxAssert(
  102. IN PVOID FailedAssertion,
  103. IN PVOID FileName,
  104. IN ULONG LineNumber,
  105. IN PCHAR Message OPTIONAL
  106. )
  107. {
  108. char STARS[] = "**************************************";
  109. RxDbgTrace(0,Dbg,("%s\n%s\n",STARS,STARS));
  110. RxDbgTrace (0,Dbg,("Failed Assertion %s\n",FailedAssertion));
  111. RxDbgTrace(0,Dbg,("%s at line %lu\n",FileName,LineNumber));
  112. if (Message) {
  113. RxDbgTrace (0,Dbg,("%s\n",Message));
  114. }
  115. RxDbgTrace(0,Dbg,("%s\n%s\n",STARS,STARS));
  116. }