Leaked source code of windows server 2003
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.

68 lines
1.9 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.h"
  14. #pragma hdrstop
  15. #include <wininet.h>
  16. /*******************************************************************
  17. The following stubs are retained for compatibility. This
  18. functionality has been moved to wininet.
  19. ********************************************************************/
  20. INTSHCUTAPI BOOL WINAPI InetIsOffline(DWORD dwFlags)
  21. {
  22. DWORD dwState = 0, dwSize = sizeof(DWORD);
  23. BOOL fRet = FALSE;
  24. if(InternetQueryOption(NULL, INTERNET_OPTION_CONNECTED_STATE, &dwState,
  25. &dwSize))
  26. {
  27. if(dwState & INTERNET_STATE_DISCONNECTED_BY_USER)
  28. fRet = TRUE;
  29. }
  30. return fRet;
  31. }
  32. INTSHCUTAPI STDAPI_(BOOL) WINAPI SetInetOffline(BOOL fOffline)
  33. {
  34. INTERNET_CONNECTED_INFO ci;
  35. memset(&ci, 0, sizeof(ci));
  36. if(fOffline) {
  37. ci.dwConnectedState = INTERNET_STATE_DISCONNECTED_BY_USER;
  38. ci.dwFlags = ISO_FORCE_DISCONNECTED;
  39. } else {
  40. ci.dwConnectedState = INTERNET_STATE_CONNECTED;
  41. }
  42. InternetSetOption(NULL, INTERNET_OPTION_CONNECTED_STATE, &ci, sizeof(ci));
  43. return fOffline;
  44. }
  45. // forward this call to wininet. Toast once appropriate registry entries
  46. // are set.
  47. extern "C" void AutodialHookCallback(DWORD dwOpCode, LPCVOID lpParam);
  48. extern "C" void InternetAutodialCallback(DWORD dwOpCode, LPCVOID lpParam);
  49. void AutodialHookCallback(DWORD dwOpCode,LPCVOID lpParam)
  50. {
  51. InternetAutodialCallback(dwOpCode, lpParam);
  52. }