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.

70 lines
2.1 KiB

  1. /***
  2. *wrt2err.c - write an LSTRING to stderr (Win32 version)
  3. *
  4. * Copyright (c) 1989-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This module contains a routine __wrt2err that writes an LSTRING
  8. * (one byte length followed by the several bytes of the string)
  9. * to the standard error handle (2). This is a helper routine used
  10. * for MATH error messages (and also FORTRAN error messages).
  11. *
  12. *Revision History:
  13. * 06-30-89 PHG module created, based on asm version
  14. * 03-16-90 GJF Made calling type _CALLTYPE1, added #include
  15. * <cruntime.h> and fixed the copyright. Also, cleaned
  16. * up the formatting a bit.
  17. * 07-24-90 SBM Removed '32' from API names
  18. * 10-04-90 GJF New-style function declarator.
  19. * 12-04-90 SRW Changed to include <oscalls.h> instead of <doscalls.h>
  20. * 04-26-91 SRW Removed level 3 warnings
  21. * 07-18-91 GJF Replaced call to DbgPrint with WriteFile to standard
  22. * error handle [_WIN32_].
  23. * 04-06-93 SKS Add __cdecl keyword
  24. * 09-06-94 CFW Remove Cruiser support.
  25. * 12-03-94 SKS Clean up OS/2 references
  26. * 06-13-95 GJF Replaced _osfhnd[] with _osfhnd() (macro referencing
  27. * field in ioinfo struct).
  28. *
  29. *******************************************************************************/
  30. #ifndef _POSIX_
  31. #include <cruntime.h>
  32. #include <oscalls.h>
  33. #include <internal.h>
  34. /***
  35. *__wrt2err(msg) - write an LSTRING to stderr
  36. *
  37. *Purpose:
  38. * Takes a pointer to an LSTRING which is to be written to standard error.
  39. * An LSTRING is a one-byte length followed by that many bytes for the
  40. * character string (as opposed to a null-terminated string).
  41. *
  42. *Entry:
  43. * char *msg = pointer to LSTRING to write to standard error.
  44. *
  45. *Exit:
  46. * Nothing returned.
  47. *
  48. *Exceptions:
  49. * None handled.
  50. *
  51. *******************************************************************************/
  52. void __cdecl __wrt2err (
  53. char *msg
  54. )
  55. {
  56. unsigned long length; /* length of string to write */
  57. unsigned long numwritten; /* number of bytes written */
  58. length = *msg++; /* 1st byte is length */
  59. /* write the message to stderr */
  60. WriteFile((HANDLE)_osfhnd(2), msg, length, &numwritten, NULL);
  61. }
  62. #endif /* _POSIX_ */