Leaked source code of windows server 2003
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.

143 lines
3.8 KiB

  1. //========================================================================
  2. // Copyright (C) 1997 Microsoft Corporation
  3. // Author: RameshV
  4. // Description: This file has been generated. Pl look at the .c file
  5. //========================================================================
  6. #ifndef _MM_OPTL_H_
  7. #define _MM_OPTL_H_
  8. #include "server\uniqid.h"
  9. typedef ARRAY M_OPTLIST;
  10. typedef PARRAY PM_OPTLIST;
  11. typedef LPARRAY LPM_OPTLIST;
  12. DWORD _inline
  13. MemOptListInit(
  14. IN OUT PM_OPTLIST OptList
  15. ) {
  16. return MemArrayInit(OptList);
  17. }
  18. DWORD _inline
  19. MemOptListCleanup(
  20. IN OUT PM_OPTLIST OptList
  21. ) {
  22. return MemArrayCleanup(OptList);
  23. }
  24. DWORD _inline
  25. MemOptListAddOption( // Add or replace an option
  26. IN OUT PM_OPTLIST OptList,
  27. IN PM_OPTION Opt,
  28. OUT PM_OPTION *DeletedOpt // OPTIONAL: old option or NULL
  29. ) // EndExport(function)
  30. { // if DeletedOpt is NULL, then the option would just be freed.
  31. ARRAY_LOCATION Loc;
  32. DWORD Error;
  33. PM_OPTION ThisOpt;
  34. AssertRet(OptList && Opt, ERROR_INVALID_PARAMETER);
  35. if( DeletedOpt ) *DeletedOpt = NULL;
  36. Error = MemArrayInitLoc(OptList, &Loc);
  37. while( ERROR_FILE_NOT_FOUND != Error ) {
  38. Require(ERROR_SUCCESS == Error);
  39. Error = MemArrayGetElement(OptList, &Loc, (LPVOID*)&ThisOpt);
  40. Require(ERROR_SUCCESS == Error );
  41. Require(ThisOpt);
  42. if( ThisOpt->OptId == Opt->OptId ) {
  43. Error = DeleteRecord( ThisOpt->UniqId );
  44. if ( ERROR_SUCCESS != Error ) {
  45. return Error;
  46. }
  47. Error = MemArraySetElement(OptList, &Loc, (LPVOID)Opt);
  48. Require(ERROR_SUCCESS == Error);
  49. if( DeletedOpt ) (*DeletedOpt) = ThisOpt;
  50. else MemOptCleanup(ThisOpt);
  51. return ERROR_SUCCESS;
  52. }
  53. Error = MemArrayNextLoc(OptList, &Loc);
  54. } // while
  55. Error = MemArrayAddElement(OptList, (LPVOID)Opt);
  56. return Error;
  57. } // MemOptListAddOption()
  58. //BeginExport(inline)
  59. DWORD _inline
  60. MemOptListAddAnotherOption( // add without checking for duplicates
  61. IN OUT PM_OPTLIST OptList,
  62. IN PM_OPTION Opt
  63. ) {
  64. return MemArrayAddElement(OptList, (LPVOID)Opt);
  65. }
  66. DWORD _inline
  67. MemOptListFindOption(
  68. IN PM_OPTLIST OptList,
  69. IN DWORD OptId,
  70. OUT PM_OPTION *Opt
  71. ) {
  72. ARRAY_LOCATION Loc;
  73. DWORD Error;
  74. AssertRet(OptList && Opt, ERROR_INVALID_PARAMETER );
  75. Error = MemArrayInitLoc(OptList, &Loc);
  76. while( ERROR_FILE_NOT_FOUND != Error ) {
  77. Require(ERROR_SUCCESS == Error);
  78. Error = MemArrayGetElement(OptList, &Loc, (LPVOID*)Opt);
  79. Require(ERROR_SUCCESS == Error);
  80. Require(*Opt);
  81. if( (*Opt)->OptId == OptId )
  82. return ERROR_SUCCESS;
  83. Error = MemArrayNextLoc(OptList, &Loc);
  84. }
  85. *Opt = NULL;
  86. return ERROR_FILE_NOT_FOUND;
  87. }
  88. DWORD
  89. MemOptListDelOption(
  90. IN PM_OPTLIST OptList,
  91. IN DWORD OptId
  92. ) ;
  93. DWORD _inline
  94. MemOptListSize(
  95. IN PM_OPTLIST OptList
  96. ) {
  97. return MemArraySize(OptList);
  98. }
  99. DWORD
  100. MemOptListDelList(
  101. IN PM_OPTLIST OptList
  102. );
  103. #endif // _MM_OPTL_H_
  104. //========================================================================
  105. // end of file
  106. //========================================================================