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.

125 lines
3.4 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. typedef ARRAY M_OPTLIST;
  7. typedef PARRAY PM_OPTLIST;
  8. typedef LPARRAY LPM_OPTLIST;
  9. DWORD _inline
  10. MemOptListInit(
  11. IN OUT PM_OPTLIST OptList
  12. ) {
  13. return MemArrayInit(OptList);
  14. }
  15. DWORD _inline
  16. MemOptListCleanup(
  17. IN OUT PM_OPTLIST OptList
  18. ) {
  19. return MemArrayCleanup(OptList);
  20. }
  21. DWORD _inline
  22. MemOptListAddOption( // Add or replace an option
  23. IN OUT PM_OPTLIST OptList,
  24. IN PM_OPTION Opt,
  25. OUT PM_OPTION *DeletedOpt // OPTIONAL: old option or NULL
  26. ) // EndExport(function)
  27. { // if DeletedOpt is NULL, then the option would just be freed.
  28. ARRAY_LOCATION Loc;
  29. DWORD Error;
  30. PM_OPTION ThisOpt;
  31. AssertRet(OptList && Opt, ERROR_INVALID_PARAMETER);
  32. if( DeletedOpt ) *DeletedOpt = NULL;
  33. Error = MemArrayInitLoc(OptList, &Loc);
  34. while( ERROR_FILE_NOT_FOUND != Error ) {
  35. Require(ERROR_SUCCESS == Error);
  36. Error = MemArrayGetElement(OptList, &Loc, (LPVOID*)&ThisOpt);
  37. Require(ERROR_SUCCESS == Error );
  38. Require(ThisOpt);
  39. if( ThisOpt->OptId == Opt->OptId ) {
  40. Error = MemArraySetElement(OptList, &Loc, (LPVOID)Opt);
  41. Require(ERROR_SUCCESS == Error);
  42. if( DeletedOpt ) (*DeletedOpt) = ThisOpt;
  43. else MemOptCleanup(ThisOpt);
  44. return ERROR_SUCCESS;
  45. }
  46. Error = MemArrayNextLoc(OptList, &Loc);
  47. }
  48. Error = MemArrayAddElement(OptList, (LPVOID)Opt);
  49. return Error;
  50. }
  51. //BeginExport(inline)
  52. DWORD _inline
  53. MemOptListAddAnotherOption( // add without checking for duplicates
  54. IN OUT PM_OPTLIST OptList,
  55. IN PM_OPTION Opt
  56. ) {
  57. return MemArrayAddElement(OptList, (LPVOID)Opt);
  58. }
  59. DWORD _inline
  60. MemOptListFindOption(
  61. IN PM_OPTLIST OptList,
  62. IN DWORD OptId,
  63. OUT PM_OPTION *Opt
  64. ) {
  65. ARRAY_LOCATION Loc;
  66. DWORD Error;
  67. AssertRet(OptList && Opt, ERROR_INVALID_PARAMETER );
  68. Error = MemArrayInitLoc(OptList, &Loc);
  69. while( ERROR_FILE_NOT_FOUND != Error ) {
  70. Require(ERROR_SUCCESS == Error);
  71. Error = MemArrayGetElement(OptList, &Loc, (LPVOID*)Opt);
  72. Require(ERROR_SUCCESS == Error);
  73. Require(*Opt);
  74. if( (*Opt)->OptId == OptId )
  75. return ERROR_SUCCESS;
  76. Error = MemArrayNextLoc(OptList, &Loc);
  77. }
  78. *Opt = NULL;
  79. return ERROR_FILE_NOT_FOUND;
  80. }
  81. DWORD
  82. MemOptListDelOption(
  83. IN PM_OPTLIST OptList,
  84. IN DWORD OptId
  85. ) ;
  86. DWORD _inline
  87. MemOptListSize(
  88. IN PM_OPTLIST OptList
  89. ) {
  90. return MemArraySize(OptList);
  91. }
  92. //========================================================================
  93. // end of file
  94. //========================================================================