Windows NT 4.0 source code leak
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.

98 lines
1.6 KiB

4 years ago
  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. jxenvirv.c
  5. Abstract:
  6. This module implements the HAL get and set environment variable routines
  7. for a MIPS system.
  8. Author:
  9. Environment:
  10. Kernel mode
  11. Revision History:
  12. --*/
  13. #include "halp.h"
  14. #include "arccodes.h"
  15. #include "string.h"
  16. ARC_STATUS
  17. HalGetEnvironmentVariable (
  18. IN PCHAR Variable,
  19. IN USHORT Length,
  20. OUT PCHAR Buffer
  21. )
  22. /*++
  23. Routine Description:
  24. This function locates an environment variable and returns its value.
  25. Arguments:
  26. Variable - Supplies a pointer to a zero terminated environment variable
  27. name.
  28. Length - Supplies the length of the value buffer in bytes.
  29. Buffer - Supplies a pointer to a buffer that receives the variable value.
  30. Return Value:
  31. ESUCCESS is returned if the enviroment variable is located. Otherwise,
  32. ENOENT is returned.
  33. --*/
  34. {
  35. CHAR *Value;
  36. Value = ArcGetEnvironmentVariable(Variable);
  37. if (Value==NULL)
  38. return(ENOENT);
  39. if (strlen(Value)>Length)
  40. return(ENOENT);
  41. strcpy(Buffer,Value);
  42. return ESUCCESS;
  43. }
  44. ARC_STATUS
  45. HalSetEnvironmentVariable (
  46. IN PCHAR Variable,
  47. IN PCHAR Value
  48. )
  49. /*++
  50. Routine Description:
  51. This function creates an environment variable with the specified value.
  52. Arguments:
  53. Variable - Supplies a pointer to an environment variable name.
  54. Value - Supplies a pointer to the environment variable value.
  55. Return Value:
  56. ESUCCESS is returned if the environment variable is created. Otherwise,
  57. ENOMEM is returned.
  58. --*/
  59. {
  60. return(ArcSetEnvironmentVariable(Variable,Value));
  61. }