primosdk_helper.cpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #include "./primosdk_helper.h"
  2. //#include "../primo/obj_primo.h"
  3. #include "api__ml_disc.h"
  4. #include <api/service/waservicefactory.h>
  5. typedef struct _PRIMOSDK_INSTANCE
  6. {
  7. // obj_primo *primo;
  8. BOOL bLoadFailed;
  9. LONG uRef;
  10. } PRIMOSDK_INSTANCE;
  11. static PRIMOSDK_INSTANCE sdk = {/*NULL,*/ FALSE, 0, };
  12. BOOL PrimoSDKHelper_IsInitialized(void)
  13. {
  14. return (0 != sdk.uRef);
  15. }
  16. BOOL PrimoSDKHelper_IsLoaded(void)
  17. {
  18. /*char t[64] = {0};
  19. wsprintfA(t,"%d %d %d\n%d",sdk.bLoadFailed, sdk.primo, sdk.uRef, !(!sdk.uRef || !sdk.primo));
  20. MessageBoxA(0,t,0,0);*/
  21. return !(!sdk.uRef /*|| !sdk.primo*/);//(sdk.bLoadFailed==FALSE);
  22. }
  23. LONG PrimoSDKHelper_Initialize(void)
  24. {
  25. return 0;
  26. #if 0
  27. if (sdk.bLoadFailed) return 0;
  28. if (!sdk.uRef)
  29. {
  30. BOOL bFailed = TRUE;
  31. waServiceFactory *sf = plugin.service->service_getServiceByGuid(obj_primo::getServiceGuid());
  32. if (sf) sdk.primo = reinterpret_cast<obj_primo *>(sf->getInterface());
  33. if (sdk.primo)
  34. bFailed = FALSE;
  35. sdk.bLoadFailed += bFailed;
  36. }
  37. InterlockedIncrement(&sdk.uRef);
  38. return sdk.uRef;
  39. #endif
  40. }
  41. LONG PrimoSDKHelper_Uninitialize(void)
  42. {
  43. return 0;
  44. #if 0
  45. if (sdk.uRef && 0 == InterlockedDecrement(&sdk.uRef))
  46. {
  47. if (sdk.primo)
  48. {
  49. waServiceFactory *sf = plugin.service->service_getServiceByGuid(obj_primo::getServiceGuid());
  50. if (sf) sf->releaseInterface(sdk.primo);
  51. sdk.primo = 0;
  52. }
  53. }
  54. return sdk.uRef;
  55. #endif
  56. }
  57. DWORD PrimoSDKHelper_UnitInfo(PDWORD pdwUnit, PDWORD pdwType, PBYTE szDescr, PDWORD pdwReady)
  58. {
  59. return PRIMOSDK_CMDSEQUENCE;
  60. #if 0
  61. if (!sdk.uRef) return PRIMOSDK_CMDSEQUENCE;
  62. if (!sdk.primo) return PRIMOSDK_CMDSEQUENCE;
  63. return sdk.primo->UnitInfo(pdwUnit, pdwType, szDescr, pdwReady);
  64. #endif
  65. }
  66. DWORD PrimoSDKHelper_UnitInfo2(PDWORD pdwUnit, PDWORD pdwTypes, PDWORD pdwClass, PDWORD pdwBusType, PDWORD pdwRFU)
  67. {
  68. return PRIMOSDK_CMDSEQUENCE;
  69. #if 0
  70. if (!sdk.uRef) return PRIMOSDK_CMDSEQUENCE;
  71. if (!sdk.primo) return PRIMOSDK_CMDSEQUENCE;
  72. return sdk.primo->UnitInfo2(pdwUnit, pdwTypes, pdwClass, pdwBusType, pdwRFU);
  73. #endif
  74. }
  75. DWORD PrimoSDKHelper_DiscInfoEx(PDWORD pdwUnit, DWORD dwFlags, PDWORD pdwMediumType, PDWORD pdwMediumFormat, PDWORD pdwErasable, PDWORD pdwTracks, PDWORD pdwUsed, PDWORD pdwFree)
  76. {
  77. #if 0
  78. if (!sdk.uRef) return PRIMOSDK_CMDSEQUENCE;
  79. if (!sdk.primo) return PRIMOSDK_CMDSEQUENCE;
  80. return sdk.primo->DiscInfoEx(pdwUnit, dwFlags, pdwMediumType, pdwMediumFormat, pdwErasable, pdwTracks, pdwUsed, pdwFree);
  81. #endif
  82. return PRIMOSDK_CMDSEQUENCE;
  83. }
  84. DWORD PrimoSDKHelper_DiscInfo2(PDWORD pdwUnit, PDWORD pdwMedium, PDWORD pdwProtectedDVD, PDWORD pdwFlags, PDWORD pdwMediumEx, PDWORD pdwRFU3)
  85. {
  86. return PRIMOSDK_CMDSEQUENCE;
  87. #if 0
  88. if (!sdk.uRef) return PRIMOSDK_CMDSEQUENCE;
  89. if (!sdk.primo) return PRIMOSDK_CMDSEQUENCE;
  90. return sdk.primo->DiscInfo2(pdwUnit, pdwMedium, pdwProtectedDVD, pdwFlags, pdwMediumEx, pdwRFU3);
  91. #endif
  92. }