Source code of Windows XP (NT5)
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.

101 lines
2.1 KiB

  1. /******************************************************************************
  2. *
  3. * HELPERS.C
  4. *
  5. * Various helper functions.
  6. *
  7. * Copyright (c) 1995 Microsoft Corporation
  8. *
  9. * $Log: N:\NT\PRIVATE\NW4\NWSCRIPT\VCS\HELPERS.C $
  10. *
  11. * Rev 1.1 22 Dec 1995 14:24:48 terryt
  12. * Add Microsoft headers
  13. *
  14. * Rev 1.0 15 Nov 1995 18:07:02 terryt
  15. * Initial revision.
  16. *
  17. * Rev 1.1 25 Aug 1995 16:22:56 terryt
  18. * Capture support
  19. *
  20. * Rev 1.0 15 May 1995 19:10:38 terryt
  21. * Initial revision.
  22. *
  23. *
  24. *******************************************************************************/
  25. #include <nt.h>
  26. #include <ntrtl.h>
  27. #include <nturtl.h>
  28. #include <windows.h>
  29. #include <stdio.h>
  30. #include <stdlib.h>
  31. #include <locale.h>
  32. #include "nwscript.h"
  33. /*******************************************************************************
  34. *
  35. * DisplayMessage
  36. * Display a message with variable arguments. Message
  37. * format string comes from the application resources.
  38. *
  39. * ENTRY:
  40. * nID (input)
  41. * Resource ID of the format string to use in the message.
  42. * ... (input)
  43. * Optional additional arguments to be used with format string.
  44. *
  45. * EXIT:
  46. *
  47. ******************************************************************************/
  48. VOID
  49. DisplayMessage( unsigned int nID, ... )
  50. {
  51. WCHAR sz1[512];
  52. WCHAR sz2[1536];
  53. int cch ;
  54. HANDLE hOut;
  55. va_list args;
  56. va_start( args, nID );
  57. if ( LoadString( NULL, nID, sz1, 512 ) ) {
  58. vswprintf(sz2, sz1, args ) ;
  59. hOut = GetStdHandle(STD_OUTPUT_HANDLE);
  60. cch = wcslen(sz2) ;
  61. WriteConsole(hOut, sz2, cch, &cch, NULL);
  62. }
  63. va_end(args);
  64. } /* DisplayMessage() */
  65. /*******************************************************************************
  66. *
  67. * DisplayOemString
  68. * Display an OEM string
  69. *
  70. * ENTRY:
  71. * string: string to display
  72. *
  73. * EXIT:
  74. *
  75. ******************************************************************************/
  76. VOID
  77. DisplayOemString( char *string )
  78. {
  79. // this will print % in strings correctly.
  80. printf( "%s", string );
  81. } /* DisplayAnsiString() */