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.

73 lines
1.8 KiB

  1. // Copyright (c) 1997-1999 Microsoft Corporation
  2. //
  3. // Shared Dialog code
  4. //
  5. // 3-11-98 sburns
  6. #include "precomp.h"
  7. #include "resource.h"
  8. #include "common.h"
  9. // translates an hresult to an error string
  10. // special cases WMI errors
  11. // returns TRUE if lookup successful
  12. bool ErrorLookup(HRESULT hr, CHString& message)
  13. {
  14. bool bRet = false;
  15. const HRESULT WMIErrorMask = 0x80041000;
  16. TCHAR buffer[MAX_PATH +2];
  17. HMODULE hLib;
  18. TCHAR* pOutput = NULL;
  19. // if in this range, we'll see if wbem claims it
  20. if ((hr >= WMIErrorMask) && (hr <= (WMIErrorMask + 0xFFF))
  21. && ExpandEnvironmentStrings(L"%windir%\\system32\\wbem\\wmiutils.dll", buffer, MAX_PATH)
  22. && (hLib = LoadLibrary(buffer)))
  23. {
  24. FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
  25. FORMAT_MESSAGE_FROM_HMODULE |
  26. FORMAT_MESSAGE_FROM_SYSTEM,
  27. hLib, hr, 0, (LPWSTR)&pOutput, 0, NULL);
  28. FreeLibrary(hLib);
  29. }
  30. else
  31. {
  32. FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
  33. FORMAT_MESSAGE_FROM_SYSTEM,
  34. NULL, hr, 0, (LPWSTR)&pOutput, 0, NULL);
  35. }
  36. if (pOutput)
  37. {
  38. bRet = true;
  39. message = pOutput;
  40. LocalFree(pOutput);
  41. }
  42. return bRet;
  43. }
  44. void AppError(HWND parent,
  45. HRESULT hr,
  46. const CHString& message)
  47. {
  48. //TODOerror(parent, hr, message, IDS_APP_TITLE);
  49. }
  50. void AppMessage(HWND parent, int messageResID)
  51. {
  52. //TODOAppMessage(parent, String::load(messageResID));
  53. }
  54. void AppMessage(HWND parent, const CHString& message)
  55. {
  56. /*TODOMessageBox(parent,
  57. message,
  58. CHString::load(IDS_APP_TITLE),
  59. MB_OK | MB_ICONINFORMATION);
  60. */
  61. }