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.

66 lines
1.8 KiB

  1. /*****************************************************************/
  2. /** Microsoft Windows **/
  3. /** Copyright (C) Microsoft Corp., 1995 **/
  4. /*****************************************************************/
  5. //
  6. // AUTODIAL.CPP - winsock autodial hook code
  7. //
  8. // HISTORY:
  9. //
  10. // 3/22/95 jeremys Created.
  11. // 4/11/97 darrenmi Moved functionality to wininet. Only stubs remain.
  12. //
  13. #include "project.hpp"
  14. #include <wininet.h>
  15. /*******************************************************************
  16. The following stubs are retained for compatibility. This
  17. functionality has been moved to wininet.
  18. ********************************************************************/
  19. INTSHCUTAPI BOOL WINAPI InetIsOffline(DWORD dwFlags)
  20. {
  21. DWORD dwState = 0, dwSize = sizeof(DWORD);
  22. BOOL fRet = FALSE;
  23. if(InternetQueryOption(NULL, INTERNET_OPTION_CONNECTED_STATE, &dwState,
  24. &dwSize))
  25. {
  26. if(dwState & INTERNET_STATE_DISCONNECTED_BY_USER)
  27. fRet = TRUE;
  28. }
  29. return fRet;
  30. }
  31. INTSHCUTAPI STDAPI_(BOOL) WINAPI SetInetOffline(BOOL fOffline)
  32. {
  33. INTERNET_CONNECTED_INFO ci;
  34. memset(&ci, 0, sizeof(ci));
  35. if(fOffline) {
  36. ci.dwConnectedState = INTERNET_STATE_DISCONNECTED_BY_USER;
  37. ci.dwFlags = ISO_FORCE_DISCONNECTED;
  38. } else {
  39. ci.dwConnectedState = INTERNET_STATE_CONNECTED;
  40. }
  41. InternetSetOption(NULL, INTERNET_OPTION_CONNECTED_STATE, &ci, sizeof(ci));
  42. return fOffline;
  43. }
  44. // forward this call to wininet. Toast once appropriate registry entries
  45. // are set.
  46. extern "C" void AutodialHookCallback(DWORD dwOpCode, LPCVOID lpParam);
  47. extern "C" void InternetAutodialCallback(DWORD dwOpCode, LPCVOID lpParam);
  48. void AutodialHookCallback(DWORD dwOpCode,LPCVOID lpParam)
  49. {
  50. InternetAutodialCallback(dwOpCode, lpParam);
  51. }