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.

120 lines
2.8 KiB

  1. #include <pch.hxx>
  2. #include "dllmain.h"
  3. #include "demand.h"
  4. #include "resource.h"
  5. #include "saferun.h"
  6. #include "viewsrc.h"
  7. #include "triutil.h"
  8. #include "mhtml.h"
  9. MIMEOLEAPI MimeEditViewSource(HWND hwndParent, IMimeMessage *pMsg)
  10. {
  11. TraceCall("MimeEditViewSource");
  12. return ViewSource(hwndParent, pMsg);
  13. }
  14. MIMEOLEAPI MimeEditVerifyTrust(HWND hwnd, LPCSTR pszFileName, LPCSTR pszPathName)
  15. {
  16. LPWSTR pszFileNameW = NULL,
  17. pszPathNameW = NULL;
  18. HRESULT hr = S_OK;
  19. TraceCall ("MimeEditVerifyTrust");
  20. AssertSz(pszFileName, "Someone forgot to pass in name. Bummer.");
  21. AssertSz(pszPathName, "Someone forgot to pass in name. Bummer.");
  22. IF_NULLEXIT(pszFileNameW = PszToUnicode(CP_ACP, pszFileName));
  23. IF_NULLEXIT(pszPathNameW = PszToUnicode(CP_ACP, pszPathName));
  24. hr = VerifyTrust(hwnd, pszFileNameW, pszFileNameW);
  25. exit:
  26. MemFree(pszFileNameW);
  27. MemFree(pszPathNameW);
  28. return TraceResult(hr);
  29. }
  30. MIMEOLEAPI MimeEditIsSafeToRun(HWND hwnd, LPCSTR pszFileName, BOOL fPrompt)
  31. {
  32. HRESULT hr = S_OK;
  33. LPWSTR pwszFileName;
  34. TraceCall ("MimeEditIsSafeToRun");
  35. Assert(pszFileName);
  36. IF_NULLEXIT(pwszFileName = PszToUnicode(CP_ACP, pszFileName));
  37. IF_FAILEXIT(hr = IsSafeToRun(hwnd, pwszFileName, fPrompt));
  38. exit:
  39. MemFree(pwszFileName);
  40. return hr;
  41. }
  42. MIMEOLEAPI MimeEditGetBackgroundImageUrl(IUnknown *pDocUnk, BSTR *pbstr)
  43. {
  44. IHTMLDocument2 *pDoc;
  45. HRESULT hr;
  46. TraceCall ("MimeEditGetBackgroundImageUrl");
  47. if (pDocUnk == NULL || pbstr == NULL)
  48. return E_INVALIDARG;
  49. hr = pDocUnk->QueryInterface(IID_IHTMLDocument2, (LPVOID *)&pDoc);
  50. if (!FAILED(hr))
  51. {
  52. hr = GetBackgroundImage(pDoc, pbstr);
  53. pDoc->Release();
  54. }
  55. return hr;
  56. }
  57. MIMEOLEAPI MimeEditCreateMimeDocument(IUnknown *pDocUnk, IMimeMessage *pMsgSrc, DWORD dwFlags, IMimeMessage **ppMsg)
  58. {
  59. HRESULT hr;
  60. IMimeMessage *pMsg=0;
  61. IHTMLDocument2 *pDoc=0;
  62. TraceCall ("MimeEditCreateMimeDocument");
  63. if (pDocUnk == NULL || ppMsg == NULL)
  64. return TraceResult(E_INVALIDARG);
  65. hr = pDocUnk->QueryInterface(IID_IHTMLDocument2, (LPVOID *)&pDoc);
  66. if (FAILED(hr))
  67. goto error;
  68. hr = MimeOleCreateMessage(NULL, &pMsg);
  69. if (FAILED(hr))
  70. goto error;
  71. hr = SaveAsMHTML(pDoc, dwFlags, pMsgSrc, pMsg, NULL);
  72. if (FAILED(hr))
  73. goto error;
  74. *ppMsg = pMsg;
  75. pMsg = NULL;
  76. error:
  77. ReleaseObj(pMsg);
  78. ReleaseObj(pDoc);
  79. return hr;
  80. }
  81. MIMEOLEAPI MimeEditDocumentFromStream(LPSTREAM pstm, REFIID riid, LPVOID *ppv)
  82. {
  83. TraceCall ("MimeEditDocumentFromStream");
  84. if (pstm==NULL || ppv==NULL)
  85. return TraceResult(E_FAIL);
  86. return HrCreateSyncTridentFromStream(pstm, riid, ppv);
  87. }