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.

79 lines
2.1 KiB

  1. /*-----------------------------------------------------------------------------
  2. mimedl.cpp
  3. Handle the downloading of MIME multi-part/mixed packages.
  4. Copyright (C) 1996 Microsoft Corporation
  5. All rights reserved.
  6. Authors:
  7. ChrisK ChrisKauffman
  8. History:
  9. 7/22/96 ChrisK Cleaned and formatted
  10. -----------------------------------------------------------------------------*/
  11. #include "pch.hpp"
  12. #include <commctrl.h>
  13. #define MAX_EXIT_RETRIES 10
  14. // ############################################################################
  15. DWORD WINAPI DownloadThreadInit(CDialingDlg *pcPDlg)
  16. {
  17. HRESULT hr = ERROR_NOT_ENOUGH_MEMORY;
  18. // HINSTANCE hADDll;
  19. // Set up for download
  20. //
  21. Assert (pcPDlg->m_pcDLAPI);
  22. hr = pcPDlg->m_pcDLAPI->DownLoadInit(pcPDlg->m_pszUrl, (DWORD_PTR *)pcPDlg, &pcPDlg->m_dwDownLoad, pcPDlg->m_hwnd);
  23. if (hr != ERROR_SUCCESS) goto ThreadInitExit;
  24. // Set up call back for progress dialog
  25. //
  26. hr = pcPDlg->m_pcDLAPI->DownLoadSetStatus(pcPDlg->m_dwDownLoad,(INTERNET_STATUS_CALLBACK)ProgressCallBack);
  27. /**
  28. // Set up Autodialer DLL
  29. //
  30. hADDll = LoadLibrary(AUTODIAL_LIBRARY);
  31. if (!hADDll) goto end_autodial_setup;
  32. fp = GetProcAddress(hADDll,AUTODIAL_INIT);
  33. if (!fp) goto end_autodial_setup;
  34. ((PFNAUTODIALINIT)fp)(g_szInitialISPFile,pcPDlg->m_pGI->fType,pcPDlg->m_pGI->bMask,pcPDlg->m_pGI->dwCountry,pcPDlg->m_pGI->wState);
  35. end_autodial_setup:
  36. **/
  37. // Download stuff MIME multipart
  38. //
  39. hr = pcPDlg->m_pcDLAPI->DownLoadExecute(pcPDlg->m_dwDownLoad);
  40. if (hr)
  41. goto ThreadInitExit;
  42. hr = pcPDlg->m_pcDLAPI->DownLoadProcess(pcPDlg->m_dwDownLoad);
  43. if (hr)
  44. goto ThreadInitExit;
  45. // Clean up
  46. //
  47. hr = pcPDlg->m_pcDLAPI->DownLoadClose(pcPDlg->m_dwDownLoad);
  48. pcPDlg->m_dwDownLoad = 0;
  49. // NOTE: I realize this line is unecessary, it would be
  50. // required if there were any code after it in this function.
  51. if (hr != ERROR_SUCCESS) goto ThreadInitExit;
  52. hr = ERROR_SUCCESS;
  53. ThreadInitExit:
  54. PostMessage(pcPDlg->m_hwnd,WM_DOWNLOAD_DONE,0,0);
  55. // if (hADDll) FreeLibrary(hADDll);
  56. return hr;
  57. }