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.

72 lines
1.4 KiB

  1. #include "pch.h"
  2. #pragma hdrstop
  3. #include "utils.h"
  4. DEFINE_MODULE( "RIPREP" )
  5. TCHAR gBuffer0[5000];
  6. TCHAR gBuffer1[5000];
  7. INT
  8. MessageBoxFromMessageV(
  9. IN HWND Window,
  10. IN DWORD MessageId,
  11. IN BOOL SystemMessage,
  12. IN LPCTSTR CaptionString,
  13. IN UINT Style,
  14. IN va_list *Args
  15. )
  16. {
  17. if((DWORD_PTR)CaptionString > 0xffff) {
  18. //
  19. // It's a string already.
  20. //
  21. lstrcpyn(gBuffer0,CaptionString, ARRAYSIZE(gBuffer0));
  22. } else {
  23. //
  24. // It's a string id
  25. //
  26. if(!LoadString(g_hinstance,PtrToUlong(CaptionString),gBuffer0, ARRAYSIZE(gBuffer0))) {
  27. gBuffer0[0] = 0;
  28. }
  29. }
  30. FormatMessage(
  31. SystemMessage ? FORMAT_MESSAGE_FROM_SYSTEM : FORMAT_MESSAGE_FROM_HMODULE,
  32. NULL,
  33. MessageId,
  34. 0,
  35. gBuffer1,
  36. ARRAYSIZE(gBuffer1),
  37. Args
  38. );
  39. return(MessageBox(Window,gBuffer1,gBuffer0,Style));
  40. }
  41. INT
  42. MessageBoxFromMessage(
  43. IN HWND Window,
  44. IN DWORD MessageId,
  45. IN BOOL SystemMessage,
  46. IN LPCTSTR CaptionString,
  47. IN UINT Style,
  48. ...
  49. )
  50. {
  51. va_list arglist;
  52. INT i;
  53. va_start(arglist,Style);
  54. i = MessageBoxFromMessageV(Window,MessageId,SystemMessage,CaptionString,Style,&arglist);
  55. va_end(arglist);
  56. return(i);
  57. }