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.

105 lines
2.0 KiB

  1. /*
  2. * DEBUG.CPP
  3. *
  4. *
  5. *
  6. *
  7. *
  8. *
  9. */
  10. #include <windows.h>
  11. #include <hidclass.h>
  12. #include <hidsdi.h>
  13. #include <ole2.h>
  14. #include <ole2ver.h>
  15. #include "..\inc\opos.h"
  16. #include "oposctrl.h"
  17. VOID Report(LPSTR szMsg, DWORD num)
  18. {
  19. char msg[MAX_PATH];
  20. wsprintf((LPSTR)msg, "%s (%xh=%d).", szMsg, num, num);
  21. MessageBox((HWND)NULL, (LPSTR)msg, (LPCSTR)"OPOSCTRL", MB_OK|MB_ICONEXCLAMATION);
  22. }
  23. LPSTR DbgHresultStr(DWORD hres)
  24. {
  25. LPSTR str = "???";
  26. switch (hres){
  27. #define MAKECASE(res) case res: str = #res; break;
  28. MAKECASE(S_OK);
  29. MAKECASE(E_FAIL);
  30. MAKECASE(REGDB_E_CLASSNOTREG);
  31. MAKECASE(E_NOINTERFACE);
  32. MAKECASE(REGDB_E_READREGDB);
  33. MAKECASE(CO_E_DLLNOTFOUND);
  34. MAKECASE(CO_E_APPNOTFOUND);
  35. MAKECASE(E_ACCESSDENIED);
  36. MAKECASE(CO_E_ERRORINDLL);
  37. MAKECASE(CO_E_APPDIDNTREG);
  38. }
  39. return str;
  40. }
  41. VOID ReportHresultErr(LPSTR szMsg, DWORD hres)
  42. {
  43. char msg[MAX_PATH];
  44. wsprintf((LPSTR)msg, "%s %s (%xh=%d).", szMsg, DbgHresultStr(hres), hres, hres);
  45. MessageBox((HWND)NULL, (LPSTR)msg, (LPCSTR)"OPOSCTRL", MB_OK|MB_ICONEXCLAMATION);
  46. }
  47. // BUGBUG REMOVE
  48. IOPOSControl *TestNewControl()
  49. {
  50. IOPOSControl *oposControlInterface;
  51. COPOSControl *oposControl = new COPOSControl;
  52. if (oposControl){
  53. oposControlInterface = (IOPOSControl *)oposControl;
  54. oposControlInterface->AddRef();
  55. }
  56. else {
  57. oposControlInterface = NULL;
  58. }
  59. return oposControlInterface;
  60. }
  61. // BUGBUG REMOVE
  62. void Test()
  63. {
  64. HINSTANCE libHandle;
  65. libHandle = LoadLibrary("oposserv.dll");
  66. if ((ULONG)libHandle >= (ULONG)HINSTANCE_ERROR){
  67. FARPROC entry = GetProcAddress(libHandle, "Test");
  68. if (entry){
  69. #pragma warning(disable:4087)
  70. // (*entry)();
  71. OpenServer();
  72. #pragma warning(default:4087)
  73. }
  74. else {
  75. Report("Couln't get Service's Test() entry.", 0);
  76. }
  77. FreeLibrary(libHandle);
  78. }
  79. else {
  80. Report("Couldn't load Service lib.", 0);
  81. }
  82. }