main.c
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 1k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. #include "diskcopy.h"
  2. HINSTANCE g_hinst = NULL;
  3. int _stdcall WinMainT(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmdLine, int nCmdShow)
  4. {
  5.     g_hinst = hInstance;
  6.     SHCopyDisk(NULL, -1, -1, 0);
  7.     return TRUE;
  8. }
  9. // stolen from the CRT, used to shirink our code
  10. int _stdcall ModuleEntry(void)
  11. {
  12.     int i;
  13.     STARTUPINFO si;
  14.     LPTSTR pszCmdLine = GetCommandLine();
  15.     if ( *pszCmdLine == TEXT('"') ) {
  16.         /*
  17.          * Scan, and skip over, subsequent characters until
  18.          * another double-quote or a null is encountered.
  19.          */
  20.         while ( *++pszCmdLine && (*pszCmdLine
  21.           != TEXT('"')) );
  22.         /*
  23.          * If we stopped on a double-quote (usual case), skip
  24.          * over it.
  25.          */
  26.         if ( *pszCmdLine == TEXT('"') )
  27.          pszCmdLine++;
  28.     }
  29.     else {
  30.         while (*pszCmdLine > TEXT(' '))
  31.          pszCmdLine++;
  32.     }
  33.     /*
  34.      * Skip past any white space preceeding the second token.
  35.      */
  36.     while (*pszCmdLine && (*pszCmdLine <= TEXT(' '))) {
  37.         pszCmdLine++;
  38.     }
  39.     si.dwFlags = 0;
  40.     GetStartupInfoA(&si);
  41.     i = WinMainT(GetModuleHandle(NULL), NULL, pszCmdLine,
  42.                    si.dwFlags & STARTF_USESHOWWINDOW ? si.wShowWindow : SW_SHOWDEFAULT);
  43.     ExitProcess(i);
  44. }