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.

65 lines
2.0 KiB

  1. /***
  2. *execv.c - execute a file
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * defines _execv() - execute a file
  8. *
  9. *Revision History:
  10. * 10-14-83 RN written
  11. * 12-11-87 JCR Added "_LOAD_DS" to declaration
  12. * 11-20-89 GJF Fixed copyright, indents. Added const attribute to
  13. * types of filename and argvector.
  14. * 03-08-90 GJF Replaced _LOAD_DS with _CALLTYPE1, added #include
  15. * <cruntime.h> and removed #include <register.h>
  16. * 07-24-90 SBM Removed redundant includes, replaced <assertm.h> by
  17. * <assert.h>
  18. * 09-27-90 GJF New-style function declarator.
  19. * 01-17-91 GJF ANSI naming.
  20. * 02-14-90 SRW Use NULL instead of _environ to get default.
  21. * 04-06-93 SKS Replace _CRTAPI* with __cdecl
  22. * 12-07-93 CFW Wide char enable.
  23. * 02-06-95 CFW assert -> _ASSERTE.
  24. * 02-06-98 GJF Changes for Win64: changed return type to intptr_t.
  25. *
  26. *******************************************************************************/
  27. #include <cruntime.h>
  28. #include <stdlib.h>
  29. #include <process.h>
  30. #include <tchar.h>
  31. #include <dbgint.h>
  32. /***
  33. *int _execv(filename, argvector) - execute a file
  34. *
  35. *Purpose:
  36. * Executes a file with given arguments. Passes arguments to _execve and
  37. * uses pointer to the default environment.
  38. *
  39. *Entry:
  40. * _TSCHAR *filename - file to execute
  41. * _TSCHAR **argvector - vector of arguments.
  42. *
  43. *Exit:
  44. * destroys calling process (hopefully)
  45. * if fails, returns -1
  46. *
  47. *Exceptions:
  48. *
  49. *******************************************************************************/
  50. intptr_t __cdecl _texecv (
  51. const _TSCHAR *filename,
  52. const _TSCHAR * const *argvector
  53. )
  54. {
  55. _ASSERTE(filename != NULL);
  56. _ASSERTE(*filename != _T('\0'));
  57. _ASSERTE(argvector != NULL);
  58. _ASSERTE(*argvector != NULL);
  59. _ASSERTE(**argvector != _T('\0'));
  60. return(_texecve(filename,argvector,NULL));
  61. }