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.

42 lines
1.2 KiB

  1. // File: pfnsetupapi.cpp
  2. #include "precomp.h"
  3. #include "pfnsetupapi.h"
  4. PFN_SET_INSTALL SETUPAPI::SetupInstallFromInfSection = NULL;
  5. PFN_SET_OPFILE SETUPAPI::SetupOpenInfFile = NULL;
  6. PFN_SET_CLFILE SETUPAPI::SetupCloseInfFile = NULL;
  7. HINSTANCE SETUPAPI::m_hInstance = NULL;
  8. #define SETUPAPI_APIFCN_ENTRYA(pfn) {(PVOID *) &SETUPAPI::##pfn, #pfn ## "A"}
  9. #define SETUPAPI_APIFCN_ENTRYW(pfn) {(PVOID *) &SETUPAPI::##pfn, #pfn ## "A"}
  10. #define SETUPAPI_APIFCN_ENTRYNONE(pfn) {(PVOID *) &SETUPAPI::##pfn, #pfn }
  11. #ifdef UNICODE
  12. #define SETUPAPI_APIFCN_ENTRY SETUPAPI_APIFCN_ENTRYW
  13. #else
  14. #define SETUPAPI_APIFCN_ENTRY SETUPAPI_APIFCN_ENTRYA
  15. #endif
  16. APIFCN s_apiFcnSETUPAPI[] = {
  17. SETUPAPI_APIFCN_ENTRY(SetupInstallFromInfSection),
  18. SETUPAPI_APIFCN_ENTRY(SetupOpenInfFile),
  19. SETUPAPI_APIFCN_ENTRYNONE(SetupCloseInfFile)
  20. };
  21. HRESULT SETUPAPI::Init(void)
  22. {
  23. if (NULL != SETUPAPI::m_hInstance)
  24. return S_OK;
  25. return HrInitLpfn(s_apiFcnSETUPAPI, ARRAY_ELEMENTS(s_apiFcnSETUPAPI), &SETUPAPI::m_hInstance, TEXT("SETUPAPI.DLL"));
  26. }
  27. void SETUPAPI::DeInit(void)
  28. {
  29. // TODO - why does the main thread die when I unload this?
  30. if( NULL != SETUPAPI::m_hInstance )
  31. FreeLibrary( SETUPAPI::m_hInstance );
  32. }