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.

87 lines
2.0 KiB

  1. #include <windows.h>
  2. #include <logerror.h>
  3. #include "str.h"
  4. #ifdef API
  5. #undef API
  6. #endif
  7. #define API _far _pascal _loadds
  8. #define SELECTOROF(lp) HIWORD(lp)
  9. #define OFFSETOF(lp) LOWORD(lp)
  10. static WORD wErrorOpts = 0;
  11. static char rgch[80];
  12. char *LogErrorStr(WORD err, VOID FAR* lpInfo) {
  13. void DebugLogError(WORD err, VOID FAR* lpInfo);
  14. if (err & ERR_WARNING)
  15. wsprintf(rgch, STR(WarningError), err);
  16. else
  17. wsprintf(rgch, STR(FatalError), err);
  18. return rgch;
  19. }
  20. LPSTR GetProcName(FARPROC fn);
  21. char *LogParamErrorStr(WORD err, FARPROC lpfn, VOID FAR* param) {
  22. LPSTR rgchProcName;
  23. rgchProcName = GetProcName(lpfn);
  24. switch ((err & ~ERR_FLAGS_MASK) | ERR_PARAM)
  25. {
  26. case ERR_BAD_VALUE:
  27. case ERR_BAD_INDEX:
  28. wsprintf(rgch, STR(ParamErrorBadInt), rgchProcName, (WORD)(DWORD)param);
  29. break;
  30. case ERR_BAD_FLAGS:
  31. case ERR_BAD_SELECTOR:
  32. wsprintf(rgch, STR(ParamErrorBadFlags), rgchProcName, (WORD)(DWORD)param);
  33. break;
  34. case ERR_BAD_DFLAGS:
  35. case ERR_BAD_DVALUE:
  36. case ERR_BAD_DINDEX:
  37. wsprintf(rgch, STR(ParamErrorBadDWord), rgchProcName, (DWORD)param);
  38. break;
  39. case ERR_BAD_PTR:
  40. case ERR_BAD_FUNC_PTR:
  41. case ERR_BAD_STRING_PTR:
  42. wsprintf(rgch, STR(ParamErrorBadPtr), rgchProcName,
  43. SELECTOROF(param), OFFSETOF(param));
  44. break;
  45. case ERR_BAD_HINSTANCE:
  46. case ERR_BAD_HMODULE:
  47. case ERR_BAD_GLOBAL_HANDLE:
  48. case ERR_BAD_LOCAL_HANDLE:
  49. case ERR_BAD_ATOM:
  50. case ERR_BAD_HWND:
  51. case ERR_BAD_HMENU:
  52. case ERR_BAD_HCURSOR:
  53. case ERR_BAD_HICON:
  54. case ERR_BAD_GDI_OBJECT:
  55. case ERR_BAD_HDC:
  56. case ERR_BAD_HPEN:
  57. case ERR_BAD_HFONT:
  58. case ERR_BAD_HBRUSH:
  59. case ERR_BAD_HBITMAP:
  60. case ERR_BAD_HRGN:
  61. case ERR_BAD_HPALETTE:
  62. case ERR_BAD_HANDLE:
  63. wsprintf(rgch, STR(ParamErrorBadHandle), rgchProcName, (WORD)(DWORD)param);
  64. break;
  65. default:
  66. wsprintf(rgch, STR(ParamErrorParam), rgchProcName, (DWORD)param);
  67. break;
  68. }
  69. return rgch;
  70. }