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.

140 lines
3.4 KiB

  1. #define INC_OLE2
  2. #include <windows.h>
  3. #include <ole2.h>
  4. #include <ole2ver.h>
  5. #define INITGUIDS
  6. #include <shlguid.h>
  7. #include <shlobj.h>
  8. #include <initguid.h>
  9. #include "exdisp.h"
  10. #include <exdispid.h>
  11. #include <hlink.h>
  12. #define INC_CONTROLS
  13. #include <inetsdk.h>
  14. #include "webcheck.h"
  15. #include <downld.h>
  16. #include "downld.h"
  17. // Free us from the tyranny of CRT by defining our own new and delete
  18. #define CPP_FUNCTIONS
  19. #include <crtfree.h>
  20. #undef TF_THISMODULE
  21. #define TF_THISMODULE TF_TESTAPP
  22. HINSTANCE g_hInst;
  23. int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hInstPrev, LPSTR pszCmdLine, int nCmdShow)
  24. {
  25. CUrlDownload *pDownload;
  26. MSG msg;
  27. if (FAILED(CoInitialize(NULL)))
  28. return 0;
  29. //BSTR bStr = SysAllocString(L"http://ohserv/testcases/bvt/ocs/scroll/LtoR.htm");
  30. //BSTR bStr = SysAllocString(L"http://ohserv/testcases/bvt/frame1.htm");
  31. BSTR bStr = SysAllocString(L"http://www.oz.net/~evad/");
  32. //BSTR bStr = SysAllocString(L"http://ohserv/testcases/bvt/ocs/ocx1.htm");
  33. g_hInst = hInst;
  34. pDownload = NewDownloader(0,0);
  35. pDownload->put_Flags(DLCTL_FLAGS_SET | DLCTL_RUNSILENTACTIVEXCTLS );
  36. pDownload->BeginDownloadURL(bStr);
  37. while (1){
  38. if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
  39. TranslateMessage(&msg);
  40. DispatchMessage(&msg);
  41. }
  42. }
  43. return 0;
  44. }
  45. int _stdcall ModuleEntry(void)
  46. {
  47. int i;
  48. STARTUPINFOA si;
  49. LPTSTR pszCmdLine = GetCommandLine();
  50. //
  51. // We don't want the "No disk in drive X:" requesters, so we set
  52. // the critical error mask such that calls will just silently fail
  53. //
  54. SetErrorMode(SEM_FAILCRITICALERRORS);
  55. if ( *pszCmdLine == TEXT('\"') ) {
  56. /*
  57. * Scan, and skip over, subsequent characters until
  58. * another double-quote or a null is encountered.
  59. */
  60. while ( *++pszCmdLine && (*pszCmdLine
  61. != TEXT('\"')) );
  62. /*
  63. * If we stopped on a double-quote (usual case), skip
  64. * over it.
  65. */
  66. if ( *pszCmdLine == TEXT('\"') )
  67. pszCmdLine++;
  68. }
  69. else {
  70. while (*pszCmdLine > TEXT(' '))
  71. pszCmdLine++;
  72. }
  73. /*
  74. * Skip past any white space preceeding the second token.
  75. */
  76. while (*pszCmdLine && (*pszCmdLine <= TEXT(' '))) {
  77. pszCmdLine++;
  78. }
  79. si.dwFlags = 0;
  80. GetStartupInfoA(&si);
  81. i = WinMain(GetModuleHandle(NULL), NULL, pszCmdLine,
  82. si.dwFlags & STARTF_USESHOWWINDOW ? si.wShowWindow :
  83. SW_SHOWDEFAULT);
  84. ExitThread(i); // We only come here when we are not the shell...
  85. return i;
  86. }
  87. //////////////////////////////////////////////////////////////////////////
  88. //
  89. // Utility functions
  90. //
  91. //////////////////////////////////////////////////////////////////////////
  92. #ifdef DEBUG
  93. void __cdecl _Dbg(LPCSTR pszMsg, ...)
  94. {
  95. char sz[1024];
  96. wvsprintf(sz, pszMsg, (va_list)(&pszMsg + 1));
  97. OutputDebugString(sz);
  98. OutputDebugString("\r\n");
  99. }
  100. #endif
  101. //////////////////////////////////////////////////////////////////////////
  102. //
  103. // helper functions
  104. //
  105. //////////////////////////////////////////////////////////////////////////
  106. int MyOleStrToStrN(LPTSTR psz, int cchMultiByte, LPCOLESTR pwsz)
  107. {
  108. return WideCharToMultiByte(CP_ACP, 0, pwsz, -1, psz,
  109. cchMultiByte, NULL, NULL);
  110. }
  111. int MyStrToOleStrN(LPOLESTR pwsz, int cchWideChar, LPCTSTR psz)
  112. {
  113. return MultiByteToWideChar(CP_ACP, 0, psz, -1, pwsz, cchWideChar);
  114. }