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.

58 lines
1.6 KiB

  1. #include <windows.h>
  2. int _stdcall ModuleEntry(void)
  3. {
  4. int i;
  5. STARTUPINFO si;
  6. LPSTR pszCmdLine = GetCommandLine();
  7. if ( *pszCmdLine == '\"' ) {
  8. /*
  9. * Scan, and skip over, subsequent characters until
  10. * another double-quote or a null is encountered.
  11. */
  12. while ( *++pszCmdLine && (*pszCmdLine != '\"') )
  13. ;
  14. /*
  15. * If we stopped on a double-quote (usual case), skip
  16. * over it.
  17. */
  18. if ( *pszCmdLine == '\"' )
  19. pszCmdLine++;
  20. }
  21. else {
  22. while (*pszCmdLine > ' ')
  23. pszCmdLine++;
  24. }
  25. /*
  26. * Skip past any white space preceeding the second token.
  27. */
  28. while (*pszCmdLine && (*pszCmdLine <= ' ')) {
  29. pszCmdLine++;
  30. }
  31. si.dwFlags = 0;
  32. GetStartupInfoA(&si);
  33. i = WinMain(GetModuleHandle(NULL), NULL, pszCmdLine,
  34. si.dwFlags & STARTF_USESHOWWINDOW ? si.wShowWindow : SW_SHOWDEFAULT);
  35. ExitProcess(i);
  36. return i; // We never comes here.
  37. }
  38. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  39. {
  40. HWND hwndIE;
  41. if ((hwndIE = FindWindow("IEFrame", NULL)) != NULL ||
  42. (hwndIE = FindWindow("Internet Explorer_Frame", NULL)) != NULL ||
  43. (hwndIE = FindWindow("CabinetWClass", NULL)) != NULL)
  44. PostMessage(hwndIE, WM_CLOSE, (WPARAM) 0, (LPARAM) 0);
  45. if ((hwndIE = FindWindow("IECD", NULL)) != NULL)
  46. PostMessage(hwndIE, WM_CLOSE, (WPARAM) 0, (LPARAM) 0);
  47. return 0;
  48. }