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.

59 lines
1.6 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. //---------------------------------------------------------------------------
  4. #include "pbrush.h"
  5. extern int _cdecl ShellMessageBox(HINSTANCE hAppInst, HWND hWnd, LPCSTR
  6. lpcText, LPCSTR lpcTitle, UINT fuStyle, ...);
  7. // stolen from the CRT, used to shirink our code
  8. int _stdcall ModuleEntry(void)
  9. {
  10. STARTUPINFO si;
  11. LPSTR pszCmdLine = GetCommandLine();
  12. if ( *pszCmdLine == '\"' ) {
  13. /*
  14. * Scan, and skip over, subsequent characters until
  15. * another double-quote or a null is encountered.
  16. */
  17. while ( *++pszCmdLine && (*pszCmdLine
  18. != '\"') );
  19. /*
  20. * If we stopped on a double-quote (usual case), skip
  21. * over it.
  22. */
  23. if ( *pszCmdLine == '\"' )
  24. pszCmdLine++;
  25. }
  26. else {
  27. while (*pszCmdLine > ' ')
  28. pszCmdLine++;
  29. }
  30. /*
  31. * Skip past any white space preceeding the second token.
  32. */
  33. while (*pszCmdLine && (*pszCmdLine <= ' ')) {
  34. pszCmdLine++;
  35. }
  36. si.dwFlags = 0;
  37. GetStartupInfoA(&si);
  38. return WinMain(GetModuleHandle(NULL), NULL, pszCmdLine,
  39. si.dwFlags & STARTF_USESHOWWINDOW ? si.wShowWindow : SW_SHOWDEFAULT);
  40. }
  41. const char szFile[] = "mspaint.exe";
  42. //---------------------------------------------------------------------------
  43. int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  44. {
  45. ShellExecute(HWND_DESKTOP, NULL, szFile, lpCmdLine, NULL, nCmdShow);
  46. ExitProcess(0);
  47. return 0;
  48. }