dllmain.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. // dllmain.cpp : 定义 DLL 应用程序的入口点。
  2. #include "pch.h"
  3. #include "DongleChecker.h"
  4. #include "CheckSuperDongle.h"
  5. #include "ResDataObject.h"
  6. #include "common_api.h"
  7. CCheckSuperDongle checker;
  8. BOOL APIENTRY DllMain( HMODULE hModule,
  9. DWORD ul_reason_for_call,
  10. LPVOID lpReserved
  11. )
  12. {
  13. switch (ul_reason_for_call)
  14. {
  15. case DLL_PROCESS_ATTACH:
  16. case DLL_THREAD_ATTACH:
  17. case DLL_THREAD_DETACH:
  18. case DLL_PROCESS_DETACH:
  19. break;
  20. }
  21. return TRUE;
  22. }
  23. bool DongleCheck(const char* code)
  24. {
  25. return checker.CheckFunction(atoi(code));
  26. }
  27. /// <summary>
  28. /// 驱动启动验证
  29. /// </summary>
  30. /// <param name="xmlFileName">驱动的xml文件的名称</param>
  31. /// <returns>true: 可以正常启动;false 不能启动</returns>
  32. bool DongleCheckDriverStart(const char* xmlFileName)
  33. {
  34. ResDataObject resXml;
  35. try
  36. {
  37. resXml.loadFile(xmlFileName);
  38. string major = (const char*)resXml["CONFIGURATION"]["MajorID"];
  39. string vendor = (const char*)resXml["CONFIGURATION"]["VendorID"];
  40. string product = (const char*)resXml["CONFIGURATION"]["ProductID"];
  41. string moda,madolity = (const char*)resXml["CONFIGURATION"]["MinorID"];
  42. ResDataObject resDriverAll;
  43. string sysconf = GetProcessDirectory() + "/srvconf.json";
  44. resDriverAll.loadFile(sysconf.c_str());
  45. std::transform(madolity.begin(), madolity.end(), moda.begin(), ::toupper);
  46. string confCheck = vendor + "_" + product;
  47. if (major == "Camera")
  48. {
  49. //摄像头或者超声探头
  50. if (moda == "US")
  51. {
  52. if (checker.CheckFunction(1180))
  53. {
  54. }
  55. }
  56. else if (moda == "DME")
  57. {
  58. }
  59. }
  60. else if (major == "Detector")
  61. {
  62. //平板探测器
  63. if (moda == "DR")
  64. {
  65. }
  66. else if (moda == "DF")
  67. {
  68. }
  69. }
  70. }
  71. catch (...)
  72. {
  73. return false;
  74. }
  75. return true;
  76. }
  77. /// <summary>
  78. /// 检查驱动是否可以安装
  79. /// </summary>
  80. /// <param name="szDevPath">设备的安装的设备路径 CCOS/DEVICE/Detector/CareRay/1800RF </param>
  81. /// <returns>true: 可以正常安装;false 不能安装</returns>
  82. bool DongleCheckDriverInstall(const char* szDevPath)
  83. {
  84. return true;
  85. }