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.

49 lines
1.5 KiB

  1. // File: pfnwininet.cpp
  2. #include "precomp.h"
  3. #include "pfnwininet.h"
  4. PFN_IOPEN WININET::InternetOpen = NULL;
  5. PFN_ISETCALLBACK WININET::InternetSetStatusCallback = NULL;
  6. PFN_IOPENURL WININET::InternetOpenUrl = NULL;
  7. PFN_IREADFILE WININET::InternetReadFile = NULL;
  8. PFN_IQUERYDATA WININET::InternetQueryDataAvailable = NULL;
  9. PFN_ICLOSEHAN WININET::InternetCloseHandle = NULL;
  10. //PFN_IREADFILEEX WININET::InternetReadFileEx = NULL;
  11. HINSTANCE WININET::m_hInstance = NULL;
  12. #define WININET_APIFCN_ENTRYA(pfn) {(PVOID *) &WININET::##pfn, #pfn ## "A"}
  13. #define WININET_APIFCN_ENTRYW(pfn) {(PVOID *) &WININET::##pfn, #pfn ## "A"}
  14. #define WININET_APIFCN_ENTRYNONE(pfn) {(PVOID *) &WININET::##pfn, #pfn }
  15. #ifdef UNICODE
  16. #define WININET_APIFCN_ENTRY WININET_APIFCN_ENTRYW
  17. #else
  18. #define WININET_APIFCN_ENTRY WININET_APIFCN_ENTRYA
  19. #endif
  20. APIFCN s_apiFcnWinInet[] = {
  21. WININET_APIFCN_ENTRYA(InternetOpen),
  22. WININET_APIFCN_ENTRYNONE(InternetSetStatusCallback),
  23. WININET_APIFCN_ENTRY(InternetOpenUrl),
  24. WININET_APIFCN_ENTRYNONE(InternetReadFile),
  25. WININET_APIFCN_ENTRYNONE(InternetQueryDataAvailable),
  26. WININET_APIFCN_ENTRYNONE(InternetCloseHandle)
  27. };
  28. HRESULT WININET::Init(void)
  29. {
  30. if (NULL != WININET::m_hInstance)
  31. return S_OK;
  32. return HrInitLpfn(s_apiFcnWinInet, ARRAY_ELEMENTS(s_apiFcnWinInet), &WININET::m_hInstance, TEXT("WININET.DLL"));
  33. }
  34. void WININET::DeInit(void)
  35. {
  36. // TODO - why does the main thread die when I unload this?
  37. if( NULL != WININET::m_hInstance )
  38. FreeLibrary( WININET::m_hInstance );
  39. }