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.

69 lines
2.3 KiB

  1. /***
  2. *dll_argv.c - __setargv() routine for use with C Run-Time as a DLL (CRTDLL)
  3. *
  4. * Copyright (c) 1994-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This object is part of the start-up code for EXE's linked with
  8. * CRTDLL.LIB/MSVCRT.LIB. This object will be linked into the user
  9. * EXE if and only if the user explicitly links with SETARGV.OBJ.
  10. * The code in this object sets the flag that is passed to the
  11. * C Run-Time DLL to enable wildcard expansion of the argv[] vector.
  12. *
  13. *Revision History:
  14. * 03-04-94 SKS Initial version
  15. * 03-27-01 PML Now return an int (vs7#231220)
  16. *
  17. *******************************************************************************/
  18. #ifndef _POSIX_
  19. #ifdef CRTDLL
  20. #include <cruntime.h>
  21. #include <internal.h>
  22. /***
  23. *__setargv - dummy version (for wildcard expansion) for CRTDLL.DLL model only
  24. *
  25. *Purpose:
  26. * If the EXE that is linked with CRTDLL.LIB is linked explicitly with
  27. * SETARGV.OBJ, the call to _setargv() in the C Run-Time start-up code
  28. * (above) will call this routine, instead of calling a dummy version of
  29. * _setargv() which will do nothing. This will set to one the static
  30. * variable which is passed to __getmainargs(), thus enabling wildcard
  31. * expansion of the command line arguments.
  32. *
  33. * In the statically-linked C Run-Time models, _setargv() and __setargv()
  34. * are the actual routines that do the work, but this code exists in
  35. * CRTDLL.DLL and so some tricks have to be played to make the same
  36. * SETARGV.OBJ work for EXE's linked with both LIBC.LIB and CRTDLL.LIB.
  37. *
  38. *Entry:
  39. * The static variable _dowildcard is zero (presumably).
  40. *
  41. *Exit:
  42. * The static variable _dowildcard is set to one, meaning that the
  43. * routine __getmainargs() in CRTDLL.DLL *will* do wildcard expansion on
  44. * the command line arguments. (The default behavior is that it won't.)
  45. * Always return 0 (full version in DLL code returns -1 on error)
  46. *
  47. *Exceptions:
  48. *
  49. *******************************************************************************/
  50. extern int _dowildcard; /* should be in <internal.h> */
  51. #ifdef WPRFLAG
  52. int __cdecl __wsetargv ( void )
  53. #else
  54. int __cdecl __setargv ( void )
  55. #endif
  56. {
  57. _dowildcard = 1;
  58. return 0;
  59. }
  60. #endif /* CRTDLL */
  61. #endif /* !_POSIX_ */